2024-02-26
Nicolas De Coster & Henk Buursen
Consider:
AtTiny microcontrollers are low-cost and low-power devices suitable for simple embedded applications with limited processing and I/O requirements.
Programming : UPDI (older : ISP)
AtTiny (412 / 1614 / 3216 / ...)
SAMD microcontrollers offer a balance of performance and power efficiency, making them suitable for a wide range of applications including IoT devices and wearables.
Programming : SWD / JTAG
SAMD (11C, 11D, 21E, D51)
The RP2040, developed by Raspberry Pi, is a dual-core ARM Cortex-M0+ microcontroller with versatile I/O capabilities (PIO!), making it ideal for projects requiring multitasking and connectivity.
Programming : UF2
RP2040
ESP32-C3 and ESP32-S3 are developed by Espressif Systems, known for their built-in Wi-Fi and Bluetooth capabilities.
→ IoT projects requiring wireless connectivity
Always refer to the microcontroller's datasheet and reference manual for detailed specifications and usage instructions. These documents provide essential information for programming and configuring the microcontroller.
Bootcamp instructors 2024 : different languages tests
Assembly language provides direct control over the microcontroller's hardware, making it efficient but complex to write. Programmable I/O (PIO) offers a way to offload I/O operations from the CPU, enhancing performance in certain scenarios.
Learn binary/logic basics! (worth it!)
C and C++ are widely used for microcontroller programming due to their efficiency and low-level access to hardware. They are compiled languages, meaning the code is translated into machine language before execution.
Note : Arduino is C++ based
Rust is gaining popularity for microcontroller development due to its strong safety guarantees and modern features. Like C and C++, Rust code is compiled before execution.
MicroPython offers a higher level of abstraction compared to C and assembly, making it easier to write and understand code. It can be either interpreted directly or precompiled into bytecode for execution.
JavaScript can be used for microcontroller programming (Kaluma / Esrpuino). It offers a familiar syntax for web developers but typically requires more resources compared to lower-level languages like C.
TinyGo brings the Go language to microcontrollers.
Mixing languages might give you the best of each world. E.g. : ASM → C → C++
These are various methods for directly programming microcontrollers. They involve using specialized hardware interfaces to transfer compiled code into the microcontroller's memory.
Bootloader : small program stored memory that initialize the µC and load/rewrite code from a secondary storage device such as serial port (USB/UART), flash memory or EEPROM.
Hardcoded bootloaders like UF2 provide a convenient way to load firmware onto a microcontroller without requiring a separate programming tool. They are often used in development boards and single-board computers. (e.g. : XIAO2040)
Basic board for using Alex Tardov's Free DAP
Understanding the distinction between Arduino as a hardware platform, the Arduino libraries, and the Arduino IDE is essential for effective microcontroller programming with Arduino-compatible boards.
The Arduino Uno refers to a specific hardware board featuring an Atmel ATmega328P microcontroller. It is (was?) one of the most commonly used Arduino boards for prototyping and educational purposes.
Arduino provides a rich set of libraries that simplify common tasks such as reading analog inputs, controlling digital outputs, and communicating with peripherals like sensors and displays.
The Arduino Integrated Development Environment (IDE) is a software tool used for writing, compiling, and uploading code to Arduino boards. It includes features like syntax highlighting, serial monitor, and library management.
Be aware :
Every programming language contains special section of "commented" code.
Selecting a microcontroller with appropriate processing power for your application can help conserve energy and reduce cost. Underclocking, or running the microcontroller at a lower frequency, may be beneficial for power-sensitive projects.
Underclocking may be as usefull as overclocking!
Breaking down your code into modular components enhances readability and maintainability. Organize your code into separate functions or modules based on their functionality to facilitate debugging and future updates.
Flat files are difficult to modify / maintain.
This improves code clarity and allows for easier modifications in the future.
Class:
Some tips :
Unified Program and Debug Interface
#define DEBUG_MODE 1
...
#if DEBUG_MODE
Serial.print("DEBUG -- MyVal value = ");
Serial.println(MyVal, DEC);
#endif