This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to handle flashwrit in an safe way.

Hi,

i need to store data in my Flash, for that i use the flashwrite example. Am i right taht i can use the remain of my application flash? So all flash = 256 kB - App = 20 kB = Flash i can use to write my Data to ?

I read that if i use flashwrite and the Softdevie, that i have to halt the Softdevie becauose of the latncy of flahswriting is that right? How can i handle this in a safe way?

Best reagrds Nils

Parents
  • All of the flash can be used both for code and for data, but you do of course have to make sure that you don't try to write data to the areas occupied by the softdevice or the application. Depending on application size, the upper pages should be free, except for the ones used by the bond manager.

    Flash writing and erasing will halt the CPU, and for that reason, you must make sure to not do it when the softdevice needs the CPU. This means that you must do it between connection events (or advertising events). The softdevice provides a radio notification feature to allow you to know when a radio event is finished. At that time, you can do flash operations for a period equal to the connection interval*(slave latency-1) - some ms. Note that erasing a flash page takes typical 21 ms, so if you have a short connection interval, that might not be possible without slave latency. Also, if you have queued data to be sent, for example by sending a notification, the softdevice might need to wake up even if you do have slave latency.

    You can take a look at the ble_radio_notification module in the SDK for more information on how the radio notification feature can be used. Also, there are some pointers given in different questions here on the developer zone, so I'd recommend you to do a few searches. Let me know if you have specific problems.

  • I Think my main problem is that i don#t understand what in the sdk example happens. I only need to safe some data in free flash and i need to knwo wher it begins and where it and. Maybe you can explain me how the address in the example is calculated. And is this static, so could i define this addres as beginning address?

Reply Children
No Data
Related