9. Embedded programming

Group project

compare the performance and development workflows for other architectures

Individual project

read a microcontroller data sheet program your board to do something, with as many different programming languages and programming environments as possible

Research

Group project

The members of the group:

Our group compared the performance and development workflows for Arduino Uno and Atmel Nucleo STM32F401 microcontroller boards

We tested development workflow to making an LED-blinking test. In test we blinked inside LED in microcontroller board. (5 seconds on, 5 seconds off, 5 seconds on .... )

Arduino Uno

Arduino Uno base on the ATmega328P microconroller, which base on Harvard architecture 8-bit RISC processor core.

You can simulate small Arduino Uno projects in https://www.tinkercad.com/

An LED-blinking test in Arduino Uno

Step 1: First we connected Arduino Uno a standard USB cabel (Connector A to PC and connector B to Arduino Uno)

Step 2: Then we open Arduino Software (IDE). First we loaded Blink code:

1) File-Examples

2) 01.Basics

3) Blink

Step 2: Then loaded code opened in windows.

Step 3: Then we chose Arduino Uno board by picking Tools - Board - Arduino Uno.

Step 4: Then we checked Port by Tools - Port.

Step 5: Then we uploaded code to Arduino Uno by pressing upload button (arrow to right)

Step 6: On the while inside LED start to blink (5 seconds on, 5 seconds off .... )

/*
  Blink

  Turns an LED on for one second, then off for one second, repeatedly.

  Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
  it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
  the correct LED pin independent of which board is used.
  If you want to know what pin the on-board LED is connected to on your Arduino
  model, check the Technical Specs of your board at:
  https://www.arduino.cc/en/Main/Products

  modified 8 May 2014
  by Scott Fitzgerald
  modified 2 Sep 2016
  by Arturo Guadalupi
  modified 8 Sep 2016
  by Colby Newman

  This example code is in the public domain.

  http://www.arduino.cc/en/Tutorial/Blink
*/

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(5000);                       // wait for 5 seconds
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(5000);                       // wait for 5 seconds
}

Atmel Nucleo STM32F401

ATMEL

Atmel Nucleo STM32F401

https://os.mbed.com/docs/mbed-os/v6.0/quick-start/build-with-the-online-compiler.html

http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-7810-Automotive-Microcontrollers-ATmega328P_Datasheet.pdf

An LED-blinking test in Atmel Nucleo STM32F401

Step 1: First we connected Atmel Nucleo STM32F401 a standard USB cabel (Connector A to PC and connector mini B to Arduino Uno)

Step 2: First we chose Blink code by picking code from New… /New Program …

Step 3: Then we picked code from Template Blinky LED test for the ST Nucleo board

Step 4: Then we got template code

Step 4: Then we changed light on and light off times

Step 5: Then we compiled code

Step 6: Then we just copied compiled code to Node_F401RE.

Step 7: On the while LED started blinking.

#include "mbed.h"

DigitalOut myled(LED1);

int main() {
    while(1) {
        myled = 1; // LED is ON
        wait(5.0); // 5 sec
        myled = 0; // LED is OFF
        wait(5.0); // 5 sec
    }
}

Summary

Arduino Uno Atmel Nucleo STM32F401
Manufacturer Atmel Corporation Arm Holdings
Communication interface *14 digital input/output pins (of which 6 can be used as PWM outputs), * 6 analog inputs, * 4 pins for Digital Input/Output protocol 4 pins for PWM protocol * 3 pins for UART protocol * 3 pins for SPI protocol * 3 pins for I2C protocol 3 analog digital converter *2 analog inputs
Microcontroller ATmega328P
Processor 8-bit RISC processor core ARM®32-bit Cortex®-M4 CPU with FPU, RISC
Architecture Harvard Harvard
CPU Frequency 84 MHz
VDD (MCU) 1.7V to 3.6V
VIN (BOARD) 6V to 20V 7V to 15V
Flash Memory 32Kb (bootloader use 0.5Kb) 512Kb
SRAM 2 kb (ATmega328) 96Kb

https://www.espruino.com/ReferenceNUCLEOF401RE

https://microcontrollerslab.com/stm32-nucleo-board-pinout-features-applications-programming-peripherals/