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.

Non volatile memory reading and writing question

Other Parts Discussed in Thread: CC2540

Dear TI employees and forum members,

I am currently using cc2540 and smartRF05 to test the non volatile writing and reading, and the stack I am using is BLE-CC254x-1.4.1.43908.

According to the manual (OSAL API), I make use of two APIs,

uint8 osal_snv_write( osalSnvId_t id, osalSnvLen_t len, void *pBuf );

uint8 osal_snv_read( osalSnvId_t id, osalSnvLen_t len, void *pBuf );

 

However, I have found that the read function has to be called only after write function has been already called, once a new programme is flashed. Otherwise, the read function returns back NV_OPER_FAILED.

 

So my question is:

1. Is this normal?Why does this happen?

2. Once a new programme is flashed, every single memory is erased and reprogrammed, including the non volatile memory? Can we avoid the non volatile memory from being flashed also?

 

Thanks so much for your reading.

  • Hi,

    I am not sure, but this sounds logical. If nothing is written on memory, which is associated with the ID you are using, i.e. it is in erased state, then there is no point in reading that memory. Thus you first need to write something.

    Thanks,
    Dhaval
  • Hi Dhaval,

    Thanks for your prompt reply.

    The objective of using this NV memory is that we want to store data persistently, meaning we want to keep the data in this NV memory even we reset or reprogramme it. Then next time we run this programme, the data can be retrieved and used.

    However, if I cannot read it unless I overwrite it first, then there is no point using the NV memory, I can directly use a variable instead.

    I think I got something wrong, but I dunno where.

    Thanks,
    HJ
  • Anyone can offer help please?
  • Hi HJ,

    Yes, the NV memory serve the purpose you are looking for. It will store the data persistently even after reset the device. But it won't keep the data after reprogram it. As the NV memory is part of On-Chip Flash memory and while reprogramming it will overwrite that memory.

    To keep the certain part of the memory intact, you need to customize the programmer.

    Hope this helps!

    Thanks,

    Dhaval

    Note: You may like to click on 'Verify Answer', if this has answered your question.

  • Dear Dhval,

    Thanks for your kindly help.

    Best regards,
    HJ