This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Writing/reading data to external flash on the nRF9160DK

Hello Nordic!

I have connected a sensor to the DK via SPI. It outputs a lot of data, a lot... for 1 second of data I get 4096 entries. Each entry is 10 bytes in length.


I want to store 20 seconds of sensor data on the flash memory, that is a total of about 0,8 MB if my calculations are correct.

The sensor has a FIFO-queue so if the write operation is quick enough there shouldn't be any data loss.
Once 20 seconds worth of data is recorded I then want to send this via LTE to server, I'm guessing in chunks.

Questions:
* How do I go about this? Is there a binary write example available?

* What size should the chunks be for this example?

* Once a file is written and done, before going in to the LTE-part of the design, is there any way to extract the bin file for data validation from the DK?


Thank you!

  • Hi,

     

    Here's a modified littlefs sample, with nrf9160dk ext flash support:

    ncs1_7_nrf9160dk_ext_flash_littlefs.zip

     

    Kind regards,

    Håkon

  • Thanks Håkon, I tried the sample but having trouble with the SPI-bus. "Node should only occur on the spi bus", I'm guessing that occurs because the sample you sent does not have a

    Fullscreen
    1
    compatible = "nordic,nrf-spim";
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


    If I do include that, I instead get these errors:



    Thank you for all the help, you are my Gandalf in Moria.


  • Hi,

     

    The "compatible" member shall be inherited from the board itself, ie. this line:

    https://github.com/nrfconnect/sdk-zephyr/blob/main/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160_common.dts#L197

     

    Which board are you configuring for? It should be the "nrf9160dk_nrf9160_ns" board.

     

    PS: remember to delete any ancient build folders, especially when editing static partition layout.

     

    Kind regards,

    Håkon

  • Yes, building for the "nrf9160dk_nrf9160_ns" board. Using the sample with the correct board setup I still get the same errors I posted above. Are you able to run the sample without any mods on nrf9160dk? If that's the case I might need to do a reset. Thanks again, appreciate it.

    Edit: The reset helped, I must have written something goofy somewhere. Thanks Håkon, you the man. I'll buy you a beer if you ever come to Gothenburg.

1 2 3 4