Skip to content

Week 6: Embedded Programming

This week is all about embedded programming and an embedded system is a microprocessor based computer which in our case is designed to be easily interfaced with hardware. There is an incredible variety of embedded development boards out there to use and the two members of this year's lab have extensively used most of them throughout their engineering degrees.

Performance Comparisons and Data Sheets

So far in fab academy we have been using the SeedStudio Xiao RP2040, a tiny and powerful board using the Rapsberry Pi Foundation's RP2040 chip.

But to throw some other boards in comparison, there is also the official RP2040 board by Raspberry Pi themselves (the Pico) (also being used by Jaryd).

The other beginner favourite board, the arduino.

The maker favourite the ESP32-S3 (being used by Liam)

And the maker+ tier powerhouse the Teensy.

Below we have gathered a specs table for these boards.

Specification Xiao RP2040 Xiao ESP32-S3 ATMEGA328P (Arduino Uno) Renesas RA4M1 (Uno R4) NXP iMXRT1062 (Teensy 4.0/4.1)
Core Processor Dual ARM Cortex-M0+ Xtensa LX7 AVR ARM Cortex-M4 ARM Cortex-M7
Clock Speed 133 MHz 240 MHz 16 MHz 48 MHz 600 MHz
Flash Memory 2 MB 8 MB 32 KB 512 KB 2 MB (Teensy 4.0) / 8 MB (Teensy 4.1)
RAM 264 KB 512 KB 2 KB 192 KB 1 MB
Peripherals UART, SPI, I2C, ADC, PWM, PIO UART, SPI, I2C, ADC, PWM, USB, CAN(TWAI) UART, SPI, I2C, ADC, PWM UART, SPI, I2C, ADC, DAC, PWM, USB, CAN UART, SPI, I2C, ADC, PWM, USB, CAN, Ethernet
Voltage Input Range 1.8V - 5.5V 3.0V - 5.5V 5V - 12V 6V - 24V 2.7V - 5.5V
Logic Level 3.3V 3.3V 5V 5V 3.3V

(all of these images are sourced from the Core Electronics Website)

Some interesting finds!

RP2040 Datasheet

  • The obvsious: This MCU has PIO! Its almost another whole microcontroller inside of itself
  • Dispite the bus matrix, peripherals cannot be used on any pin like the ESP32 (2.1)
  • I didnt realise it featured an inbuilt watchdog
  • It has onboard brown-out detection

RA4M1 datasheet

  • It has a 12-bit DAC
  • Has a trye random number generator
  • Has a dedicated Segmented LCD Controller?

Supported Workflows

We'll investigate the workflow for micropython on the Xiao RP2040, and ESP32-S3 running micropython, then the Teensy 4.x using Arduino.

Xiao RP2040 workflow

(Following the instructions from Seeed Studio, with some modifications)[https://wiki.seeedstudio.com/XIAO-RP2040-with-MicroPython/]

  1. Install Thonny

  2. Launch Thonny

  3. While holding the boot button, plug the USB-C cable into your computer and the dev-board

  4. Navigate to 'Tools' -> 'Options'

  5. Click the 'Interpreter' Tab

  6. Click 'Install or update firmware'

  7. Select the Xiao RP2040 drive that just appeard, RP2, Pico H, and the version of Micropython you want

  8. Click 'Install' and wait

  9. Click done and select the Port (on windows appears as 'Board CDC')

  10. Observe that the REPL refreshes and the device information is published along with chevrons appearing at the bottom

Xiao ESP32-S3 workflow

  1. Install Thonny

  2. Launch Thonny

  3. Plug the USB-C cable into your computer and the dev-board (Boot button not required)

  4. Navigate to 'Tools' -> 'Options'

  5. Click the 'Interpreter' Tab, then from 'Interpreter', Micropython (ESP32)

  6. Click 'Install or update firmware'

  7. Select the COM port that just appeared, ESP32-S3, ESPRESSIF, and the version of Micropython you want

  8. Click 'Install' and wait (its recommended that 'Erase all flash' is ticked

  9. Click done and select the Port (on windows appears as 'Board CDC')

  10. Observe that the REPL refreshes and the device information is published along with chevrons appearing at the bottom

Arduino Workflow

  1. Install Arduino IDE (or optionally you can use it in the brwowser)

  2. Launch IDE

  3. Plug in Arduino board to computer

  4. Navigate to 'Tools' -> 'Boards' and select the correct board from the list

  5. Navigate to 'Port' under tools and slect the correct COM Port that appears.

  6. From here you could upload an example blink file.