Skip to main content
MMerc.1
Associate III
February 19, 2020
Question

How can I load the binary file via USB?

  • February 19, 2020
  • 7 replies
  • 6494 views

Hi,

I want to use an USB device in order to load the .elf file via USB on STM32F746.

How can I do this?

Best Regards

This topic has been closed for replies.

7 replies

KnarfB
Super User
February 19, 2020

Check AN2606 Application note "STM32 microcontroller system memory boot mode" for USB DFU boot and your chip.

MMerc.1
MMerc.1Author
Associate III
February 20, 2020

HI KnarfB,

Thank you for your reply.

I have read the Application Note carrefully and I understand how the DFU works but which of the two bootloaders should I use (V7.x or V9.x) ?

I come back to my ask : I want to use a USB key in order to update the program in STM32F746.

Tesla DeLorean
Guru
February 19, 2020

The ST-LINK/V2-1 provides a faux MSC drive onto which you can copy a straight binary file. It does not support OBJECT files like .AXF or .ELF

You can convert .ELF to .DFU

You can write your own USB device and .ELF loader on the STM32 if you really want, would probably want to familiarize yourself with the .ELF format.

You could load a .DFU or .ELF from a MicroSD card using your own loader, or perhaps via a MSC Host, like some of the F4-DISCO FW_Upgrade examples.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
MMerc.1
MMerc.1Author
Associate III
February 20, 2020

Hi Clive,

Thank you for your reply.

How can I convert .ELF to .DFU ?

I found the following exemple : STM32Cube_FW_F7_V1.15.0\Projects\STM32746G-Discovery\Applications\USB_Device\DFU_Standalone

In this exemple, it says to use "DFU File Manager" to convert a binary image into a DFU image. But I don't know how to convert an .ELF file...

I come back to my ask : I want to use a USB key in order to update the program in STM32F746.

Does the above exemple answer my question ?

Tesla DeLorean
Guru
February 20, 2020

>>How can I convert .ELF to .DFU ?

If writing your own tools, probably start with a working understanding of both object formats

DFU File Format, see attached

See this for pulling a binary, basically a USB IAP (In-App Programming) example

STM32Cube_FW_F7_V1.14.0\Projects\STM32756G_EVAL\Applications\USB_Host\FWupgrade_Standalone

>>I have read the Application Note carefully and I understand how the DFU works but which of the two bootloaders should I use (V7.x or V9.x) ?

The loader is on ROM/OTP, you don't get to chose

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Brice_38FR
Associate II
February 20, 2020

Hi

I upload my firmware on a STM32f446 with the USB

First go to boot mode (in my case internal command send over USB or button)

Now your device should appears in DFU mode (lsusb give me STMicroelectronics STM Device in DFU Mode )

Now you can send you bin file with command sudo dfu-util -a 0 -s 0x08000000:leave -t 0 -D fwm_0100.bin

And now wait a few seconds and it should be done, the :leave is important as it allow your device to leave the DFU boot mode

To generate the bin, in STM32CubeIDE, go to project properties -> C/C++ Build -> Settings -> MCU Post build outputs -> Convert to binary file

edit: ok i misread the problem, You want to act as a USB host with a USB key to upload your own firmware from the usb key

MMerc.1
MMerc.1Author
Associate III
February 20, 2020

Hi Brice_38FR,

Thank you for your reply.

As you can see, I want to use a USB key to upload the "new" program from the USB key.

Currently, I use the STM32F746G-Disco and a micro A to USB A converter for the USB key. But I don't know how to upload the program from the USB key.

MMerc.1
MMerc.1Author
Associate III
February 24, 2020

Hi,

I have .BIN file. So I can convert it to .DFU file.

I looked the exemple : STM32Cube_FW_F7_V1.15.0\Projects\STM32756G_EVAL\Applications\USB_Host\FWupgrade_Standalone

I understand how it works but I can't use it for the STM32F746G-DISCO board...

MMerc.1
MMerc.1Author
Associate III
February 25, 2020

Any ideas ?

XTorr.1
Visitor II
January 2, 2022

this convert .BIN to DFU

use DfuSe --> "dfu file manager"

C:\Program Files (x86)\STMicroelectronics\Software\DfuSe v3.0.6\Bin\DfuFileMgr.exe

option one

multiBin

select file.

add to list

ok

Generate

XTorr.1
Visitor II
January 3, 2022

in my case STM32F207IGT

compiler project in release mode. --> .bin

"Dfu file manager"

08000000 (in map file show adress: FLASH           0x0000000008000000 0x0000000000100000 xr

DF11 produc ID (in DfuseDemo show show this information)

2200 version  (in DfuseDemo show show this information)   

DfuSeDemo --> in case STM32F207IGT: on the user board it only changes position SW boot0 [boot/Run]