Microcontroller Firmware from Scratch
Nikolai Kondrashov
spbnick
Obligatory Workbench Photo
Our development kit
TTL serial cable
~1.2โฌ on eBay*
STM32F103C8T6 devboard
~2โฌ on eBay*
* with delivery, no affiliation
What can you do with it?
โ or rather what have I managed?
๐ย frankencar
๐ย stm32-eeprom-dump
๐ย christmas-card
๐ย thermal-spectrumย (outdated, in progress)
You'll still need one library
Board docs at stm32duino.com and manufacturer's website
๐ ARM-TRM
๐ STM-PM
๐ STM-RM
๐ STM-DS
๐ ARM-ARM
๐ BD
Blue Pill documentation stack
Don't Fear The Docs!
They're your friends!
STM32F103C8T6 MCU
Micro USB socket
Boot configuration jumpers
Reset button
8MHz crystal
32.768KHz crystal
Power LED
User LED
SWD header
The "Blue Pill"
๐ STM-DS
How to get your program in there?
๐ STM-RM
๐ STM-DS
๐ BD
๐ STM-DB
VCC
RX
TX
GND
RX
TX
GND
VCC
Embedded engineers have a secret
Embedded is easy and fun
* unless you're paid to do it
ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย *
Blink the LED!
LED light, D2 programmable
โย Google Translate
๐ BD
๐ STM-DS
๐ STM-DS
๐ย blink.c
The Vector Table
๐ ARM-ARM
๐ ARM-ARM
๐ STM-PM
๐ย blink.c
๐ ARM-ARM
๐ STM-PM
๐ STM-DS
๐ STM-DS
๐ย blink.c
Peripherals and Clocks
๐ STM-DS
๐ STM-RM
๐ STM-RM
๐ STM-RM
๐ STM-RM
๐ STM-RM
๐ STM-RM
๐ STM-RM
๐ STM-DS
๐ย blink.c
GPIO
๐ STM-RM
๐ STM-RM
๐ STM-RM
๐ STM-RM
๐ STM-RM
๐ STM-DS
๐ย blink.c
๐ STM-RM
๐ย blink.c
Build
0x20000400
0x08000008 | 0x1
Flash
Run!
๐ BD
Defaults will get you far!
Make a Library
๐ย libstammer/gpio.h
๐ย libstammer/rcc.h
Accelerate!
๐ STM-RM
๐ STM-RM
๐ STM-RM
๐ย libstammer/init.c
More peripherals!
USART
๐ STM-RM
๐ STM-RM
๐ untested extract ofย stm32-poke/usart_hello.c
Timers/PWM
๐ STM-RM
๐ untested extract ofย stm32-poke/pwm_blink.c
ADC
๐ STM-RM
๐ untested extract ofย stm32-poke/adc_stream.c
SPI
๐ STM-RM
๐ untested extract ofย stm32-poke/spi_leds.c
Go and experiment!
See Also
Give me some feedback, ask questions!
Thank You!
PDF and HTML icons made by Dimitry Miroliubov from www.flaticon.com
Credits
Some Blue Pill board photos by user Marekic from wiki.stm32duino.com
Talk and slides by
Nikolai Kondrashov (spbnick)
Chip icon made by Eucalyp from www.flaticon.comย licensed under CC 3.0 BY
A fragment from "Parachuting Cats" advertisement by Folksam
Microcontroller Firmware from Scratch
By Nikolai Kondrashov
Microcontroller Firmware from Scratch
- 5,020