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().

  • Hi,

    As far as I know, the NRF_EVT_FLASH_OPERATION_VERIFY_FAILED event will not be part of the full s132 v2.0.0 release. It is seen in some of the alpha releases. For the s132 v2.0.0-alpha releases it seems it can be safely handled as if it was an NRF_EVT_FLASH_OPERATION_SUCCESS. It is no longer present in s132_nrf52_2.0.0-7.alpha.

    There are a couple of unsuccessful flash operations in your log, but they seem to be signaled correctly by NRF_EVT_FLASH_OPERATION_ERROR events.

    Regards, Terje

  • Hi Terje,

    thanks for the info. Does this mean that when the Flash begins degrading (after erasing/writing for too many times), the SoftDevice will report NRF_EVT_FLASH_OPERATION_VERIFY_FAILED? This way it would be impossible to distinguish between degrading Flash and missing time slots due to radio activity.

    Do you have a coarse estimation/schedule when a production ready S132 (and nRF52 SDK) will be released?

    Thanks, Michael

  • Hi Michael,

    I think the VERIFY_FAILED was supposed to do that, yes, but somewhere between s132 v2.0.0 alpha 4 and 7 it was removed. My guess is that it did not work as intended.

    For estimates on when s132 and SDK 11 will be released, I am afraid you will have to talk to your sales representative. If you do not know who is the Nordic sales representative in your region, you can send me a PM with your location so that I can find the contact details.

    Regards, Terje

Related