cancel
Showing results for 
Search instead for 
Did you mean: 

Programming STM32 in bootloader mode under Linux

Davorin
Senior

Good evening (o;

Now that my test setup works fine with setting the RTC via USB CDC and entering USB DFU mode due to the excellent help from the community members here....the next little problem arises (o;

Which program can be used nowadays under Linux to flash a STM32 MCU in USB DFU mode?

The STM32Cube programmer installs nice on Debian 10 and Ubuntu 20.04, but fails to start due to Java error...and guess this error exists since a long time and ST doesn't seem to care about it...

So is there another program for programming in DFU mode under Linux?

And if so...what input file format it expects? Something that comes strait out of STMCubeIDE?

 Or is there a sample CLI application which uses libusb to flash the MCU?

thanks in advance

richard

1 ACCEPTED SOLUTION

Accepted Solutions
MMisa
Associate III
4 REPLIES 4
MMisa
Associate III

Hi I am using st-link, but for dfu I would try dfu-programmer and dfu-util packages.

Ah great..thanks :)

So I can just throw the .bin file at it?

Or does the .bin/.elf file needs conversion? As I remember vagely dfu_util uses .hex files...

MMisa
Associate III
Davorin
Senior

Just great :)

Can sent it to DFU mode with:

echo "X1704" > /dev/ttyACM1

flash it then:

dfu-util -a 0 -s 0x08000000:leave -D ./USB_Thermologger_2/Debug/USB_Thermologger_2.bin
dfu-util 0.9
 
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
 
dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuERROR, status = 10
dfuERROR, clearing status
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 2048
DfuSe interface name: "Internal Flash  "
Downloading to address = 0x08000000, size = 42285
Download	[=========================] 100%        42285 bytes
Download done.
File downloaded successfully
Transitioning to dfuMANIFEST state

and it comes back to life ;)