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 - Store data in Non-volatile memory

Hi,

I am using CC2541f256.

I want to store my application data in non-volatile memory

I tried to use osal_snv_write() and osal_snv_read() function but it doesn't work.

My code is like this : 

First I had written data in memory as shown below 

Flash_Data[0] = 0x53;
Flash_Data[1] = 0x4D;
Flash_Data[2] = 0x49;
Flash_Data[3] = 0x54;
 VOID osal_snv_write( 0x83, 4 , Flash_Data );
 VOID osal_snv_read( 0x83, sizeof( uint32 ), Flash_Data );

after writing data , if i read it i am getting correct value .

Now i reset the system and commented VOID osal_snv_write( 0x83, 4 , Flash_Data ) function 

so my code is like this 

VOID osal_snv_read( 0x83, sizeof( uint32 ), Flash_Data );

but i getting all 0x00 instead of 0x53,0x4D,0x49,0x54

can anyone tell me how to write data in NV memory ? 

  • Hello smitesh,

    You are doing it the correct way.  When you reprogrammed the chip to make your change, you also erase ALL the flash memory.

    If you want to prevent your data from being erased, you will have to write protect that block of flash memory.  The only way I have seen to do this is to use the Flash Progrmmer from TI and write protect that block of memory.  You can search the forum, there may be a way to do it through code.

    The SmartRF Flash Programer Guide can be found here: http://www.ti.com/lit/ug/swru069f/swru069f.pdf

    Thanks,