Skip to main content

Group Assisnment Week 6 - Embedded Programming

This week’s assignment included the following tasks:

  • Browse through the data sheet for your microcontroller, compare the performance and development workflows for other architectures.

RP2040 Microcontroller Summary

Reading the RP2040 Microcontroller datasheet from here.

Here are some specification of it:

  • Dual-core Arm Cortex-M0+ processor, up to 133 MHz
  • 264KB of on-chip SRAM
  • Support for up to 16MB of off-chip Flash memory via dedicated QSPI bus
  • DMA controller
  • Interpolator and integer divider peripherals
  • 30 GPIO pins, 4 of which can be used as analog inputs
  • 2 UARTs, 2 SPI controllers, and 2 I2C controllers
  • 16 PWM channels
  • USB 1.1 controller and PHY, with host and device support
  • 8 Programmable I/O (PIO) state machines for custom peripheral support
  • Power modes: Active, Dormant, and Off

The RP2040 microcontroller offers several key features and capabilities:

These information we got is actually from the manufacturer of RP2040, Raspberry Pi. In this page, I have known the structure of RP2040 and the board regarding them:

  1. External memory execution: Code can be run directly from external memory via dedicated SPI, DSPI, or QSPI interfaces, with a small cache to enhance performance.
  2. Debug support: The microcontroller supports debugging through the SWD interface.
  3. Internal SRAM organization: The on-chip SRAM is organized in banks that can store code or data. These banks are accessed through dedicated AHB bus fabric connections, enabling bus masters to access separate bus slaves without stalling.
  4. DMA bus masters: The microcontroller includes DMA bus masters to handle repetitive data transfer tasks, offloading these tasks from the processors.
  5. GPIO functionality: GPIO pins can be driven directly or by various dedicated logic functions.
  6. Dedicated hardware peripherals: The microcontroller features dedicated hardware for common functions such as SPI, I2C, and UART.
  7. Programmable I/O (PIO) controllers: Flexible and configurable PIO controllers are available to support a wide range of I/O functions.
  8. USB connectivity: An integrated USB controller with an embedded PHY provides Full-Speed/Low-Speed Host or Device connectivity, managed by software.
  9. Analog-to-Digital Converter (ADC): The microcontroller includes four ADC inputs that are shared with GPIO pins.
  10. Clock management: Two Phase-Locked Loops (PLLs) generate a fixed 48MHz clock for USB or ADC and a flexible system clock up to 133MHz.
  11. Internal Voltage Regulator: An on-chip voltage regulator supplies the core voltage, simplifying the end product's power supply requirements by only needing to provide the I/O voltage.

Some common and important things for development should be:

  • The Pin Locations, Descriptions and GPIO Functions, the MCU board might not apply them all but can take it as a reference:

The ARM Cortex-M0+ processor features and benefits are:

  • Tight integration of system peripherals reduces area and development costs.
  • Thumb instruction set combines high code density with 32-bit performance.
  • Support for single-cycle I/O access.
  • Power control optimization of system components.
  • Integrated sleep modes for low-power consumption.
  • Fast code execution enables running the processor with a slower clock or increasing sleep mode time.
  • Optimized code fetching for reduced flash and ROM power consumption.
  • Hardware multiplier.
  • Deterministic, high-performance interrupt handling for time-critical applications.
  • Deterministic instruction cycle timing.
  • Support for system level debug authentication.
  • Serial Wire Debug reduces the number of pins required for debugging.

RISC-V Microcontroller Summary

Reading the ESP32 Microcontroller datasheet from here.

These information I got is actually from the manufacturer of RP2040, ESPRESSIF. In this page, I have known the structure of ESP32C3 and the module and the Devkits regarding them:

  • Single-core 32-bit RISC-V processor, up to 160 MHz
  • 400KB of on-chip SRAM
  • 384KB of ROM
  • 802.11b/g/n Wi-Fi
  • Bluetooth 5 (Bluetooth LE)
  • 22 programmable GPIOs
  • 12-bit ADC, 8-bit DAC
  • UART, SPI, I2C, I2S, and GDMA interfaces
  • PWM and LED PWM controllers
  • Hardware cryptography acceleration
  • Power modes: Active, Modem-sleep, Light-sleep, Deep-sleep, and Hibernation

Some common and important things for development should be:

  • The Pin Locations, Descriptions and GPIO Functions, the MCU board might not apply them all but can take it as a reference:

The ESP32-C3, with its RISC-V architecture and wireless capabilities, offers a different set of features compared to the RP2040. It has a single-core processor but a higher clock speed, and includes wireless connectivity which the RP2040 lacks. The development workflow for ESP32-C3 typically involves using the ESP-IDF (IoT Development Framework) with C/C++, or the Arduino framework.

ATSAMD21G18 Summary

Reading the ATSAMD21G18 information from here.

  • Processor: 32-bit ARM Cortex-M0+ (Single-core, up to 48 MHz)
  • Memory: 32 KB SRAM, 256 KB Flash
  • Connectivity: USB OTG
  • GPIO: 38 pins
  • ADC: 12 x 12-bit
  • DAC: 1 x 10-bit
  • Communication Interfaces: 6 SERCOM (configurable as UART, I2C, SPI)
  • PWM Channels: 20
  • Power: 3.3VDC
  • Programming: Compatible with Arduino IDE
  • Package Options: 48-pin TQFP, QFN, WLCSP
  • Price: Approx. USD 3.15

Overall, the ATSAMD21G18 is a versatile and cost-effective microcontroller suited for a wide range of applications, particularly where low power consumption and multiple communication interfaces are required.

STM32F103C8T6 Summary

STM32F103C8T6 Microcontroller Overview

  • Processor: 32-bit ARM Cortex-M3 (Single-core, 72 MHz)
  • Memory: 20 KB SRAM, 64 KB Flash
  • Connectivity: USB 2.0 Full Speed
  • GPIO: 37 pins
  • ADC: 10 x 12-bit
  • Communication Interfaces: 3 UART, 2 I2C, 3 SPI
  • PWM Channels: 15
  • Power: 3.3VDC
  • Programming: C-like languages, Arduino IDE compatible
  • Package Option: LQFP-48
  • Price: Approx. USD 3.50

The STM32F103C8T6 stands out with its robust feature set tailored for performance-driven applications. It incorporates a high-speed 32-bit ARM Cortex-M3 processor capable of running up to 72 MHz, making it suitable for complex algorithms and real-time processing tasks. With 20 KB of SRAM and 64 KB of Flash memory, it offers a balanced combination of memory resources for small to medium-sized projects.

Performance and Usage Comparison of RP2040, STM32, SAMD21 and ESP32S3

FeatureRaspberry Pi RP2040STM32F103C8T6ATSAMD21G18ESP32-S3
Dev BoardRaspberry Pi PicoBlue PillMKRZero, Seeed XIAOESP-S3, Seeed XIAO
CoresDual-CoreSingle CoreSingle CoreDual-Core
Core Architecture32-bit ARM Cortex-M0+32-bit ARM Cortex-M332-bit ARM Cortex-M0+Xtensa® 32-bit LX7
Clock Speedup to 133 MHz72 MHz48 MHzUp to 240 MHz
RAM Size264 KByte SRAM20 KByte32 KByte512 KByte SRAM
Flash SizeUp to 16 MByte external64 KByte256 KByteUp to 1 GByte external
Direct Memory Access12 x DMA7 x DMA12 x DMA3 x DMA
WirelessNoneNoneNoneIEEE 802.11b/g/n
Programming LanguageMicroPython, CircuitPython, C/C++, ArduinoC alike, Arduino IDEC alike, Arduino IDEEspressif IDF, Arduino IDE, CircuitPython
MCU Power Voltage3.3VDC3.3VDC3.3VDC3.3VDC
USB InterfaceUSB 1.1 Device and HostUSB 2.0 Full SpeedUSB OTGUSB OTG
Program LoadingUSB Mass Storage, UF2External device, SerialUSB, UF2USB, UF2
GPIO30 x Digital I/O37 x GPIO38 x GPIO45 x GPIO
High-Speed PIO2 blocks, 8 State MachinesNoNoNo
ADC4 x 12-bit10 x 12-bit12 x 12-bit2 × 12-bit SAR ADCs, up to 20 channels
DACNoNo1 x 10-bit2 x 8-bit
UART236 x Sercom (UART, I2C, SPI)3
I2C226 x Sercom (UART, I2C, SPI)2
SPI236 x Sercom (UART, I2C, SPI)4
PWM1615202 × MCPWM
On Chip SensorTemperatureNoNoTemperature
IC PackageQFN-56LQFP-4848-pin TQFP, QFN, WLCSPVFQFN-56
Retail PriceUSD 1.00USD 3.50USD 3.15USD 1.20

For XIAO RP2040 should add this url:

https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json

For XIAO ESP32C3 should add this url:

https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

And the PIN is different as well.

There is additional way to develop these two boards, which is using MicroPython, apply "Thonny" tool.

There is specifc tool for developing XIAO ESP32C3 which is designed by the company ESPRESSIF: ESP-IDF