Skip to content

U85 module programming

iliasam edited this page Jul 18, 2024 · 23 revisions

This module can be programmed in two different ways: with a special programmer (like St-Link) or by UART.
U85A modules require +3.7-4.2V as VBAT.
You can connect power lines (VBAT, GND) to the bigger pads at the PCB, which are used to connect battery.
Notice that original factory firmware is protected from reading, so you can erase and rewrite it, but you can't restore original firmware!

Using programmer

Connect "PWRON" line to VBAT line - to power on module.
You need to connect SWDIO, SWCLK, NRST, GND to your programmer (ST-Link for example).
Also it is recommended to connect MCU VDD to TVCC (target VCC) input pin if your programmer has it (like original St-Link).
Notice that NRST must be connected! You programmer must have a special reset pin (cheap Chinese St-Link dongles don't have it).
You need to select "Connect under Reset" and Reset mode: "Hardware Reset" in options of your programmer software.
This method is recommending if you are planning to change source code.

Using UART bootloader

This STM32 has an integrated UART bootloader (DFU), that is stored in ROM (it is not possible to erase it).
This bootloader can be used for loading firmware to MCU without programmer. Only USB-UART converter is needed.
You need to connect BOOT0 line to VBAT and reset module (power off/on) to enter to bootloader. Laser is usually on in this mode.

Pinout for UART programming (U85A module):
drawing

Use "STM32CubeProgrammer" utility for working with bootloader. Select "UART" mode near "Connect" button.

Original firmware of the module is locked, so you will have such message after connection:
drawing

So you need to set "Read Unprotect" switch (it is at right) and try to connect again. This will erase original firmware!
If everything is OK you should be able to load new firmware to MCU.
You can find build firmware here (*.hex files): https://github.com/iliasam/Laser_tape_reverse_engineering/tree/master/Code/CortexM0
Select "Firmware_dist_calculation_fast_boot.hex" to use it with Arduino (UART baudrate - 256000).
Also "Firmware_dist_calculation_fast_boot_115200.hex" version is suitable for Arduino (UART baudrate - 115200).

If you don't need to have debugging functions by SWD, it is preferred to use "_boot.hex" files.
Program hex file to MCU and connect "BOOT0" pin to GND (or leave it floating) to disable bootloader.
Reset module power at the end.

See this video with example of unlocking and writing firmware: LINK

Clone this wiki locally