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

How to write a text file to external onboard memory of 64Mb on nrf52840 PDK?

Hi Everyone 

I am able to write and read to and from QSPI memory interfaced with nrf52840 PDK.

I am using Segger Embedded Studio with sdk15.0.

I want to create a text file and store the text file inside the external memory.

Does segger allow File creation and writing ?

If yes, How can i achieve the requirements?

Thanks 

Rajat!

Parents
  • Create a new section in the XiP memory space and use nrfjprog to flash. 

  • Thanks for quick response!

    But i don't really have a idea of how to create a new section in XiP memory space.

    Can you provide me some hints or some source?

    Thanks 

    Rajat

  • qspi - ext_mem_linker.zip
    I've build an example where i've defined a 100kB array in a source file (blob.c) and placed it in the XiP memory space.

    I've added a section I've called '.xip_section' to the file called flash_placement.xml (same folder as the SES project file). 

    The source file is then placed in the wanted section by right-clicking the source file -> Edit Options -> Change scope from debug or release to Common -> section -> Constant section name-> ".xip_section"

    If you want to store other data types in the .xip_section you need to change the other fields to ".xip_section" as well. After you have change all the section fields to .xip_section anything that is defined inside the source file will now be placed inside the XiP memory space of the generated hex file. 

    The J-link drivers does not support writing to external flash yet, so you'll have to use nrfjprog. See Programming nRF5x SoCs with nrfjprog.


    See also nRF52840 Memory map.

  • Hi

    Thanks for your time!

    I think there is some misunderstanding.

    I will try to explain once more.

    This is what i want to achieve.

    I want to create a txt file ,lets say "TEST.txt" in which i want to write some sensor data , say a temperature sensor.

    This file i want to store in the external QSPI memory present on the nrf52840 PDK.

    What i have read about XiP is Execute in Place which says that we can execute the program directly from external memory by placing the program in that memory.

    This is not what i want to achieve.

    I want a log kind of file which will log all the sensor values in a txt file and store the file inside the QSPI memory.

    Thanks !

    Rajat

  • You can use the XiP memory space to store your sensor data, it's not just for code execution. 

    The advantage of using XiP memory space is that it is integrated with the rest of your FW and the CPU have access to the QSPI as it was internal memory. That means that you should be able to move your sensor buffers into the QSPI memory with a memcpy from main. 

    If you want a text file you need to generate strings out of the samples before moving them to qspi memory. Use sprintf() to generate the log strings. 

Reply
  • You can use the XiP memory space to store your sensor data, it's not just for code execution. 

    The advantage of using XiP memory space is that it is integrated with the rest of your FW and the CPU have access to the QSPI as it was internal memory. That means that you should be able to move your sensor buffers into the QSPI memory with a memcpy from main. 

    If you want a text file you need to generate strings out of the samples before moving them to qspi memory. Use sprintf() to generate the log strings. 

Children
No Data
Related