Skip to main content
JChen.6
Associate II
October 27, 2021
Question

Programming code into external memory via the bootloader interface

  • October 27, 2021
  • 3 replies
  • 1603 views

I can use STM32CubeProgrammer to read and write code into external memory via ST-Link. 0693W00000FDy73QAD.pngHowever it fails to access the external memory via the bootloader interface(e.g USB).

0693W00000FDy7hQAD.png 

Does any one know how to fix the issue?

Thanks in advance

This topic has been closed for replies.

3 replies

Tesla DeLorean
Guru
October 27, 2021

You'd implement your own DFU loader that supports your board as you built it.​

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
JChen.6
JChen.6Author
Associate II
October 27, 2021

Hi Tesla,

you mean for programming code into external memory by STM32CubeProgrammer, I have to implement my own DFU? I can program code into internal flash via USB interface. does STM32CubeProgrammer only provide the DFU loader for internal memory?

Tesla DeLorean
Guru
October 27, 2021

>>Does STM32CubeProgrammer only provide the DFU loader for internal memory?

I think it's more of the case that is supports whatever the target side DFU Device facilitates.

The ROM based DFU implementation doesn't understand what's attached externally to the part, what pins you used, what memory IC's etc.

If you want to use DFU as a means of delivery you need to write a DFU firmware that understands the internal/external memory spaces, describes those memory interfaces to the host PC, and allows for read, erase and write operations to those memories. A ROM based loader is poorly positioned to address all possible combinations of hardware you might construct around it.

They don't download the External Loader in this context. The mechanics/model used by the boot loader is different to that used by the SWD/JTAG connectivity mode, where the ROM isn't used, and code can be moved in to RAM, along with data, and the memories programmed from there.

You could perhaps do a staged programming where you upload a new USB Device firmware into RAM, and run that, and give it the awareness of the hardware it is running on. The more considered solution is to build a loader that lives on the device permanently, and provides a means for you and your customers to update with minimal complications, and without a lot of custom host side software.

You'd need to add/expand the functionality of DFU Device examples

STM32Cube_FW_H7_V1.8.0\Middlewares\ST\STM32_USB_Device_Library\Class\DFU

STM32Cube_FW_H7_V1.8.0\Projects\STM32H743I-EVAL\Applications\USB_Device\DFU_Standalone

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
BTrem.1
Senior
October 27, 2021

Well thought out answer, I liked that !

JChen.6
JChen.6Author
Associate II
October 28, 2021

Thanks Tesla. However, I still don't understand something such as how to configure USBD_DFU_MEDIA Interface, the MCU I am using is STM32L4xx. Does any one have an example for the DFU uploading external memory?