cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F7 Firmware update via USB key

MiladChalipa
Senior

Hi every one

I'm developing a project on STM32F746BGT6 custom board which will use USB port for store Data on USB key AND firmware updating purposes (In the Field updating), cause I am newbie on USB things, I am googling about firmware update through USB key but there is dozens of articles and videos about updating via SD card.

My questions is:

  1. Is updating firmware through SD card and USB key the same as each other, In other words can I tailored SD card implementations to USB Key for updating via Flash drive?
  2. Based on my researches, It has to be a Bootloader for make the update possible in the Application, But my MCU suffers for lack of Flash space, Is it possible to put the bootloader (or maybe the part of main application) in the external flash section (with some linker file modifying)? (I am implementing QSPI protocol for External flash)
  3. I am completely out of ballpark in USB implementation, So is there some articles or examples for this purposes to help me better understanding of USB FIRMWARE UPDATE? By the way I read the AN3990 from ST but couldn't find the example files which is mentioned in the App note itself.

Any help would be appreciated friends😊

1 ACCEPTED SOLUTION

Accepted Solutions

@Community member​ "A .DFU file is an object file format better suited to describing sparse binary data, that ST defines/supports.​"

+1 👍

And it's not ST-specific - it's a standard USB thing:

https://en.wikipedia.org/wiki/USB#Device_Firmware_Upgrade_mechanism:~:text=Device%20Firmware%20Upgrade%20(DFU)%20is%20a%20vendor%2D%20and%20device%2Dindependent%20mechanism%20for%20upgrading%20the%20firmware%20of%20USB%20devices

So definitely sounds like the way to go!

Seems ST have some videos on it:

https://www.youtube.com/watch?v=n_LDXOQHerU

https://www.youtube.com/watch?v=CGUC1wqSLCE

View solution in original post

8 REPLIES 8
MM..1
Chief II

Hi Milad,

at 1 your idea about USB key is waste of space and time, because your updater person need PC where load file to key and then move key into device and device need big bootloader complicated with full usb and fatfs. Instead this your person can connect usb cable from pc to device and do update simpler.

at 2 yes your code can extend or use only external flash, but is slower and block bus and DMA use.

at 3 ... try first AN2606

At a FATFS level both approaches would be similar.

A loader could presumably be staged and executed from RAM.

The USB example should be in the Cube F7 trees as FWupgrade, or something similar, I'll look for a.specific cite later. ​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

@MM..1​ Thanks for your fast reply, I will read the AN2606, In my opinion the IOT things change the way we looked to MCU capabilities forever, easy to use in the field programming using just USB stick is more convenient that other professional ways which we used to programming MCUs. For the End Users, It is more simple to download a piece of file from Web to the USB Key then plug and update the device. By the way I will use TouchGFX GUI for my project and based on my previous projects, the .bin file for project will be in GB size ranges. I am looking for more efficient ways for updating firmware (I don't know why the .hex files in 50~80 MB ranges but .bin is in ~2 GB sizes).

@MM..1​  "your idea about USB key is waste of space and time"

I disagree:

"because your updater person need PC where load file to key"

True, but then they can just take the key away to do the update(s) - they don't then need to take a PC with them.

I think that makes a lot of sense, and is a common approach.

@MiladChalipa​ "(I don't know why the .hex files in 50~80 MB ranges but .bin is in ~2 GB sizes"

Probably because the image is sparse; ie, it contains gaps.

An Intel Hex file has addressing, so it can specify where the programmed sections are to go - without having to fill the gaps;

A .bin file is just a byte-by-byte representation of the image - including the bytes for any gaps in the useful data.

Recent thread on the difference between .hex, .bin, and .elf:

https://community.st.com/s/question/0D53W00001fSBMySAO/difference-between-bin-hex-and-elf-file-and-their-sizes - with links to details of the .hex and .elf formats

A .DFU file is an object file format better suited to describing sparse binary data, that ST defines/supports.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

@Community member​ "A .DFU file is an object file format better suited to describing sparse binary data, that ST defines/supports.​"

+1 👍

And it's not ST-specific - it's a standard USB thing:

https://en.wikipedia.org/wiki/USB#Device_Firmware_Upgrade_mechanism:~:text=Device%20Firmware%20Upgrade%20(DFU)%20is%20a%20vendor%2D%20and%20device%2Dindependent%20mechanism%20for%20upgrading%20the%20firmware%20of%20USB%20devices

So definitely sounds like the way to go!

Seems ST have some videos on it:

https://www.youtube.com/watch?v=n_LDXOQHerU

https://www.youtube.com/watch?v=CGUC1wqSLCE

I disagree too, PC is too ultrabook and one simple cmd file and usb cable is more controllable update as blackboxed custom USB key loader.