Week 6

Embedded Programming

Group Assignment


Browse through datasheets

The group browsed through datasheets for microcontrollers commonly used in Fab Academy projects.

The microcontrollers are:


ATtiny212/412

The ATtiny212/412 microcontrollers, featuring the high-performance, low-power AVR® RISC architecture, are designed to deliver robust performance while maintaining energy efficiency. These microcontrollers are capable of operating at speeds of up to 20MHz and come in an 8-pin package, offering up to 4KB of Flash memory, 256 bytes of SRAM, and 128 bytes of EEPROM. They incorporate the latest technologies to ensure a flexible and power-conscious architecture, which includes an Event System, SleepWalking capabilities, precise analog features, and advanced peripherals. The ATtiny series is engineered to meet the demands of modern low-power applications, providing a range of clock options including a 16/20MHz Low Power Internal RC Oscillator, a 32.768kHz Ultra Low Power Internal RC Oscillator, a 32.768kHz External Crystal Oscillator, and an External Clock Input, ensuring versatile time-keeping and control capabilities.

In terms of peripherals, the series is well-equipped with a 6-channel Event System, various Timer/Counter types optimized for different applications, a Real Time Counter, USART with advanced communication features, SPI, TWI with support for multiple speed modes, Configurable Custom Logic (CCL) with programmable LUTs, an Analog Comparator, a high-speed ADC, a DAC, and multiple internal voltage references. Additionally, the microcontrollers offer a robust set of system features, including Power-on Reset (POR), Brown-out Detection (BOD), a unified program and debug interface (UPDI), and three sleep modes to optimize power usage further. These devices are designed to operate across a wide range of temperatures, offering variants that can function from -40°C up to 125°C, and are available in speed grades that support operating voltages from 1.8V up to 5.5V, ensuring flexibility and reliability for a broad spectrum of applications and environments.


SAMD21

The SAM D21 microcontroller series, built on the Arm® Cortex®-M0+ CPU, delivers high performance with speeds of up to 48 MHz, including a single-cycle hardware multiplier and a Micro Trace Buffer for advanced debugging. This series offers a flexible memory configuration, with in-system self-programmable Flash memory up to 256KB and SRAM memory options extending up to 32KB, designed to accommodate a wide range of application requirements. The inclusion of a Read-While-Write (RWW) Flash section enhances the device's functionality, although it is not available on the 256KB models.

In terms of system capabilities, the SAM D21 is equipped with robust system functionalities including Power-on Reset (POR), Brown-out Detection (BOD), an external interrupt controller supporting up to 16 external interrupts, and a versatile clock system that incorporates both an internal and external clock with options for a 48 MHz Digital Frequency-Locked Loop (DFLL48M) and a 48 MHz to 96 MHz Fractional Digital Phase-Locked Loop (FDPLL96M). The device also features low power consumption modes, including Idle and Stand-by Sleep modes, complemented by SleepWalking peripherals for efficient power management.

Peripheral support is extensive, including a 12-channel Direct Memory Access Controller (DMAC), a similarly capable Event System, various Timer/Counters with advanced functionalities for precise control and timing, up to six configurable Serial Communication Interfaces (SERCOM), and a full-speed USB 2.0 interface. The device also boasts an impressive analog feature set, with a 12-bit ADC supporting up to 20 channels, a 10-bit DAC, and up to four Analog Comparators with a Window Compare function. The Peripheral Touch Controller (PTC) supports up to 256-channel capacitive touch and proximity sensing, making it highly suitable for interactive applications. The SAM D21 operates within a voltage range of 1.62V to 3.63V and is available in a variety of packages, including TQFP, QFN, UFBGA, and WLCSP, providing flexibility for different hardware design requirements. This series is also designed for automotive applications, with certain models meeting the AEC-Q100 Grade 1 standard, ensuring reliability and performance across a wide temperature range.


SAM D21 XIAO

The Seeed Studio XIAO SAMD21, centered around the SAMD21G18 chip, stands out as a compact and high-performance development board, marking the beginning of the XIAO series. It's tailored for those diving into electronics, supporting Arduino, Micropython, and CircuitPython development platforms, making it an ideal choice for both beginners and seasoned electronics enthusiasts. This board features a high clock speed of up to 48MHz, equipped with 32KB of SRAM and 256KB of onboard flash memory, ensuring ample space and speed for various projects.

With its ultra-small footprint of 21 x 17.5mm, the XIAO SAMD21 is particularly suited for wearable devices, maintaining the Seeed Studio XIAO series' classic form factor. It provides a rich set of interfaces including 11 analog and 11 digital pins, along with dedicated I2C, UART, and SPI ports for versatile connectivity options. The design is breadboard-friendly and features an SMD layout without components on the back, facilitating easy integration into production.

The board supports a USB Type-C interface for both power supply and code downloading, enhancing its user-friendly attributes. It boasts 14 pins in total, accommodating multiple digital, analog, and PWM interfaces through pin multiplexing, in addition to a DAC output pin, an SWD pad interface, and serial communication indicators, all contributing to its flexibility in project deployment. Notably, the XIAO SAMD21 includes a 32.768KHz crystal oscillator for improved time accuracy, along with a user LED for an enhanced coding experience. Its strong software compatibility and flexible I/O options make it capable of interfacing with a wide array of external devices, solidifying its position as a versatile tool in the electronics development community.


RP2040

The RP2040 marks Raspberry Pi's inaugural foray into the microcontroller domain, encapsulating their hallmark attributes of affordability, high performance, and user-friendliness. This microcontroller is distinguished by its substantial on-chip memory and a symmetric dual-core setup featuring ARM Cortex-M0+ processors that can run up to 133MHz, offering a potent combination for professional applications that require both power and flexibility. The RP2040 is designed to be a stateless device, facilitating execute-in-place operations from external QSPI memory, which allows users the freedom to select their desired non-volatile storage capacity while taking advantage of cost-effective Flash parts.

One of the RP2040's unique offerings is its Programmable I/O (PIO) subsystem, enhancing its peripheral set and enabling a vast array of applications, from machine learning to audio processing. This, alongside a DMA controller, an interpolator, integer divider peripherals, and support for up to 16MB of off-chip Flash memory, positions the RP2040 as a versatile choice for various microcontroller applications. It also features a dedicated AHB crossbar, two PLLs for USB and core clock generation, and a programmable LDO for core voltage regulation.

For connectivity and interface options, the RP2040 provides 30 GPIO pins with 4 analog inputs, two UARTs, two SPI controllers, two I2C controllers, 16 PWM channels, a USB 1.1 controller with host and device support, and 8 PIO state machines. Furthermore, it includes a 4-channel ADC with an internal temperature sensor, underscoring its suitability for a wide spectrum of projects. With detailed documentation, a polished MicroPython port, and a UF2 bootloader directly in ROM, the RP2040 ensures a low barrier to entry, making it accessible for beginners while still meeting the demands of more experienced and professional users. Manufactured using a modern 40nm process, it achieves a balance between high performance and low power consumption, suitable for battery-powered applications.


RP2040 Xiao

Image borrowed from Adrian Torres showing the pin numbers for Arduino IDE development

The Seeed Studio XIAO RP2040 is a high-performance microcontroller board that integrates the powerful Raspberry Pi RP2040 chip, offering compatibility with the expansive RP2040 ecosystem. This compatibility ensures a smooth experience for developers working with multiple languages, including C, MicroPython, and CircuitPython, making it an excellent platform for those looking to dive into MicroPython programming. The board boasts dual-core processing capabilities with speeds of up to 133 MHz, along with 264KB of SRAM and 2MB of onboard flash memory, ensuring ample computational and storage resources for a wide range of applications.

With its ultra-compact design measuring just 21 x 17.5mm, the XIAO RP2040 adheres to the Seeed Studio XIAO series' classic form-factor, rendering it ideal for wearable devices and projects where space is a premium. It provides a wealth of development interfaces, including two buttons, eleven digital and four analog pins, along with dedicated I2C, UART, SPI, and SWD Bonding pad interfaces. This variety supports a broad spectrum of development platforms such as Arduino, Micropython, and CircuitPython, catering to both beginners and seasoned electronics enthusiasts.

The board is designed with production in mind, featuring a breadboard-friendly layout and an SMD design that leaves the back of the board free of components for ease of integration into final products. It includes a USB Type-C interface for power supply and code downloading, one reset button, one BOOT button, a user-programmable RGB LED, a power LED, two status indicators, and one user LED, facilitating an accessible and straightforward development process. Given its robust performance capabilities, the Seeed Studio XIAO RP2040 is not only suitable for machine learning applications but also for use in wearable devices, highlighting its versatility for both prototyping and mass production. This board, with its powerful RP2040 chip and compact design, embodies the Raspberry Pi ethos of high performance, low cost, and ease of use in the microcontroller space.


ESP32-C3

The ESP32-C3 is a versatile microcontroller unit (MCU) from Espressif Systems, offering robust connectivity options including Wi-Fi and Bluetooth® capabilities, along with a powerful CPU and memory configuration, all designed to cater to a wide array of IoT applications. It supports IEEE 802.11b/g/n standards, offering Wi-Fi connectivity with bandwidths of 20 MHz and 40 MHz in the 2.4 GHz band, and it achieves a data rate up to 150 Mbps. The ESP32-C3 supports multiple Wi-Fi modes, antenna diversity, and has advanced Wi-Fi features like Wi-Fi Multimedia (WMM), TX/RX A-MPDU, and automatic beacon monitoring, among others. For Bluetooth® connectivity, it is equipped with Bluetooth LE, including Bluetooth 5 and mesh, supporting high power mode and multiple advertisement sets.

At its core, the ESP32-C3 is powered by a 32-bit RISC-V single-core processor, capable of operating up to 160 MHz, providing a balance of efficiency and processing power with a CoreMark® score of 407.22 CoreMark at 160 MHz. It includes 384 KB ROM, 400 KB SRAM (with 16 KB for cache), and 8 KB SRAM in RTC, supporting SPI, Dual SPI, Quad SPI, and QPI interfaces for connection to off-package flash with cache acceleration and in-Circuit Programming (ICP).

The device also boasts a comprehensive suite of advanced peripheral interfaces, including up to 22 programmable GPIOs, digital interfaces such as SPI, UART, I2C, I2S, and analog interfaces like 12-bit SAR ADCs. It features a full-speed USB Serial/JTAG controller, a General DMA controller, and a TWAI® controller compatible with ISO 11898-1. For power management, the ESP32-C3 offers fine-resolution control through various power modes, with Deep-sleep mode power consumption being as low as 5 µA.

Security features include secure boot, flash encryption, a 4096-bit OTP area, and cryptographic hardware acceleration for AES, SHA, RSA, RNG, HMAC, and digital signatures. The RF module incorporates antenna switches, an RF balun, power amplifier, and low-noise receive amplifier, ensuring excellent RF performance.

With its low power consumption and comprehensive feature set, the ESP32-C3 is ideal for a broad range of IoT applications such as smart home devices, industrial automation, healthcare, consumer electronics, smart agriculture, service robots, audio devices, and various low-power IoT sensor hubs and data loggers.


ESP32-C3 XIAO

The Seeed Studio XIAO ESP32C3 is a compact and flexible microcontroller board that leverages the new RISC-V architecture, offering both Wi-Fi and Bluetooth Low Energy (BLE) connectivity. This makes it an excellent choice for a wide array of Internet of Things (IoT) applications, providing both the flexibility and the functionality needed for various IoT scenarios. Powered by the ESP32-C3 32-bit RISC-V chip, it can operate at speeds up to 160 MHz and supports programming via Arduino and CircuitPython, catering to a broad spectrum of developers.

In terms of wireless capabilities, the XIAO ESP32C3 boasts outstanding RF performance with complete Wi-Fi functionalities and Bluetooth Low Energy support, capable of communicating over distances exceeding 100m when using a U.FL antenna. This high level of connectivity is ideal for projects requiring remote operation or data collection. Furthermore, the board features an elaborate power design, offering four working modes with power consumption as low as 44 μA in deep sleep mode, alongside lithium battery charge management, highlighting its efficiency and sustainability for long-term deployments.

Maintaining the Seeed Studio XIAO series' thumb-sized form factor, the ESP32C3 measures just 21 x 17.5mm, making it perfectly suited for wearable devices and other applications where space is at a premium. The board's design is both breadboard-friendly and conducive to production, with an SMD design that leaves the back of the board free of components. It includes a highly-integrated ESP32-C3 SoC with 400 KB SRAM & 4 MB Flash, providing ample space for complex programming and IoT control scenarios. With 11 digital I/O and 4 analog I/O pins, along with support for UART, IIC, and SPI serial communication, this board is a powerful and versatile tool for developers looking to explore the potential of IoT in wearable and portable devices.


Summaries created with ChatGPT. Based on the datasheets. See chat transcript here


Compare the performance and development workflows

Microcontroller Architecture Number of Pins Number of Digital Pins Number of Analog Pins Clock Speed Flash Memory RAM Peripherals I/O Capabilities Connectivity Programming Languages
ATtiny412 AVR® 8 6 20MHz 4KB 256B 6-channel Event System, Timer/Counters (TCA, TCB, TCD), Real Time Counter (RTC), USART, SPI, TWI, Configurable Custom Logic (CCL), Analog Comparator (AC), ADC, DAC, Automated CRC Memory Scan, Watchdog Timer (WDT) 6 Programmable I/O Lines, 8-pin SOIC150 USART, SPI, TWI Assembly, C, C++
SAMD21 Arm Cortex-M0+ up to 64 pins (depending on package) up to 52 programmable I/O pins 20 48 MHz 256 KB 32 KB 12-channel DMAC, 12-channel Event System, Multiple Timer/Counters (TC and TCC), 32-bit Real Time Counter (RTC), Watchdog Timer (WDT), CRC-32 generator, USB 2.0 interface, Up to six SERCOM (USART, I2C, SPI, LIN), I2S interface, 12-bit ADC, 10-bit DAC, Up to four Analog Comparators (AC), Peripheral Touch Controller (PTC) up to 52 programmable I/O pins, USB, USART, I2C, SPI, LIN, I2S Assembly, C, C++
RP2040 Dual ARM Cortex-M0+ up to 56 26 4 133 MHz Support for up to 16MB of off-chip Flash memory 264 kB SRAM DMA controller, Interpolator, Integer divider, 2 UARTs, 2 SPI controllers, 2 I2C controllers, 16 PWM channels, USB 1.1 controller and PHY with host and device support, 8 PIO state machines, 4 channel ADC with internal temperature sensor 30 multifunction GPIO pins 2 UARTs, 2 SPI controllers, 2 I2C controllers, USB 1.1 Host/Device MicroPython, CircuitPython, C/C++
ESP32-C3 RISC-V 32 or 48 based on package up to 22 programmable GPIOs 6 160 MHz up to 16 MB of off-chip Flash memory 400 KB SRAM (16 KB for cache), 8 KB SRAM in RTC Wi-Fi and Bluetooth LE capabilities, SPI, Dual SPI, Quad SPI, QPI interfaces, 3 × SPI, 2 × UART, 1 × I2C, 1 × I2S, Remote control peripheral, LED PWM controller, Full-speed USB Serial/JTAG controller, General DMA controller (GDMA), TWAI® controller (compatible with CAN 2.0), 2 × 12-bit SAR ADCs, Temperature sensor, Timers and watchdog timers 22 or 16 programmable GPIOs Wi-Fi IEEE 802.11b/g/n, Bluetooth 5, Bluetooth mesh, USB, SPI, UART, I2C, I2S MicroPython, CircuitPython, C/C++