2022-03-31 04:59 AM
I have an STM32F429 custom board that when in product only supports CAN bus.
I need to be able to upgrade firmware while in product over CAN bus. I know the bootloader supports this but sadly our custom board has been designed to use different CAN bus Tx/RX pins than the bootloader expects:
In our design we use the default CAN1 pins:
PD0 - RX, PD1 - TX
The bootloader is doing CAN over non-standard CAN2 pins:
PB5 - RX, PB13 - TX
I already have code in place to allow bitmap data to be uploaded over CAN and programmed to flash. I'd like to leverage this to upload a binary firmware image and load it over the currently running firmware. Not sure if anyone has a better idea. Is there an example of how to do this anywhere?
Thank you. Any help appreciated.
2022-03-31 07:14 AM
You need two points
2022-03-31 08:00 AM
ST has some IAP (In-App Programming) examples in various Cube repositories
Some of the F4 Disco boards has a "FWUpgrade" type example using USB MSC Host.
I'd generally recommend splitting the FLASH such that you have a Boot Loader, App, and staged update. If you have external flash to stage the update that might help if it is large, or you have issues with real-time responsiveness when flash writes stall the processor. Can also run from RAM to avoid that.
2022-04-04 05:37 AM
Thank you Tesla. Could you please post a link to these examples you mentioned that I couldn't find:
I agree splitting flash would be the best option. I don't have external flash but my memory footprint is very small. When a flash update is in progress nothing else will be happening.
2022-04-04 05:42 AM
I have a way for my host device to command the STM target to jump to the bootloader. That works fine. But my board is hardwired to listen on the wrong CAN signals so that won't do me any good now (can't redesign the board as we already built a quantity).
I'll use the ST-LINK to program my application into the raw boards from the factory. After that though I don't want to use ST-LINK anymore.
With my current application (v1.0) I can upload the new application (v2.0) into RAM but then I need to overwrite the currently executing application with the new one. Sorry, it's a bit hard to explain.