NVS corrupt after applying sys_reboot() directly after nvs_write() #nrf52840

Phil Hipp


in my application, I want to apply a reboot via sys_reboot(SYS_REBOOT_WARM) directly after writing a specific value to NVS via nvs_write() to cleanly reinitialize the system with that value in NVS.

But somehow it seems that the NVS got corrupted by the reboot. When I try to initialize the NVS with nvs_init() after the reboot it always returns -22 (-EINVAL). The error seems to appear in nvs_gc().

Can anybody tell me, what I'm doing wrong here?




Join users@lists.zephyrproject.org to automatically receive all group messages.