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

Parents
  • Hi Yanpeng

    An external flash would be set up in a .yml file like the following for example:

    external_flash:
      address: 0x120000
      size: 0x6e0000
      device: MX25R64
      region: external_flash

    Where the address and size is something you configure not to overlap with the flash of the nRF5340. It seems to me like the base_address in your external_flash is incorrect and that's likely what you're having trouble with. What errors/issues are you currently having on your side?

    Best regards,

    Simon

Reply
  • Hi Yanpeng

    An external flash would be set up in a .yml file like the following for example:

    external_flash:
      address: 0x120000
      size: 0x6e0000
      device: MX25R64
      region: external_flash

    Where the address and size is something you configure not to overlap with the flash of the nRF5340. It seems to me like the base_address in your external_flash is incorrect and that's likely what you're having trouble with. What errors/issues are you currently having on your side?

    Best regards,

    Simon

Children
Related