Skip to main content
LMorr.3
Senior
July 1, 2023
Question

How to support debugging and firmware upgrades on production boards

  • July 1, 2023
  • 3 replies
  • 4535 views

I plan on building my own board for the STM32F373 instead of using the dev board.  I have a basic schematic for the uC, but I also want to include support for debugging from CubeMX as well as a way to upgrade the production firmware for end users.  ( using a USB cable or serial cable is ok )  Do I also need to include firmware or can I just have a jumper on the board for when the firmware needs to be upgraded?

What do I need to include i my design to support this?  Is there a reference schematic/design at ST or elsewhere I can use?

 

Many thanks,

This topic has been closed for replies.

3 replies

Nikita91
Lead II
July 1, 2023

The STM32 contains a bootloader, which uses various means of communication such as a serial link for example (You have to look in the RM which serial ports can be used). You must use the BOOT pin to enter it at power-up. Then use CubeProgrammer to flash the code.

This does not allow debugging, it is necessary to implement another means, such as a connector for an STLINK-V3MINIE for example.: https://www.st.com/en/development-tools/stlink-v3minie.html 

No need to include firmware, but the end user will use CubeProgrammer with the file you provide.

LMorr.3
LMorr.3Author
Senior
July 3, 2023

Is there a go-to solution to do in-system-programming, for example having the device show up as a USB mass storage device and drag-drop the upgraded firmware binary to the folder?  I'm thinking of having two 4 pin headers, one for ISP and one for the STLinkV2/3 programmer.

Nikita91
Lead II
July 3, 2023

If you plug an STLINK on your computer, the STM32 target pops up as a MSC device in explorer. Then you can drag a file to this explorer to flash the device.

No need of ISP, the STLinkV2/3 programmer can do the job.

LMorr.3
LMorr.3Author
Senior
July 3, 2023

I should have mentioned I'm looking for a solution to upgrade production boards out in the wild.  Users won't have the STLink programmer.   So I was planning on having a 4 pin ISP jumper with GND,VDD,SWDIO, SWCLK so that I can debug and flash the latest firmware after boards have been built. 

I also need to find the best way to allow end-user to update firmware.  I was thinking of adding a 4 pin header with GND, PA10, PA11, VDD and provide a small cable with usb->serial 4 wire connector which could be used for any of my boards.  I would have a jumper to bring the BOOT0 high for firmware upgrade. I could also add the usb port on my board but the footprint would be too large when compared to a 4 pin header.  

Not sure if this is the best approach.

 

Thanks,

Nikita91
Lead II
July 4, 2023

IMO you are right an this is the solution proposed in my 1st post.

Why 2 connectors ? On all my boards I use only 1 connector with 10 pins:

- +3.3, 2xGND
- SWD, SWC, SWO,
- RST
- RX, TX

Depending on the case, I connect an STLINK or a USB/Serial converter to it. This standardizes the interfaces.

Example: https://adastra-soft.com/build-your-own-stlink-v2-1-module/ 

 

 

LCE
Principal II
July 4, 2023

For field firmware updates I am not a big fan of any special connector solution.
As a customer, I'd prefer to simply use a USB connection.
You don't need too many components: micro-USB connector, ESD-protection, and a few passive components.

LMorr.3
LMorr.3Author
Senior
July 4, 2023

Maybe I could have the 10 pin header with a small daughterboard with the micro-USB/ESD which connects via 10 pin female connector. ( instead of a cable )

In my case, I don't mind having the end-user use the STProgrammer app but it would be great if they could connect a USB cable and have the board show up as a mass storage where they can drag/drop a .hex/bin file to upgrade firmware.  I noticed the STLinkV3 does this.  Perhaps this works out of the box but I have yet to try it.  ( ordering STLinkV3 and spinning up boards )

AScha.3
Super User
July 4, 2023

F373 has USB - right?

we do this, by having boot0 pullup  from usb +5v , so when usb from pc is plugged in and then power up, it goes bootloader mode and any customer can upload new software just by using Cubeprogrammer (if not to silly to download it from stm.)

customer just needs cable for ...micro-usb, or whatever usb plug you put on your board.

"If you feel a post has answered your question, please click ""Accept as Solution""."