nrf9160 NVS write flush (NCS 1.9.1, MFW 1.3.2)

Hello,

My application stores settings in Zephyr NVS. During device production a python script running on PC sends RTT commands to write initial settings to NVS/flash.

The setup ran flawlessly on my table, but factory had some issues as the settings wasn't successfully written to flash after production. Turns out, they controlled DUT power switch automatically and turned DUT power off as soon as the script returned. Adding a delay before turning power off fixed the issue.

Does it mean that data are not yet committed to the flash after nvs_write returned? I have a hard time reading soc_flash_nrf.c, looks like much of the code there is to ensure realtime radio operation on nrf52, is this still enabled for nrf9160? How do I ensure that the data are flushed?

Thank you.

Parents
  • Hi,

    The NVS API is synchronous, so when the call to nvs_write() returns, the data should have been written. I have confirmed with one of the developers that worked on the flash driver that this is the case, and he did not see any way the behavior you describe could happen. So unless there is an unknown bug, this should not be the case.

    Are you sure the DUT processed the data before it was powered down? Could there be an issue in your production script, for instance? (In any case, a solution could be to read back and verify that the data is properly written that way before powering down).

Reply
  • Hi,

    The NVS API is synchronous, so when the call to nvs_write() returns, the data should have been written. I have confirmed with one of the developers that worked on the flash driver that this is the case, and he did not see any way the behavior you describe could happen. So unless there is an unknown bug, this should not be the case.

    Are you sure the DUT processed the data before it was powered down? Could there be an issue in your production script, for instance? (In any case, a solution could be to read back and verify that the data is properly written that way before powering down).

Children
Related