This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Store 30kbyte data in flash cc2541

Other Parts Discussed in Thread: CC2541

Hi,

I have a big array and i need to store around 30Kbyte data in flash and it should be modifiable. Right now i am using "const" keyword to store data in flash but problem is that i can't modify this data since it is constant and read only. Can anyone please suggest me how can i store such long data in flash which can be modifiable? I am using 256Kbyte cc2541 module.

In response to above doubt i had got following suggestion but i don't know how can i implement it.

"If you want to record more, you will need to modify the linker file so that one or two or more banks are not used by IAR, and then manually take control of these pages/banks using HalFlashRead/HalFlashWrite. You can then not access/read the arrays in the same manner as a const array."

My doubt is how can i modify linker file so that one or two bank will not be used by IAR while compiling.

Will i be able to store modifiable variable in that case?

  • Hello Kumar,
    Check out this thread:
    e2e.ti.com/.../397392
  • I would suggest you to use API osal_snv_write to write data to flash. By the way, I would suggest you to add an EEPROM for storage in case you have to write flash too often and cause damage to NV flash.
  • Thanks Eirik for your reply.
    I will check it and see if i am able to read and write. But as Yikai Chen has suggested its not good idea to use flash for frequent writing and reading, i will have to drop this idea as I need to read and write frequently.
  • Thanks Yikai Chen for your reply,
    As you have suggested its not good to write to flash too frequent, i will have to leave this idea. Already i am using external flash in my application. I have to receive around 500KB data through BLE and store in flash. I was thinking i will first store 30KB in internal flash and then transfer later to external flash at once. This will take extra time too due to increased process (writing to internal flash,reading from internal flash and finally writing to external flash). So i think it not good idea to use internal flash to store data. Directly i will store in external flash.
  • If you already have external flash, I suggest you to store data directly to it. There is no need to store data to internal flash and move data to external flash later.
  • Ya I am also thinking same. By the way if i want to store it some data to flash for some other purpose so where the data will be stored? As you have suggested to use API osal_snv_write to write data to flash but this API doesn't take any parameter for address where to store then how can i write and read?
    1)Will some valid NV id as reference be enough to store data?
    2)Will i be able to store 30KB data using this?
    3)Do i need to modify as Eirik has suggested post to refer to?
  • 1. The NV Item numbers available for customers ranges from 0x80 to 0FE.
    2.&3. Since you already have external flash, just forget trying to store 30K bytes data with osal_snv_write.

  • Ya that's good idea but even after using external flash, i am running out of available space in my external flash. Right now i have no plan to increase my flash size. If needed in future i would have saved data in internal flash which would be around 3-4 blocks of around 8K Bytes each. These data will be written just once but may be read around 10-20 times a day.
    Can you please clarify which developer guide you are referring to? There is no section available in software developer guide

  • Sorry, I give the wrong information. The correct NV ID range is from 0x80 to 0xFE, which is describe in Chapter 11. Simple Non-Volatile Memory API of OSAL API.pdf under C:\Texas Instruments\BLE-CC254x-1.4.0\Documents\osal.
  • Thanks for your useful information. i will try and check if i can read and write flash. but there is no more information about address where it will store and how much data can be stored.