cancel
Showing results for 
Search instead for 
Did you mean: 

How to support debugging and firmware upgrades on production boards

LMorr.3
Senior II

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,

14 REPLIES 14
Nikita91
Lead II

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.

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

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.

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,

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/ 

 

 

Thanks for the link, good info.   I'll end up making one of those boards.  I also just ordered a STLINK-MINIE.

I had 2 connectors ( ISP and PROG ) in order to provide the end-user with a 4 pin serial connector instead of a 10 pin.  I could do a 2x5 or 1x10 connector instead which will standardize as an up-side.

 

What is the 10th pin that you use?  I noticed the 'buld-your-own-stlink-v2-1-module' schematic has 10 pins for both SWPROG connectors but only one of the two GND pins seems to be connected to GND, and the 'key' pin does not seem to be used.  Is having 2 GND wires required? If not, could an 8 pin header be used as a standard instead?  ( I don't know what the key pin does )

LCE
Principal

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.

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 )