Awesome
This is a collection of things I have done pertaining to the STM32F103 microcontroller. I program using the C language and Makefiles, so this is a collection of "on the bare metal" style stuff. By and large it is the record of my education on these devices.
My most recent work has moved to these projects:
https://github.com/trebisky/stm32f411
https://github.com/trebisky/libmaple-unwired
It all began when I ordered a couple of "STM32F103C8T6 ARM STM32 Minimum System Development Board" from AliExpress for $2.00. The are now selling for less than that, and with free shipping. These are also known as the "blue pill" and are discussed in the STM32duino forums.
See also the link above to the STM32F411 based "black pill" that I am now starting to work with in a similar fashion.
For lots of notes and information, see my website:
Along the way I ran into David Welch who gave me some valuable pointers and hearty encouragment. He is doing the same sorts of things with the same gadgets:
https://github.com/dwelch67/stm32_samples/tree/master/STM32F103C8T6
Note that many of the early examples have a naive linker script (lds file) which does not initialize BSS or global variables at all. Later examples require this. The presence of startup.c should be an indicator of more sophisticated and proper treatement.
Some of these projects target a Maple board (or Olimexduino).
I used to link these projects and loaded them to a different address. (0x08005000 rather than 0x08000000). I don't do this any more. I build them at 0x80000000 just like all the other projects.
I now use the STLINK for the Maple, as well as the pill.
I used to use the USB loader along with dfu-util for these. The USB loader resided at 0x80000000, so my code had to go up higher (0x80005000 worked). I burned my bridges and just overwrote the USB loader (but I did save a copy of that loader, just in case).
Many of these projects require/expect a serial port.
This requires a USB to serial gadget connected to PB9 and PB10 Connect PA9 to RX Connect PA10 to TX also connect ground.
Here is a list of projects from 2017 ---
-
loader - host side program to talk to serial bootloader.
-
serial_boot - disassembly of the boot loader
-
blink1 - very basic LED blinking
-
blink1b - minor code cleanup on the above
-
blink_ext - blink external LED on A0
-
blink2 - more code reorganization and file grouping
-
blink_maple - blink LED on PA5 rather than PC13 --M
-
interrupt - do timer interrupts
-
lcd - drive a 16x2 LCD module using i2c
-
memory - figure out how to handle bss and initialized data --B
-
i2c_maple - use libmaple for i2c DAC --B
-
adc_serial - work with F103 adc --P
-
serial1 - first working serial (uart) driver
-
lithium1 - lithium ion battery tester --P
Note that blink_maple is the only demo built to run on the Maple board.
The letters are: M = links for Maple, B = zeros BSS, P = includes printf
The above work was done in 2017, I am beginning new work in 2023, focusing on learning about low level USB
- usb1 - get barely started working with USB (2017) --P
- usb_papoon - the papoon_usb framework and a working echo! -BP
- usb_papoon2 - the papoon_usb framework using interrupts -BP
- usb_baboon - papoon2 running on the Maple board -BPM
The above are just stepping stones to the following, which is wht you really want.
- usb - the final USB serial project -BPM