2023-04-14 02:40 PM
I have a design that uses and STM32L4 series MCU. The device will be hard to physically access, but has a serial connection to the 'outside' world on UART 4. The board also has a 4 Mbit flash connected to the MCU via (bit-banged) SPI.
When I need to update the FW in the MCU I'd like be able to send the binary file down the serial connection, store it in the external SPI flash, verify the download is good, and then copy flash the MCU FLASH so that the next boot up will be with the new FW.
Can someone please first verify if this is possible, and second point me to some resources on how to implement it?
Thanks!
Solved! Go to Solution.
2023-04-14 02:59 PM
Yes, you can stage data in external memory, and subsequently pull that and write internal memory.
Would generally recommend making a small loader at the front of the internal flash which you never erase, it contains enough code to check the new app code, and then write it slightly deeper into internal flash. How much deeper depends on how tight the implementation is, but suspect the loader would take 16KB or less.
Things to have are some means to determining image size, and also a checksum or CRC for integrity checking.
STM32Cube_FW_L4_V1.17.2\Projects\NUCLEO-L432KC\Examples\FLASH\FLASH_EraseProgram
Seem to recall having posted L4 and L5 flashing code to the forum in recent weeks. Block sizes on the flash are relatively small and manageable.
2023-04-14 02:59 PM
Yes, you can stage data in external memory, and subsequently pull that and write internal memory.
Would generally recommend making a small loader at the front of the internal flash which you never erase, it contains enough code to check the new app code, and then write it slightly deeper into internal flash. How much deeper depends on how tight the implementation is, but suspect the loader would take 16KB or less.
Things to have are some means to determining image size, and also a checksum or CRC for integrity checking.
STM32Cube_FW_L4_V1.17.2\Projects\NUCLEO-L432KC\Examples\FLASH\FLASH_EraseProgram
Seem to recall having posted L4 and L5 flashing code to the forum in recent weeks. Block sizes on the flash are relatively small and manageable.