Serial Programming

A project log for Motor Shield Reprogramming

Create and flash new firmware for the WeMos D1 Mini Motor Shield.

deʃhipudeʃhipu 11/21/2016 at 10:121 Comment

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:

$ stm32flash /dev/ttyUSB0
stm32flash 0.5

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... 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.


Seventh Dwarf wrote 01/08/2017 at 17:00 point

Hello Radomir,

it took some time until I got the USB2TTL converter. I can confirm that there is a problem under Linux with this chip ( the CH340/CH341 used on the USB2TTL converter ). I heard that this is related to the version of the driver and the capability to support parity. There is a patch available, but it is beyond my knowledge to update a linux driver.

I tried the same under Windows and could access the microcontroller. Unfortunately I could not read the flash content correctly ( all 0xFF ). I haven't tried to program the device yet, but this is the next logical step.

7th Dwarf

  Are you sure? yes | no