cancel
Showing results for 
Search instead for 
Did you mean: 

Fastest method to transmitt huge chunck of data from app to flash

Taxara
Associate III

Hi all,

I need a dual bank firmware update to meet some requirements. I have a STM32WB55 with 1MB of flash which is seperated in 3 sections of 300kb (ble, appliciation and an update stack) + bootloader. I can do a firmware update and now im trying to speed up the transmission process.

Currently im sending the binary to the update stack. My ble service sends 4 bytes header with 16 bytes of data and directly safe the data on flash using HAL_FLASH_Program and a semaphore (required for bluetooth connection see ble_RfWithFlash). Because programming flash is pretty slow, 5.5 ms for double word, so > 11ms per message, it takes a long time to transfer the entire binary...

What would be a good way to improve this timewise? I came up with a two solution but dont know what is the best approach and what the advantages and disadvantages would be.

  1. Create a buffer of one page and use fast program to program one entire page instead of 2 double-words each time(i do have enough free ram)
  2. Use data length extending for the ble service and send 250 bytes each time

Or if you have another solution please share!

Thanks in advance,

1 ACCEPTED SOLUTION

Accepted Solutions
Remi QUINTIN
ST Employee

​The double buffer strategy seems to me the best strategy both from speed and from CPU load standpoint (less commands and events to process).

View solution in original post

3 REPLIES 3
HRadt.1
Senior

I decided to implement a double buffer strategy. Have two buffers, when one is full write it to flash while still receiving more data on the other buffer.

Thanks for your reply, thats a good option as well!

Remi QUINTIN
ST Employee

​The double buffer strategy seems to me the best strategy both from speed and from CPU load standpoint (less commands and events to process).