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

Hard fault when using NVS with Zephyr on nRF52

I'm attempting to write to flash memory on our custom board using the nRF52840 using the NVS library in Zephyr 1.5.0. I've ported over the example code from samples/subsys/nvs and nvs successfully initializes:

The storage file system structure is initialized identically to the example code.

But, when I go to actually save data, I get a hard fault, specifically MPU Fault:

My prj.conf file includes the same lines from the example, specifically CONFIG_MPU_ALLOW_FLASH_WRITE=y which I saw was mentioned as a fix on some git tickets.

This is all on a custom board, with the devicetree based on the nRF52840DK and successfully working with our board specific peripherals. Nothing in the flash memory section has been changed.

Also strange is that when running the default nvs code on the dev kit, I get this error: <err> flash_nrf: not word-aligned, followed by the memory address, for every attempted write. 

Thanks in advance for your help!