A $3 “STM32F103C8T6 ARM STM32 Minimum System Development Board Module” was purchased.
Programming with ST-Link/2 failed.
The jumpers configure the bootloader. If the left one is “1” and the right one “0” (as on the board – the photo above is upside down), firmware can be uploaded using serial port on pins A9 and A10. See this page for more info.
The Arduino STM32 project with its bootloaders was obtained and generic_boot20_pc13.bin was flashed. The device can be then flashed using dfu-util.
Arduino 1.6.7 was obtained and the instructions in project wiki were followed. “Maple Mini” board was set. However, the IDE cannot compile the project because of messed up includes. The following hack fixes it.
for f in /tmp/arduino-1.6.7-linux64/arduino-1.6.7/hardware/Arduino_STM32/STM32F1/variants/*; do ln -s /tmp/arduino-1.6.7-linux64/arduino-1.6.7/hardware/Arduino_STM32/STM32F1/system/libmaple/include/libmaple/ $f ;done for f in /tmp/arduino-1.6.7-linux64/arduino-1.6.7/hardware/Arduino_STM32/STM32F1/variants/*; do ln -s /tmp/arduino-1.6.7-linux64/arduino-1.6.7/hardware/Arduino_STM32/STM32F1/system/libmaple/stm32f1/ $f; done
The firmware can be uploaded with
dfu-util -d 1EAF:0003 -a 1 -D /tmp/buildblahblah.tmp/sketch_feb28b.ino.bin -R
Upon connecting, the device runs the bootloader, and the cdc_acm serial is presented only later. Unfortunately, Linux kernel does not notice the change unless some event on the bus happens (e.g. connecting an USB mouse to the same hub triggers bus rescan). This can be triggered by writing 0 to /sys/devices/blah/blah/authorized, or using this tool from stackexchange.
The ACM port has throughput of about 60 KB/s.
BUG: clock frequency/whatever is messed up (the delay() function is a bit off)