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.

CC2541 osal_snv_write() function item number limitf

Hi,

I currently intend to use the on chip flash memory to store application data. But it looks like the maximum number of items I can store is 256 (0xFF). Additionally, the the system writes only to one page (2KB), even thought 2 pages are available (4KB). Here I describe my experiment.

1. Write to the fresh memory with the following code.

2. Boot the system and read the flash memory into a hex file. The following is what I get.

I get a few questions regarding this experiment.

a, Why the higher byte of the Item IDs are set to 0x00, even I wrote the IDs to be 0x01** ? That results in only 256 items can be written to the flash.

b.Why the second available page is not used.

c. I look through the source code, the beginning page number is 29. And we know the page header offset is 0. Then the calculated address is

    memory address=(offset>>2)+(page<<9) (taken from the code) = 0x3a00. Why the actual address begins at 0xF000?

Thank in advance for your input.

HQ

  • Hello HQ,

    osalSnvId_t are of type a uint8.

    Also, the 2nd page of NV is used for flash compaction. This is done for fault tolerance so that the contents are not lost if there is a power loss event during flash compaction.

    Please see the OS Abstraction Layer Application Programming Interface document (in SDK) for proper use of the osal_snv APIs.

    Best wishes

  • Thanks. I got it now. A side question, if I want to store data into an eternal flash, is there instructions or application note to follow?

    HQ