Skip to main content
Associate II
August 30, 2024
Solved

How to use DFU leave functionality from STM32CubeProgrammer CLI MCU

  • August 30, 2024
  • 1 reply
  • 1685 views

Hello,

I'm using CLI version of Cube Programmer for accessing/erasing/writing FLASH of STM32F412 MCU. The problem which I have is that I'm not able to reset board after series of action performed over DFU (using ST micro bootloader) while connected over USB. I do not see any way how to perform DFU leave operation which is described in AN3156 and this way how to restart customer board back to the customer firmware and this all by using CLI version of the cube programmer.

Am I missing anything? Is there any way how to perform reset over DFU/USB on F4? Any hint is highly appreciated here!

Thanks,

Karel

 

Best answer by MM..1

Have you try -g switch?

1 reply

MM..1
MM..1Best answer
Chief III
August 30, 2024

Have you try -g switch?

kareledAuthor
Associate II
August 30, 2024

Thanks a lot for the suggestion. Indeed -g switch helps here, but it's not that simple.

-g, --go : Run the code at the specified partition ID.
 [<partitionID>] : Partition ID
 If not specified, last loaded partition
 will be started

 [<startAdress>] : Start address
 If not specified, last loaded segment address
 [<noack>] : No acknowledgment required
 If not specified, acknowledgment will be required

 since I needed to specify start address, from the description above I'm also forced to specify partitionID. Honestly I tried:

-g partitionID=1 startAddress=0x8008001

-g 1 0x8008001

-g 0 0x8008001

-g 0x0 0x8008001

and such but nothing works. So I've given up and tried to use just start address.

-g 0x8008001

and this does not work either. But the output of such command is very convincing:

USB speed : Full Speed (12MBit/s)
Manuf. ID : STMicroelectronics
Product ID : STM32 BOOTLOADER
SN : 383939593231
DFU protocol: 1.1
Board : --
Device ID : 0x0441
Device name : STM32F412
Flash size : 1 MBytes (default)
Device type : MCU
Revision ID : --
Device CPU : Cortex-M4

RUNNING Program ...
 Address: : 0x8008001
Start operation achieved successfully

I don't know why this does not work, but it does not work only when done for the *FIRST* time. Once you try for the *SECOND* time, it miraculously works! And btw, the output is still the same.

So I've tested around 5 times and *always* after second invocation I'm back in the customer application.

Great! And thanks a lot for your help!
Karel

MM..1
Chief III
August 30, 2024
0x8008001

cant be start...