cancel
Showing results for 
Search instead for 
Did you mean: 

Is DFU the recommended method for Manufacturing and Field updated to load FW into the SMT32G071?

MStev.7
Associate II

If so, I seem to be missing how to set boot0 (I think) to have STM32CubeProgrammer v2.11.0 recognize the part on the dev board, “No STM32 device in DFU mode connected�? although I can use CubeIDE to program the development board. Just looking for a solution to program and update the code in the part without using CubeIDE. We want to use the USB interface just like when using the CubeIDE, the STM32G071 will be on a PCBA that will be connected to a system via USB for updates.

14 REPLIES 14

I currently am using the USB connection on the Nucleo for both programing as well as a USART from the G071. Since the Nucleo can support the FW update via a simple copy of a hex file to the board that in turn updates the G071, I want to duplicate the circuit from the Nucleo that has the STM32F103 connected to the G071 SWD interface. To make this functionality work I need to understand what code (bootloader) is running in the STM32F103 that allows for the user to connect to the device over USB and then to simply copy the HEX file to the G071 and then to pull reset. I understand that I could use some interface from USB to the SWD link (2 wire) to program/debug the G071 directly, however taking this approach would also require me to add an interface also for the USART to all for output from the G071 device.

MStev.7
Associate II

Maybe I am going about this the wrong way... I thought that DFU/Flash Stick, etc. mode was the right direction, but if there is a better method of how to do this then please let me know. Here is what I am trying to achieve.

  1. I need a method that will allow for a simple copy of a hex file to the G071 to update the code on the device when needed. This interface can be USB to the SWD Link interface or something else. I just can not use special Software to perform the update once the G071 is in the product.
  2. The G071 has a function in the code that needs to send output (text) to the USART that is consumed by a process outside of the G071.

So number 1 is for programing and updates and number 2 is for I/O. Based on how I currently am using the Nucleo you can see how I thought that by simply copying that design I could achieve both requirements.

Since ST will not provide the code (bootloader) for these features in the STM32F103, I need to take a different approach. I agree that using the STM32F103 to perform these simple tasks is overkill, however it was a solution.

So thoughts on the best method to address these requirements?

  1. Some USB to SWD link interface.
  2. G071 USART to USB interface.

I currently have the USART2 TX and RX on the G071 tied to the STLINK TX and RX to send data out over the USB interface on the Nucleo.

You'd have to write something to ingest .HEX, or. DFU files and process the stream.

You might want another FLASH device to stage the update.

I frequently implement XMODEM in my devices so I can use off-the-self terminal application to push data with its own flow-control, as the FLASH writing needs pacing/waiting

Used .DFU files on SD Cards to facilitate updates.

Perhaps look at the UART protocol. The Arduino MKR WAN 1300 has code to implement (on github), and controls a the NRST, BOOT0, and UART RX/TX pins to push in updates.

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

If your board has accessible SWD connector and you/your customer can use an external ST-LINK, this may be the best way. Modern ST-LINKs have both SWD and VCP (UART) interfaces.

If the built-in bootloader of STM32 supports the UART, it may be used too.

Then the RTS output of USB to UART adapter can be connected to BOOT0 to force entry to the bootloader.

SWD interface is more powerful (especially if NRST and SWO are connected), it allows to debug and completely re-program the MCU (think recovery). But it requires extra software: command-line CubeProgrammer subset or something OpenOCD based. Or a professional flasher tool.

On the other hand, the mass-storage like (or even DFU-like) USB interface is easier for the user, but requires at least one additional chip.

Your board need only

0693W00000Y7MGLQA3.pngand or

0693W00000Y7MG1QAN.pngsome info

ST-Link clone repurposing | Hackaday.io

Building a custom ST-Link V2.1 – EmbedBlog

and for inspiration you can place onboard BLE module and use DFU apk

StmDfuBlue (yatrim.com)