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

Can I use ble_flash_page_write while connected?

Hello, I'm fairly new are Nordic and have inherited a good project from a departing coworker. We are using Keil uVision 5+nRF51822+BLES110 softdevice.

She explained her design to me by telling me that we cannot write to ble_flash while we are advertising or connected. She also told me that this issue may be resolved in an upcoming API or SoftDevice upgrade.

Is this true? Is it currently possible or will it be at some point to interact with Flash while connected?

Thanks.

  • Hi,

    You are right, you cannot write to flash directly using NVMC registers while softdevice is enabled and connections/advertising/scanning is active. This is because a flash write halts the CPU which could cause asserts inside softdevice.This might result in lost connections or in the worst case softdevice assert.

    You can use either pstorage API or SOC API (sd_flash_write) to access flash safely while in connections. This API would guarentee that the write happens only in the time when radio is not active by reserving a timeslot for being exclusive to the flash. At this timeslot, softdevice does nothing but waits for the write to finish.

    Here you can find more documention for this. Make sure you follow all the vital initialization procedures given there as there has been lots of cases here who missed this.

    The code for this is at SDK_PATH\components\drivers_nrf\pstorage SDK_PATH\components\softdevice\S1x0\nrf_soc.h

  • Hi riceman0, could you please update this thread with latest info, if this answer helped you then please click the ✓ to the left of the answer so that others can come and look here.

Related