cancel
Showing results for 
Search instead for 
Did you mean: 

Updating STM32L152 Firmware from an External SPI Flash

Iman Hosseinzadeh
Associate III
Posted on June 18, 2018 at 13:08

Hello,

I am designing an embedded system with these parts:

  1. A Low-Power STM32L152RCT6 microcontroller
  2. SIM800 GPRS module
  3. A 16 Mbit serial flash (AT45DB161D)

After each reset, the microcontroller should check if a new version of firmware is available. If so, the new firmware must be downloaded from server to SPI flash and then programmed to microcontrollers internal flash.

Is it any documentation about this kind of programming?

Thanks in advance.

#stm32l152 #bootloader-/-firmware-update-via-sd-card-(iap) #firmware-update
4 REPLIES 4
Posted on June 18, 2018 at 13:16

Sound like a pretty standard embedded programming work assignment.

You can use the same routines to read/write the SPI FLASH as you would any other use, ST has examples of programming the L152 internal flash, and the modem should support or facilitate the connection to an HTTP or FTP type server using a Berkeley Sockets type implementation.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on June 18, 2018 at 14:46

Thank!

I reviewed most of available examples. They used UART for firmware transmission from PC to micro. Should I replace the UART part with external flash reading?

Posted on June 18, 2018 at 14:53

The STM32 libraries from assorted parts should have IAP example code using USART, USB-FLASH, ETHERNET, etc. the methods are reasonably generic. The partitioning of the loader vs application is also established, and a recommended way to allow for update and recover methods.

Yes, if you are using an SPI Flash to stage the firmware image you want to use the access routines for that, and manage the read of sectors/blocks from that with the erase/write of block within the internal flash. It is recommended to use some longitudinal test for integrity, ie a CRC or checksum, so you can check the downloaded image is valid/complete, and also that your loader can check before transferring control to the application code.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on June 18, 2018 at 15:01

Thanks! I can read and write the SPI flash (Page read/write). So I should investigate the available codes from ST.