cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F042 Bootloader Activation

harald
Associate III

Hy,

I am planning a system where 2 STM32F042 UFQFPN28 devices serve as CAN Controller and are controlled by one master CPU. PCB Space and CPU pins are short. I need to guarantee a fail safe FW update for the two STM32 MCUs.

I plan to wire the system as follows:

0690X000006CGl8QAG.png

My host CPU can switch pin functions between SPI MOSI / USART TX and SPI MISO / USART RX. So in application mode I do SPI communication with two separate SS lines, in bootloader mode, I will hold one STM in reset and communicate with the other over UART in bootloader mode.

How can I activate bootloader mode?

This device has empty check mechanism, so on first boot it activate bootloader automatically?

And to trigger a firmware update in field, I need to erase 4 byte of User Flash from application and perform a reset to enter bootloader mode?

0690X000006CGlIQAW.png

To stay fail safe, I assume I write the first 4 bytes of User Flash (address 0x0800 0000) at the very end of bootloader action, right?

My device will be pluggable. And I do not know the CAN bus state during plug in. How can I prevent to boot device in bootloader mode when CAN RX (PB8-BOOT) is high accidentally on reset? Will it leave bootloader automatically when no USART communication is performed in a given time?

Does that sound doable to you?

Regards

Harald

1 ACCEPTED SOLUTION

Accepted Solutions

Memory would be blank anyway in that situation.

I wouldn't get overly tied to the system loader protocol, it's not that useful, and problematic if other interfaces look active.

Migrate some of the initialization code in the loader (ie clocks, pll, gpio, peripheral or two) and then not replicate in app.

You're also not compelled to use C or the libraries with the loader, or use interrupts or vector table. I'd be especially wary of the ST library pulling in the floating point library for the USART baud rate computations.

Mouser suggests a minor difference in 16 vs 32K flash parts, I'd be more concerned over the lead times pushing out. If you're doing enough quantity and have multiple ST parts in the design push for an aggressive quote, especially if all the die have 32KB on to begin with.

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

View solution in original post

4 REPLIES 4

I think I'd probably use a sector sized loader I didn't erase. If the app code integrity was broken I'd fall back into an update or safe mode.

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

Sounds reasonable, too. I might run into flash size issues, because the selected device has only 16k Flash. And I could not use that during production.

Memory would be blank anyway in that situation.

I wouldn't get overly tied to the system loader protocol, it's not that useful, and problematic if other interfaces look active.

Migrate some of the initialization code in the loader (ie clocks, pll, gpio, peripheral or two) and then not replicate in app.

You're also not compelled to use C or the libraries with the loader, or use interrupts or vector table. I'd be especially wary of the ST library pulling in the floating point library for the USART baud rate computations.

Mouser suggests a minor difference in 16 vs 32K flash parts, I'd be more concerned over the lead times pushing out. If you're doing enough quantity and have multiple ST parts in the design push for an aggressive quote, especially if all the die have 32KB on to begin with.

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

Yes, you are right! We need 24.000 pieces until Feb 2019. I don't know if this is enough for getting a good price from STM. I asked our distributor already but have no repsonse yet. Would you know a good starting point for my own, slim IAP application that resides in flash?

I still need JTAG or SWD connection during production, but this should be possible. In my first approach host CPU would have done this over bootloard protocol on first start.