Serial Programming

Published on 2016-11-21 in Motor Shield Reprogramming.

Last evening I made the first try at programming this thing. From the datasheet and the schematic it looks straightforward: the BOOT0 pin is connected to the RTC pin of the serial, the NRST pin is connected to DTR, it should just work. So I connected the USB2TTL (also a WeMos one), and gave it a go:

../../../_images/2838711479722908047.jpg
$ stm32flash /dev/ttyUSB0
stm32flash 0.5

http://stm32flash.sourceforge.net/

Interface serial_posix: 57600 8E1
Failed to init device.

No joy. To the datasheet then! Hmm, they mention a BOOT1 there too, but it’s nowhere to be seen as a pin… Let’s google for it… http://stackoverflow.com/questions/22351703/stm32f030-and-boot0-pin Ah-ha! It looks like BOOT1 is a flag in something called “user flash option byte”, and it has to be set to 0 for the bootloader to start. Shame I have no way to check it.

If that flag is set to 1 in this firmware, then the only way to reprogram this board is to use an stlink programmer. Fortunately, I do have one! Unfortunately, the SWD and SWC pins are not broken out, so I guess I will need to do some precision soldering directly to the chip’s legs. Oh well.