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

In heart rate monitor, what is the purpose of m_memory_access_in_progress?

I am working through the heart rate monitor central ble device code on Nordic SDK 8.1. I noticed that the variable

bool m_memory_access_in_progress = false;  /**< Flag to keep track of ongoing operations on persistent memory. */

is created, but I can't figure out what the use of it is. From what I can see it's only set to true when pstorage_access_status_get() returns a number that isn't 0, and all other times m_memory_access_in_progress is false. The thing is I don't see it being passed into any functions or ever checked so what is the purpose of having it?
As a side note the board I'm using just has an nRF51822 without any storage added onto it.

Parents
  • This is to signal that nRF5x flash operation is ongoing, nothing to do with external storage. One of rarely moments when you can block entire nRF5x MCU for long milliseconds is flash page erase operation (as you can read in the manual) so any FW which uses time-sensitive activities (e.g. radio) and writes to internal flash tries to limit thee activities when it is safe to do them. More on this in countless Q&S on this forum...

  • (2/2)

    ...logically flash operations get delayed. So it's more about knowing that there is something pending (and potentially how many operations) then being scared that something fails. Now I don't know this particular example well enough to answer why exactly it counts pending flash operations. My guess is that it's rather hook ready for future additional app logic then something super functional right now but I might be wrong. If you need definitive answer then kindly wait and hope that Nordic guys will have time for this after holidays.

Reply
  • (2/2)

    ...logically flash operations get delayed. So it's more about knowing that there is something pending (and potentially how many operations) then being scared that something fails. Now I don't know this particular example well enough to answer why exactly it counts pending flash operations. My guess is that it's rather hook ready for future additional app logic then something super functional right now but I might be wrong. If you need definitive answer then kindly wait and hope that Nordic guys will have time for this after holidays.

Children
No Data
Related