Week04: Embedded programming¶
Group Assignment
demonstrate and compare the toolchains and development workflows for available embedded architectures
This group assignment document was written by Yuya Tokuyama.
Group Assignment Overview¶
We demonstrated and compared the tool chains and development workflows for the following embedded architectures.
Processor families | Chip name | in-system development | Ref. | Example |
---|---|---|---|---|
AVR | ATmega328P | ISP | Arduino ISP | ArduinoUno(ArduinoISP) > ATmega328P |
ARM | SAMD11C | JTAG/SWD | SAM D21 | XiaoSAMD21(Daplink) > SAMD11Board |
Xtensa | ESP32 | FTDI USB-Serial |
Barduino | USBSerialCable > BrduinoBoard |
What is a microcontroller board?¶
As the name suggests, a microcontroller board is a circuit board or device that has a microcontroller (microcomputer) installed on it. By writing a program created by the user into the microcontroller, it is possible to make it perform various operations. For example, it can display characters on a display, measure temperature, or communicate with the internet. In other words, a microcontroller board is a device that can realize the wishes of users who want to create a device with a certain function.
Installing the Arduino IDE¶
The official development environment for Arduino microcontroller boards is the Arduino IDE.
-
Open the Arduino IDE download page. https://www.arduino.cc/en/software
-
Download the Mac version of the Arduino IDE.
- Install the Arduino IDE.
ArduinoUno AVR ATmega328P¶
The Arduino Uno is a popular microcontroller board used by a wide range of people, from beginners to experts. It is equipped with an ATmega328P microcontroller and can easily connect to many sensors and actuators.
Connection¶
We will use the Arduino Uno as an AVR ISP (in-system programmer) to write a program to another AVR microcontroller (the ATmega328P used in the Arduino Uno).
Making Arduino UNO A Programmer¶
- Select Arduino UNO from the Tools > Board menu in the Arduino IDE.
- Select Arduino UNO from the File > sample sketch menu in the Arduino IDE.
- Select “sketch > write to microcontroller board” in the Arduino IDE to write the code.
code¶
This is a program that alternately blinks two LEDs.
Blink.uno | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
Use ArduinoUno ISP to write ATmega328P(ArduinoUno)¶
-
Select Arduino as ISP from the Tools > programmer menu in the Arduino IDE.
-
Select “sketch > Upload Using Programmer” in the Arduino IDE to upload the program.
Result¶
Barduino Xtensa ESP32¶
Barduino Xtensa ESP32 is a development board based on the ESP32 microcontroller. The ESP32 is a high-performance, multi-functional microcontroller that is equipped with the Xtensa LX6 dual-core processor.
Connection¶
Use the USBSerialCable to write programs to the Xtensa microcontroller (ESP32, which is used in Brduino).
Arduino IDE settings¶
- Select ‘Preferences’ from the Arduino IDE menu to open the Preferences window, and add https://dl.espressif.com/dl/package_esp32_index.json to the ‘Additional Board Manager URL’ field.
- Select “Arduino ESP32 Boards” from the board manager and install it.
- Set the following for writing.
- Slide the “Programing Slider Switch” to the left in Programing mode.
code¶
This is a program that alternately blinks one LED.
Blink.uno | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
Use the USBSerialCable to write programs to the ESP32(Barduino)¶
- Select “sketch > Upload” in the Arduino IDE to upload the program.
Result¶
SAMD11Board ARM SAMD11C¶
The SAMD11C is a 32-bit ARM Cortex-M0+ microcontroller provided by Microchip Technology. This microcontroller is small, low-power, and high-performance, making it suitable for a wide range of applications.
Connection¶
To write a program to the SAMD11Board, install the DAPLink firmware on XiaoSAMD21 and connect them with a jumper wire. (The PC is connected for power supply only, not for data connection)
Installing the DAPLink firmware on the Xiao SAMD21¶
-
Download the DAPLink firmware from the Seeed Studio official wiki.
-
Press the reset button twice to put the Xiao SAMD21 into bootloader mode.
-
When you connect it to your PC, it will be recognized as an external drive.
-
Drag and drop the UF2 file you downloaded onto the external drive.
Arduino IDE settings¶
-
Select ‘Preferences’ from the Arduino IDE menu to open the Preferences window, and add https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json to the ‘Additional Board Manager URL’ field.
-
Select “Seeed SAMD Boards」” from the board manager and install it.
Set up Xiao SAMD21 as a DAPLink device¶
-
Download the Seeed_Arduino_DAPLink library and add it to the Arduino IDE.
-
Select the ZIP file you downloaded by going to “Sketch” > “Include Library” > “Install Library in ZIP Format”.
-
Open “File” > “Sketch Examples” > “Seeed_Arduino_DAPLink” > “simple_daplink” in the Arduino IDE, upload it to the Xiao SAMD21, and set the Xiao SAMD21 as a DAPLink device.
-
Connect Xiao SAMD21 to your computer, and in the Arduino IDE, select “Tools” > “Boards” > “Seeed SAMD Boards” > “Seeeduino XIAO”.
-
Connect the Xiao SAMD21 and SAMD11Board as follows.
Xiao SAMD21 | SAMD11Board |
---|---|
3.3V | 3.3V |
GND | GND |
SWDIO | SWDIO |
SWCLK | SWCLK |
-
Select “Tools” > “Programmer” > “CMSIS-DAP”.
-
Select “Sketch” > “Program Bootloader” to write the bootloader to the SAMD11Board.
code¶
This is a program that alternately blinks two LEDs.
Blink.uno | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
Using SAMD11Board to write a program to ESP32 (Barduino)¶
- Select “Sketch” and then “Upload” to write the program.