nRF5340 DK: QSPI falsh erase and write

Hi Support Team,

I want to store sensor-monitored data per minute into the QSPI flash(mx25r6435f) on the nRF5340 DK, and send these data over LTE/mqtt per day. Could you help me with the below questions?

1 At first I used low-level APIs like flash_erase, flash_write, etc.
(1) For the QSPI flash operation, must I erase the sector first, then write the data to flash?
(2) Must the size of the flash_erase be 4096 bytes(the flash sector size)? Can I erase 1024 bytes, and then write the sensor data record by order?

2 My data will be stored in a circular overwritten way. When no free space in Flash, the latest data will overwrite the oldest data, and CRC is needed. I found there are several subsystems like Non-Volatile Storage (NVS), Flash map and Flash Circular Buffer (FCB) in Zephyr. Could you help give some guidance for my scenario, is FCB the best solution for my purpose? Is there a sample for FCB?

Thank you very much.

Best regards,
Yanpeng Wu

Related