How to write IMU data to flash

Hello, 

I was wanting to record IMU data through the LSM6DS3 6-axis motion detector on the Seeed XIAO nRF52840. 

I know that the flash has a limit of 100,000 writes, but that will not be an issue for the data I will be handling.

Is there a simple / easy way to simply store either integers or possibly an array of integers to decrease the read / write amount even further?

I have been looking for documentation on writing to the flash, QSPI, and even EEPROM, but cannot find much.

I am a beginner, so I would prefer more in-depth explanations as I am still learning how to code firmware for 

Arduino based boards.

Thank you for your time to read my issue.

MCU : Seeed Xiao nRF52840

IDE: Arduino IDE

Device: Mac

Parents
  • Hello,

    This looks like an Arduino board (and you also say that you are using Arduino IDE). If that is the case, then I am sorry to say that I don't know how either the sensor or flash writing will work. You need to reach out either to Arduino or an Arduino forum, as this is not something that we either provide, support, or have particular knowledge in.

    That being said, 

    I know that the flash has a limit of 100,000 writes,

    That is partially true. The flash on the nRF52840 has a 10.000 (not 100.000) write erase cycles, as stated here:

    https://infocenter.nordicsemi.com/topic/ps_nrf52840/abs_max_ratings.html?cp=5_0_0_8

    This is not a hard limit. It doesn't mean that on the 10 001st write you will be denied, or it will not work. This number is based on a test where let us say that 99.9% of the devices were not failing at 10k cycles. It may also mean that 99.8% survived 20k cycles with no errors. (these numbers are made up. I don't have the actual results). Temperature also plays a huge role in these tests. A device running at 80 degrees celcius will on average fail faster than a device at room temperature.

    In addition, the write cycles are write -> erase. So if you do not need to erase the flash, you don't need to use a cycle. A flash address can only be written to once between each erase, and when you erase, you need to erase an entire flash page (not just a single address). So usually, you would use a flash storage system that handles flash wear (uses all the addresses, marks flash records as dirty or valid, and first when the entire flash is used up, it will trigger an erase on the old pages. Then you have one cycle. How flash management is handled in Arduino, I have no idea. You need to look it up in the Arduino documentation/forum.

    Best regards,

    Edvin

Reply
  • Hello,

    This looks like an Arduino board (and you also say that you are using Arduino IDE). If that is the case, then I am sorry to say that I don't know how either the sensor or flash writing will work. You need to reach out either to Arduino or an Arduino forum, as this is not something that we either provide, support, or have particular knowledge in.

    That being said, 

    I know that the flash has a limit of 100,000 writes,

    That is partially true. The flash on the nRF52840 has a 10.000 (not 100.000) write erase cycles, as stated here:

    https://infocenter.nordicsemi.com/topic/ps_nrf52840/abs_max_ratings.html?cp=5_0_0_8

    This is not a hard limit. It doesn't mean that on the 10 001st write you will be denied, or it will not work. This number is based on a test where let us say that 99.9% of the devices were not failing at 10k cycles. It may also mean that 99.8% survived 20k cycles with no errors. (these numbers are made up. I don't have the actual results). Temperature also plays a huge role in these tests. A device running at 80 degrees celcius will on average fail faster than a device at room temperature.

    In addition, the write cycles are write -> erase. So if you do not need to erase the flash, you don't need to use a cycle. A flash address can only be written to once between each erase, and when you erase, you need to erase an entire flash page (not just a single address). So usually, you would use a flash storage system that handles flash wear (uses all the addresses, marks flash records as dirty or valid, and first when the entire flash is used up, it will trigger an erase on the old pages. Then you have one cycle. How flash management is handled in Arduino, I have no idea. You need to look it up in the Arduino documentation/forum.

    Best regards,

    Edvin

Children
Related