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

Difference between the libraries of littlefs and nvs

Hi,

I want to use flash area of nrf9160. To do it, I have created simple example using predefined samples on zepyhr project. My goal is to write a data to flash and read it. To write data, I'm using the following scripts which I found that https://devzone.nordicsemi.com/f/nordic-q-a/27428/read-and-write-specific-flash-pages-from-a-computer

I have a little bit confused about using flash area. According to my research, I can use littlefs and nvs. Both are supported by zephyr. But, which one is more useful for my goal? My data is approximately 300KB and it will be the format of ZIP. 

  • I can see in this ticket that you are planning to read and write to flash by using pynrjfprog (read and write flash from the computer). Have you discarded the methods for reading/writing flash directly from the chip, like littlefs and nvs? It would be nice to know what your end goal is, then I could advise you on how to go about this. Are you planning to access the data from the chip, or are you just using it for storage?

    Best regards,

    Simon

  • Thanks for your answer. Actually, I'm planning to access data from the chip. Not just for storage.

  • It would be nice with some more clarification. What are you going to store in the ZIP file and what are you going to do with that data? The reason I am asking is that this information is needed in order to give you the best recommendations on how to go about this.

    Feel free to make the ticket private if you are going to share any confidential information.

    Best regards,

    Simon

  • Of course, I can give more details about work. My main work is the following:

    1) Download the firmware for nrf52 from Internet. The format of this firmware will be ZIP. While this firmware belongs to nrf52, it will be stored on nrf91. 

    2) After storing this ZIP, the second step is sending the firmware to nrf52 through UART. I have achieved it for basic data like char array. In addition, I created post about this issue before. You may want to read it also: https://devzone.nordicsemi.com/f/nordic-q-a/58636/sending-data-larger-than-ram-through-uart

    3) After taking firmware through UART, I want to update it using DFU in nRF52.

    Now, I'm at the first step which is storing data on nrf91. Do you have suggestion for my work and issues?

  • Okay, thanks for the detailed explanation.

    Regarding the DFU, I am not sure how to go about it as this is not my area of expertise, but I will try to present what I currently know. I will read more about this and update the thread when I get a better overview.

    → If you want to perform a DFU from the nRF9160 to an nRF52 through a serial link, the approach depends on the SDK you are using with the nRF52.

    • If you are using the nRF5 SDK on the nRF52, you need to perform the DFU according to the Serial DFU protocol. Check out the DFU Bootloader blog and section 6. DFU Master code
    • If you are using NCS/Zephyr on the nRF52, you need to do the following:
      • On the nR52, you need to implement MCUBoot and the application with SMP support.
      • On the nRF9160, you need to implement the mcumgr library and transfer the image to the nRF52 over SMP 
      • The SMP instance on the nRF52 will then receive the firmware and save it in flash. The MCUBoot will then execute it
      • (Take a look at the Device Management section in the Zephyr Documentation as well.)

    → Regarding the storage, I'll come back to you about this.

    Best regards,

    Simon

Related