Skip to content

lecture notes

global review previous week

Nancy Wu (At Fablab O, shanghai) works very closely to Bambulabs. For any questions…
Electropermanent actuators: A magnet that you can turn on and off using a magnetic pulse. See thesis here and here for an implementation. So this is a magnetic actuator / solenoid that doesn’t need power to stay engaged.

this weeks lecture

RISC: reduced instruction set -> only small set of instructions that are processed quickly.
Atmel SAMD 11C costs about $1. This will be a microcontroller that we’ll use. It’s a Cortex M0+ processor and has an internal USB controller.
Memory: Registers are very quick, SRAM is faster general memory, DRAM is slower but larger, EEPROM stores information without power, FLASH does that too but harder to program but can do more.
Word size: how much information can the microcontroller operate with at a single time. Bigger isn’t always better. 8-bit microcontrollers can process 64 bit information but just takes longer. But the microcontroller is a lot cheaper.

There are a lot of microcontroller families.
The ones that are interesting for fabacademy:

  • AVR -> meant to deal with modern languages. Currently especially ATtiny. ATtiny10 and ATtiny412 are 8-pin powerful controller. Cost only 50 cents. The ATtiny1624 is a bit bigger and a bit more power. AVR128DB32 has a lot of pins that can do a lot with analog signals.
  • ARM -> Made by several manufacturers, ARM charges license fees.
    • ARM -> SAMD (ATSAMD)-> the SAMD family made by Microchip is 32 bit with build-in USB. Fast clock-speed. They are harder to use than AVR. You need to use libraries to get things going.
    • ARM -> STM -> popular ARM family. STM32 and SAMD are very similar to each other. Onik Babajanyan did some work on the STM32.
    • ARM -> RP2040 -> good documentation -> very fast and has PIO (programmable peripherals). These are actually tiny processors that you can program to customize the microcontroller.
  • Xtensa -> ESP8266 and ESP32.
  • RISC-V (RISC 5) -> open standard that changes the landscape. Because no license fees are required.

ATmega328P (original Arduino processor) is very obsolete and shouldn’t be used.

octopart is a search engine for parts. Shows which vendor has how many on stock.

DIP -> through hole, almost obsolete Surface mount packages: SOT, SOIC, TSSOP, TQFP, LQFP
Ball grid arrays (difficult to solder): MLF, WLCSP, BGA

Assembly language is (almost) never used anymore. You will still find it as in-line in C-code for very specific critical functionality.
C++ extends C with objects.
Recitation on programming
GCC is a open source compiler for C code. You can use it directly but mostly using a library, e.g. Arduino, AVR, ARM, etc.
In C it’s easy to make a security mistake (buffer overrun). By doing this you can get to data that your not supposed to access. RUST and GO are recent languages that prevent this. This is developed for critical systems but also ported to embedded systems. Good stuff to learn for the future!
Micropython and Circuitpython (from ADAfruit) are powerful ways to run python on an embedded system. You need a fast processor because python is interpreted language. Documentation on Python is very good.

ARM processors use SWD (serial wire debug) to program the processor (4 pins). SWD is a modification/implementation of JTAG specifically for ARM.
AVR processors use UPDI (unified program and debug interface) to program the processor (1 pin). On Quentorres the UART (serial port) can be used to program using UPDI.

Toolchain is all of the steps required to get your program into a microcontroller (copiler, linker, run-time libraries, etc).

Arduino is a single word for 6 different things: board + toolchain + libraries + IDE + bootloader + header. Because of the overhead generated it’s much slower than bare-metal programmed code. But easy to program.

In arduino to use the 2 processors on RP2040 you use loop() and loop1(). In micropython you use multitasking for this.