has anyone figured out how to write into the nRF52832 Flash from the main application? There is a library Arduino NVM that does the great job, but sadly, it wont work when the SoftDevice is used, i.e. when any BLE functionality is wanted.
The official Nordic examples are recommending to use their fstorage and FDS functions, but I’ve been struggling for two weeks now to make it work in Arduino.
Also, when I copy the nrf_nvmc.c and nrf_nvmc.h files from the SDK (nRF5_SDK_17.0.2_d674dde from Nordic in my case, or see here), which implement the main non-volatile memory controller functions, there are no errors. So these functions should be directly usable.
I’m using board = adafruit_feather_nrf52832 for reference.
The Adafruit solution probably works, but my issue is that I’m not using Adafruit nRF52 Arduino Framework, but the other one (Sandeepmistry nordicnrf52). And migrating to the Adafruit turned out to be a tremendous fail for me. My board is not compatible with Adafruit’s and it just refused to work.
Regarding the second part of your answer:
Writing into the Flash on nRF52 is possible with two backend functions: one that uses NVMC backend, like yours one here and my original one above, and the one that uses SoftDevice. These are not compatible, because the SoftDevice takes control over writing to Flash once you turn the BLE radio on. To make it happen, you use fstorage API with Softdevice backend.