TPEHAK
Regular
It looks like we need instructions about how to flash the STM32 chip of the motor controller with the bin firmware file.
When you have a blank controller STM32 chip with blank Bluetooth module NRF chip and want Bluetooth working then flash the Bluetooth module NRF chip first before flashing the controller STM32 chip like explained here
endless-sphere.com
Here is the tools list you need (the same tools you need to flash the NRF chip of the Bluetooth module):
1) Obtain an ST-Link V2 dongle (ST-Link V2 dongles can be purchased here for example https://www.amazon.com/dp/B0B2D6HZR6?th=1)
2) Obtain a Tag-Connect cable TC2030-MCP-NL (This cable and all further items below are to connect the ST-Link V2 dongle to the controller. This cable and all items below are optional, you can solder wires to the pads and connect them to ST-Link dongle, however you want to make it happens. The cable can be purchased here https://www.digikey.com/en/products/detail/tag-connect-llc/TC2030-MCP-NL/2666489)
3) If you want to use the Tag-Connect cable I mentioned above then you also might want to obtain a TC2030-CLIP (This clip fastens the Tag-Connect cable to the controller board. This part is obsolete and hard to find. But you can use TC2050-CLIP and re-solder one receptacle to match the TC2030-MCP-NL cable interface. This clip can be purchased here https://www.digikey.com/en/products/detail/tag-connect-llc/TC2050-CLIP-3PACK/12318009 )



This clip can hold the Tag-Connect cable connected

4) Obtain an RJ11 to pins adapter ST-RJ11-R-BB if you want to use the Tag-Connect cable I mentioned above (This adapter is to connect Tag-Connect cable plug and have convenient access to the pins. The adapter can be purchased here https://www.digikey.com/en/products/detail/schmalztech-llc/ST-RJ11-R-BB/23307380 )
5) You also might need to obtain some jumper wires for wiring between the ST-Link V2 and the ST-RJ11-R-BB adapter (To connect the ST-Link dongle to ST-RJ11-R-BB. Bulk of such wires can be purchased here https://www.digikey.com/en/products/detail/digikey/DKS-20FF-20/17038802 )
Now you can flash the bin firmware file:
1) Make sure ST-Link V2 drivers are installed if you have not installed it yet. ST Link V2 drivers can be downloaded here https://www.st.com/en/development-tools/stsw-link009.html
2) Download and install ST-Link Utility application for PC. It will offer to install drivers during installation, install those too. Here is the official download of ST-Link Utility application https://www.st.com/en/development-tools/stsw-link004.html
3) Connect the ST-Link V2 dongle to the BRAIN board P7(STM32) interface using the Tag-Connect cable and other parts I mentioned above and wire it following the pinout from the BRAIN board KiCAD files. (3.3V to 3.3V, GND to GND, SWDIO to SWDIO, SWCLK to SWCLK, NRST to RST). You can use a multimeter in ringing mode to check the pins on the Tag-Connect cable and where they go.

4) Stick the ST-Link V2 dongle to USB in your computer

5) Launch the ST-Link Utility you downloaded and installed earlier
6) In the launched ST-Link Utility application click "Target-->Connect"

7) Then click File --> Open File and select the firmware bin file that you need.


8) Then click Target --> Erase Chip

9) After erasing process is complete click Target --> Program & Verify

10) Click the "Start" button and wait until it has complete flashing the firmware bin file and verification is done


After some time after flashing is complete you should see the green LED turns on

11) Click Target --> Disconnect

12) Eject the ST-Link V2 dongle from PC and disconnect the controller

13) Now you should be able to connect the controller to the VESC Tool application ( you can use a USB-C cable (can connect without powering the controller up with battery), or Bluetooth (needs to power the controller up with battery or USB), or VESC Express dongle (needs to power the controller up with battery)).
14) After connecting the controller to the VESC Tool application apply the appropriate motor configuration xml file (at the moment the current motor configuration file is "M620 CAN #4 (2026-03-26) motor config.xml" )
File --> Load Motor Configuration XML

Select the motor configuration xml file you need

Click the Write Motor configuration button in the right side menu of the VESC Tool application

After this you can calibrate the rotary encoder (you do not need to change the amount of poles, it is already set correct) and setup your battery voltage limits, battery cells amount and setup your motor current and wattage through the VESC Tool application.
When you have a blank controller STM32 chip with blank Bluetooth module NRF chip and want Bluetooth working then flash the Bluetooth module NRF chip first before flashing the controller STM32 chip like explained here
VESC based INNOTRACE motor controller for Bafang M620 CANbus
Prepared the washers for the AMPLIFIER PCB terminals Lightly sanded the flat face of the copper washers to make sure there are no burrs Coated the bottom face with a thin layer of solder to ease the soldering process
endless-sphere.com
Here is the tools list you need (the same tools you need to flash the NRF chip of the Bluetooth module):
1) Obtain an ST-Link V2 dongle (ST-Link V2 dongles can be purchased here for example https://www.amazon.com/dp/B0B2D6HZR6?th=1)
2) Obtain a Tag-Connect cable TC2030-MCP-NL (This cable and all further items below are to connect the ST-Link V2 dongle to the controller. This cable and all items below are optional, you can solder wires to the pads and connect them to ST-Link dongle, however you want to make it happens. The cable can be purchased here https://www.digikey.com/en/products/detail/tag-connect-llc/TC2030-MCP-NL/2666489)
3) If you want to use the Tag-Connect cable I mentioned above then you also might want to obtain a TC2030-CLIP (This clip fastens the Tag-Connect cable to the controller board. This part is obsolete and hard to find. But you can use TC2050-CLIP and re-solder one receptacle to match the TC2030-MCP-NL cable interface. This clip can be purchased here https://www.digikey.com/en/products/detail/tag-connect-llc/TC2050-CLIP-3PACK/12318009 )



This clip can hold the Tag-Connect cable connected

4) Obtain an RJ11 to pins adapter ST-RJ11-R-BB if you want to use the Tag-Connect cable I mentioned above (This adapter is to connect Tag-Connect cable plug and have convenient access to the pins. The adapter can be purchased here https://www.digikey.com/en/products/detail/schmalztech-llc/ST-RJ11-R-BB/23307380 )
5) You also might need to obtain some jumper wires for wiring between the ST-Link V2 and the ST-RJ11-R-BB adapter (To connect the ST-Link dongle to ST-RJ11-R-BB. Bulk of such wires can be purchased here https://www.digikey.com/en/products/detail/digikey/DKS-20FF-20/17038802 )
Now you can flash the bin firmware file:
1) Make sure ST-Link V2 drivers are installed if you have not installed it yet. ST Link V2 drivers can be downloaded here https://www.st.com/en/development-tools/stsw-link009.html
2) Download and install ST-Link Utility application for PC. It will offer to install drivers during installation, install those too. Here is the official download of ST-Link Utility application https://www.st.com/en/development-tools/stsw-link004.html
3) Connect the ST-Link V2 dongle to the BRAIN board P7(STM32) interface using the Tag-Connect cable and other parts I mentioned above and wire it following the pinout from the BRAIN board KiCAD files. (3.3V to 3.3V, GND to GND, SWDIO to SWDIO, SWCLK to SWCLK, NRST to RST). You can use a multimeter in ringing mode to check the pins on the Tag-Connect cable and where they go.

4) Stick the ST-Link V2 dongle to USB in your computer

5) Launch the ST-Link Utility you downloaded and installed earlier
6) In the launched ST-Link Utility application click "Target-->Connect"

7) Then click File --> Open File and select the firmware bin file that you need.


8) Then click Target --> Erase Chip

9) After erasing process is complete click Target --> Program & Verify

10) Click the "Start" button and wait until it has complete flashing the firmware bin file and verification is done


After some time after flashing is complete you should see the green LED turns on

11) Click Target --> Disconnect

12) Eject the ST-Link V2 dongle from PC and disconnect the controller

13) Now you should be able to connect the controller to the VESC Tool application ( you can use a USB-C cable (can connect without powering the controller up with battery), or Bluetooth (needs to power the controller up with battery or USB), or VESC Express dongle (needs to power the controller up with battery)).
14) After connecting the controller to the VESC Tool application apply the appropriate motor configuration xml file (at the moment the current motor configuration file is "M620 CAN #4 (2026-03-26) motor config.xml" )
File --> Load Motor Configuration XML

Select the motor configuration xml file you need

Click the Write Motor configuration button in the right side menu of the VESC Tool application

After this you can calibrate the rotary encoder (you do not need to change the amount of poles, it is already set correct) and setup your battery voltage limits, battery cells amount and setup your motor current and wattage through the VESC Tool application.
Attachments
Last edited:




























