Motor shield reprogramming

Wemos motor shield reprogramming

1. The motor shield problem

The Wemos motor shield consist of:

  • H-bridge TB6612
  • a microcontroller STM32F030 that contains a firmware.

This firmware is not properly installed on many clones. We advise you to buy directly this shield on the official Wemos shop.

Figure 1 - Motor shield

2. The solution

If you have such a motor shield clone, you must reprogram it. To do this you need:

  • a soldering set
  • an USB-TTL module (3.3V)
  • a motor reprogramming kit.

3. Connections

  1. Solde the two pads I2C and two pads RST how shown in the right side of Figure 1.
  2. Connect PIN RTS and 3V of the motor shield as shown in the Figure 2.
  3. Connect the USB-TTL module to the motor shield:
      • USB-TTL RX - MOTOR SHIELD D1
      • USB-TTL TX - MOTOR SHIELD D2
      • USB-TTL GND - MOTOR SHIELD GND
      • USB-TTL 3.3V - MOTOR SHIELD 3.3V.
  4. Connect USB-TTL to PC with a USB cable.
  5. Discover assigned port COMx (Windows OS). In the example is COM7.

Figure 2 - Connection between USB-TTL and motor shield

4. Programming

  1. Download motor reprogramming kit from https://github.com/infosmick/Motor_shield_firmware and unzip in a folder in C:\
  2. Open the Command console and insert these commands:
  • C:\> cd Motor_shield_firmware-master
 Directory of C:\Motor_shield_firmware-master

07/10/2017  13:08    <DIR>          .
07/10/2017  13:08    <DIR>          ..
07/10/2017  12:47             3,116 motor_shield.bin
07/10/2017  12:49               280 README.txt
07/10/2017  12:49            13,265 stm32flash-manual.pdf
07/10/2017  12:49           252,776 stm32flash.exe
               4 File        269,437 byte

to place yourself in the work directory;

  • > stm32flash.exe -k COM7
stm32flash 0.5

http://stm32flash.sourceforge.net/

Interface serial_w32: 57600 8E1
Version      : 0x31
Option 1     : 0x00
Option 2     : 0x00
Device ID    : 0x0444 (STM32F03xx4/6)
- RAM        : 4KiB  (2048b reserved by bootloader)
- Flash      : 32KiB (size first sector: 4x1024)
- Option RAM : 16b
- System RAM : 3KiB
Read-UnProtecting flash
Done.

to remove the protection flag;

  • > stm32flash.exe -f -v -w motor_shield.bin COM7
stm32flash 0.5

http://stm32flash.sourceforge.net/

Using Parser : Raw BINARY
Interface serial_w32: 57600 8E1
Version      : 0x31
Option 1     : 0x00
Option 2     : 0x00
Device ID    : 0x0444 (STM32F03xx4/6)
- RAM        : 4KiB  (2048b reserved by bootloader)
- Flash      : 32KiB (size first sector: 4x1024)
- Option RAM : 16b
- System RAM : 3KiB
Write to memory
Erasing memory
Wrote and verified address 0x08000c2c (100.00%) Done.

to reprogram the microcontroller.


That's all!