Skip to content

4. Embedded Programming

Group Assignment

  • Demonstrate and compare the toolchains and development workflows for available embedded architectures
  • Document your work to the group work page and reflect on your individual page what you learned

Embedded Program Toolchain & Workflow Comparison

We went throught the below 6 toolchains to write programs to boards.

Toolchain Language Processor Chip Protocol Programming Chain Ref.
Arduino IDE + ISP C/C++ (Arduino) AVR ATtiny44, ATmega328P ISP ArduinoUno(ArduinoISP) > t44Board Arduino ISP
FA2018
Arduino IDE + UPDI C/C++ (Arduino) AVR 1-series ATtiny412, 1614, 3216 UPDI USBSerialCable > UPDI > t412Board FA2021
Arduino IDE + SWD C/C++ (Arduino) ARM SAMD11C JTAG/SWD XiaoSAMD21(Daplink) > SAMD11Board Bali Fest2022
Arduino IDE + FTDI C/C++ (Arduino) Xtensa ESP32 FTDI / USB-Serial USBSerialCable > BrduinoBoard Barduino
FA2020
PlatformIO + FTDI C/C++ Xtensa ESP32 FTDI / USB-Serial USBSerialCable > BrduinoBoard Barduino
FA2020
Thonny / MicroPython MicroPython RP-series RP2040 USB (UF2) USB-C Cable → Xiao RP2040 Raspberry Pi

Arduino IDE + ISP

Result: Unsuccessful ❌

ISP (In-System Programming) is one of the oldest methods for programming AVR microcontrollers. An Arduino board (e.g., Arduino Uno) is used as a programmer by loading the “ArduinoISP” sketch onto it. It then communicates with the target chip (ATtiny44, ATmega328P) over the SPI protocol using 6 lines (MISO, MOSI, SCK, RESET, VCC, GND). The code is written in C/C++ using the Arduino IDE. This time, we used Arduino Uno as the programmer and target chip was ATmega328P on Arduino Nano.

Arduino IDE + ISP

We followed the steps as in the official Arduino site and past Kannai documents.

  1. Connect Arduino Uno to PC by USB
  2. Select Board: Arduino UNO
  3. Upload ArduinoISP from sample sketch: File > Examples > 11. ArduinoISP > ArduinoISP
  4. Write the sketch to UNO
  5. Connect Arduino Uno(ISP) to Arduino Nano(Target)
  6. Open a sketch for Arduino Nano
  7. Select programmer : Arduino as ISP
  8. Write the sketch from programmer

However, the operation was not successfull. Arduino IDE + ISP, failure

Arduino IDE + UPDI

Result: Success ✅

UPDI (Unified Program and Debug Interface) is a newer single-wire programming interface for the AVR 1-series chips (ATtiny412, 1614, 3216). Unlike ISP which requires multiple pins, UPDI only needs one data line plus power and ground. A simple USB-Serial adapter with a resistor can serve as a UPDI programmer. The Arduino IDE supports these chips through the megaTinyCore board package.

Arduino IDE + UPDI

We went through the following simple steps.

  1. Connect USB-Serial adapter to PC
  2. On Arduino IDE: Tools > Programmer: ‘Serial Port and 4.7k (pyupdi style)’

Select serical port We wrote echo.ino program and it worked perfectly! Echo

Arduino IDE + SWD

Result: Unsuccessful ❌

SWD (Serial Wire Debug) is the standard programming and debugging interface for ARM-based microcontrollers like the SAMD11C. It uses two wires (SWDIO and SWCLK) and allows not only programming but also real-time debugging. Here, a Xiao SAMD21 board running DAPLink firmware acts as the programmer/debugger for the target SAMD11C board.

Arduino IDE + SWD

We went through the following steps.

  1. Upload DAPLink firmware to Xiao see details
  2. Burn Bootloader to SAMD11C board

However, while loading Board Manager, the operation timed out and unsuccessful. Timeout

Arduino IDE + FTDI

Result: Unsuccessful ❌

FTDI / USB-Serial is a method for uploading programs to boards that already have a bootloader installed (like the ESP32). A USB-to-Serial adapter sends the compiled binary over a serial connection (TX/RX). The bootloader on the ESP32 receives the data and writes it to flash memory. No special programmer hardware is needed beyond the serial cable.

Barduino + FTDI

However, again we experienced time out.

PlatformIO + FTDI

Result: Success ✅

PlatformIO is an alternative development environment to Arduino IDE that runs as a VSCode extension. It uses the same FTDI/USB-Serial upload method for the ESP32, but offers features like dependency management, a built-in library manager, and support for multiple frameworks. The code is written in C/C++ and the upload process is the same as with Arduino IDE, but with some more flexibility.

In the end we succeeded in rewriting the LED blinking program. See the video for flickering speed change.

Here are the steps to use PlatformIO as Visual Studio Code plugin.

PlatformIO + FTDI

Thonny / MicroPython

Thonny is a beginner-friendly Python IDE designed for MicroPython development. The RP2040 chip supports UF2 (USB Flashing Format) — when you hold the BOOTSEL button and plug in USB, the board appears as a USB drive. You drag the MicroPython firmware (.uf2 file) onto it to install. After that, Thonny connects over USB-Serial to run Python scripts interactively on the board, with no compilation step needed.

Thonny / MicroPython

TODO: Describe the experience of programming RP2040 via USB (UF2) using Thonny.

Disclaimer

I used Claude Code to write the description of toolchains.

Resources