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

Can firmware write to FLASH directly, not using fstorage, without bothering the SoftDevice?

Hello, I just want to clarify a secondary takeaway from my post:

https://devzone.nordicsemi.com/f/nordic-q-a/60714/best-approach-to-store-nonvolatile-data

I would like to confirm that we can access our nrf52832 registers to write to FLASH (ie not using nordic drivers, eg fstorage) without bothering the SoftDevice?  Meaning, will this work and do we need to be careful not to conflict with, for example, SoftDevice register actions or flash access?

Thanks.

Parents
  • Hi,

    If you do not use a softdevice in your application, or the softdevice is disabled, you can access the NVMC registers as much as you want to write/erase flash.

    If a softdevice is enabled, you can only do flash operations through the softdevice flash API. BLE has critical timing requirements. If the softdevice fails to handle the events within time, the radio link may be lost. During a flash write/erase operation, the CPU is halted, preventing the softdevice from handling events. 

    Through the softdevice flash API, flash operations are performed asynchronously between BLE events, determined by the internal scheduler in the softdevice.

    Accessing the NVMC registers directly with a softdevice enabled will likely lead to a softdevice assert.

    Best regards,
    Jørgen

  • Fstorage comes with two separate Backends, the softdevice backend and the NVMC backed. If you look into the softdevice backend implementation (components\libraries\fstorage\nrf_fstorage_sd.c), you will see that it uses the softdevice APIs for writing/erasing flash.

  • Hi, I was eavesdropping on this question because I was working through something similar. When you say

    BLE has critical timing requirements. If the softdevice fails to handle the events within time, the radio link may be lost.

    Does that mean that if the soft device is used for other things, i.e. app timers, and not ble connectivity, this is ok? I have been using the NVMC methodology for flash erase/write, while only using the soft device for my service loop (the app timer) and flash memory jumps. I have not run into any soft device asserts, which I wanted to know if it was expected or not.

Reply
  • Hi, I was eavesdropping on this question because I was working through something similar. When you say

    BLE has critical timing requirements. If the softdevice fails to handle the events within time, the radio link may be lost.

    Does that mean that if the soft device is used for other things, i.e. app timers, and not ble connectivity, this is ok? I have been using the NVMC methodology for flash erase/write, while only using the soft device for my service loop (the app timer) and flash memory jumps. I have not run into any soft device asserts, which I wanted to know if it was expected or not.

Children
No Data
Related