This is an old revision of the document!
Table of Contents
vcc-gnd STM32F103C8T6
These are cheap development boards with 64KB flash and 20KB ram.
The firmware that ships on these devices blinks the LED on PC13 and sends a time string on the UART at 9600 baud.
These boards can be programmed using SWD or with the STM serial boot loader in ROM. Both types of programmer are inexpensive but the latter more versatile if somewhat slower in operation.
Pinout
B12 MICRO USB GND B13 GND B14 3V3 B15 RESET GND GND RESET A8 BUTTON *BOOT1 *BOOT0 B11 TX A9 3V3 3V3 B10 RX A10 B1 A11 B0 A12 A7 A15 A6 B3 STM32F103C8T6 A5 B4 A4 B5 A3 B6 A2 B7 8M A1 B8 32768 A0 B9 C15 5V PC13 POWER C14 GND LED LED C13 3V3 SWD VBAT 3V3 DIO DCLK GND PA13 PA14 *100K IN SERIES
Power
Power is supplied on the USB socket which feeds a 3V3 LDO regulator.
It is possible to power the device with 3V3 on the 3V3 pin or 5V on the 5V pin (to feed the LDO) if USB is disconnected.
LED demo
This demo depends on OpenCM3 and this must be installed first.
STLink
Install the STLink programmer to program using a SWD interface found, for example, on the STM32 F4 discovery (see top picture).
Fetch blinky, install and run.
hg clone http://hg.kewl.org/pub/miniblink-vcc-gnd cd miniblink-vcc-gnd make make st-flash FLASH miniblink.bin INFO src/stlink-common.c: Loading device parameters.... INFO src/stlink-common.c: Device connected is: F1 Medium-density device, id 0x20036410 INFO src/stlink-common.c: SRAM size: 0x5000 bytes (20 KiB), Flash: 0x10000 bytes (64 KiB) in pages of 1024 bytes INFO src/stlink-common.c: Attempting to write 664 (0x298) bytes to stm32 address: 134217728 (0x8000000) Flash page at addr: 0x08000000 erased INFO src/stlink-common.c: Finished erasing 1 pages of 1024 (0x400) bytes INFO src/stlink-common.c: Starting Flash write for VL/F0/F3 core id INFO src/stlink-common.c: Successfully loaded flash loader in sram 0/0 pages written INFO src/stlink-common.c: Starting verification of write complete INFO src/stlink-common.c: Flash written and verified! jolly good!
STM32Flash
It is also possible to use STM32Flash, however, this cannot function with USB connected since if the chip detects BOOT0 raised along with a USB cable on reset, it enters DFU mode.
To use STM32Flash, disconnect USB and power with 3V3 on the 3V3 pin using a 3V3 USB serial adapter. You must cross over serial Rx and Tx and place the jumpers with BOOT1 at 0 and BOOT0 at 1 (see bottom picture).
Probe the chip with STM32Flash. This may take a few attempts to synchronise.
stm32flash /dev/ttyUSB0 stm32flash 0.4 http://stm32flash.googlecode.com/ Interface serial_posix: 57600 8E1 Version : 0x22 Option 1 : 0x00 Option 2 : 0x00 Device ID : 0x0410 (Medium-density) - RAM : 20KiB (512b reserved by bootloader) - Flash : 128KiB (sector size: 4x1024) - Option RAM : 16b - System RAM : 2KiB
The flash size reported by STM32Flash would appear to be hard-coded and in this case wrong, ignore that.
Now fetch blinky, install and run.
hg clone http://hg.kewl.org/pub/miniblink-vcc-gnd cd miniblink-vcc-gnd make make stm32flash FLASH miniblink.bin stm32flash -w miniblink.bin -b 57600 -v -g 0 /dev/ttyUSB0 stm32flash 0.4 http://stm32flash.googlecode.com/ Using Parser : Raw BINARY Interface serial_posix: 57600 8E1 Version : 0x22 Option 1 : 0x00 Option 2 : 0x00 Device ID : 0x0410 (Medium-density) - RAM : 20KiB (512b reserved by bootloader) - Flash : 128KiB (sector size: 4x1024) - Option RAM : 16b - System RAM : 2KiB Write to memory Erasing memory Wrote and verified address 0x080004b0 (100.00%) Done. Starting execution at address 0x08000000... done.
To reprogram the device, press reset on the board. Remember not to connect USB simultaneously.