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.

  • Hi Ole,

    thanks for your feedback.

    So normaly i can define my first address where i want to write the first Data is that right becouse my Application Code is also static thes address would be the same every time?

    And then i can right data to it like in the example of your SDk with an increment of the address.

    How do i know if the page i am writing to is full and how can i go to the next page or is this automatically done?

    best regards Nils

Reply
  • Hi Ole,

    thanks for your feedback.

    So normaly i can define my first address where i want to write the first Data is that right becouse my Application Code is also static thes address would be the same every time?

    And then i can right data to it like in the example of your SDk with an increment of the address.

    How do i know if the page i am writing to is full and how can i go to the next page or is this automatically done?

    best regards Nils

Children
No Data
Related