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

NVMC timing: Flash access blocked during low latency BT communication?

Hi,

my question is related to this question: devzone.nordicsemi.com/.../

Erasing Flash pages takes a pretty long time (and the CPU is blocked during this time). For the nRF52, up to 89.7 ms (!!) are specified in the manual.

Considering I have application code running that does not provide an interval that long without Bluetooth communication:

  • A Broadcaster role that continuously advertises at maximum speed (20ms)
  • A minimum connection interval (7.5 ms) which is used continuously
  • A Observer role that is scanning 100% of the time

What will happen if I try to erase a page that cannot be erased during two radio events? Will the request wait forever? Will it be impossible to erase a page in this scenario? Or will Bluetooth operation be affected by the flash erase operation? (I could not find any information about this scenario in the documentation available.)

In other words: Will I have to shutdown my Bluetooth communication to erase a flash page?

Update:

After trying it out with SoftDevice s132_nrf52_2.0.0-4.alpha_softdevice.hex, In most cases I immediately (=no noticeable delay in the Segger RTT log) get an error message NRF_EVT_FLASH_OPERATION_ERROR. But sometimes it seems the operation finishes successfully (erasing a page as well as writing one or two words), but I get the error message NRF_EVT_FLASH_OPERATION_VERIFY_FAILED although the flash location holds the valid data?!

When I activate advertising at 10 seconds interval and I immediately want to erase a page (just some lines after starting the advertising), I also get NRF_EVT_FLASH_OPERATION_ERROR. If I retry the function call a second later, it works fine.

If i activate both advertising (10s interval) and scanning (100% duty), and then I disable scanning before and re-enable it after flash access, it first seemes to work fine (except for the first page erase operation like mentioned above). I continue writing 1-2 words and erasing the page continuously with a 1 second delay between the operations. But after a minute or so, I suddely get NRF_EVT_FLASH_OPERATION_VERIFY_FAILED errors (although data has been written successfully) and sometimes NRF_EVT_FLASH_OPERATION_ERROR errors (in this case, the flash has not been altered). And no operation returns NRF_EVT_FLASH_OPERATION_SUCCESS anymore. I wonder what ist broken here...

Did you run a high load / stress test with the NVMC interface to ensure reliable operation?

By the way, I directly use the SoftDevice SoC interface functions sd_flash_page_erase() and sd_flash_write().

Related