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.

RTOS/CC2650MODA: The functions "osal_snv_read" and "osal_snv_write" don't work correctely.

Part Number: CC2650MODA
Other Parts Discussed in Thread: CC2650

Tool/software: TI-RTOS

Hi, everyone,

I have the CC2650MODA module and CC2650 LaunchPad  with CC2650F128RGZ  IC for developing the projects. 

I need to use the internal flash memory to store the calibration and advertising data. I loocked to the manual ( from this link www.ti.com/.../swru393 ) and read about the functions uint8 osal_snv_read( osalSnvId_t id, osalSnvLen_t len, void *pBuf) and uint8 osal_snv_write( osalSnvId_t id, osalSnvLen_t len, void *pBuf) that were mentioned in the paragraph 3.10.3. But from the manual I couldn't understand how to use them:

1. What is the first parameter osalSnvId_t id? what data must it have? Is this data the address in the flash memory? If so why is it given as 8-bit value? - the value that can't be neither global nor a local at the page. And if this parameter is not the address in the memory what can it be else?

2. In the example on this manal this parameter (osalSnvId_t id) is given as the value 0x80 why this value cannot be for example 0x00?

3. These unctions doen't write the data correctely. If I store the data it is reread incorrectely. Even more when I tried to loock this data by the flash programmer  It was fragmented that means thet the part of the data is stored at the beginning and the part at the middle of the used fragment.

4. When I try to save the data during the program run (after the calibration) the function "osal_snv_write" gives me the error 0x02: INVALIDPARAMETER and not 0x0A: NV_OPER_FAILED as written in the manual.

what does this error INVALIDPARAMETER mean? the osalSnvId_t id is given 0x80 as in the example.

Thanks for payin attention

Best regards

Boris Fridman

  • Hi Boris,

    Please see the Software Developer's Guide section on Using SNV for Flash Storage: software-dl.ti.com/.../platform.html
  • Hi, Marie H,

    I have loocked this manual, but it contains the same information as the link about which I had asked. Can you or anyone else ask the questions or give any other manual where the answers are given?

    Best regards

    Boris Fridman

  • Boris everything you need to know is in that manual but here is the overview:

    For your application, the Ti people have left 16 256 byte blocks for you to write stuff in.

    The osal_ functions handle all the things you need to make flash work i.e. moving stuff around so that you don't keep hitting the same bit of flash etc.

    The "ID"  being passed in is basically a handle to one of the 16 pre-allocated blocks you can write stuff to.

    The definitions for the ID's are in bcomdef.h

    // Customer NV Items - Range 0x80 - 0x8F - This must match the number of Bonding entries
    #define BLE_NVID_CUST_START 0x80 //!< Start of the Customer's NV IDs
    #define BLE_NVID_CUST_END 0x8F //!< End of the Customer's NV IDs

    So if you want to write to the first user accessable block, your call looks like:

    (note - pseudo code)

    uint8_t[] mybuffer = { 0 };

    if (SUCCESS == osal_snv_read(0x80,sizeof(mybuffer),&mybuffer))

    { // i read a thing }

    else

    {

    // I did not read

    }

    Make sure mybuffer is smaller than 256 and you are good to go.  Be aware that the functions are in the BLE stack hidden behind the ICall interface so ICall has to be initialised before you try to use them (i.e. do it in application level code in your application thread rather than trying to do it when the main function starts).

  • Hi, David Rubie,
    Thank you very much!
    Your answer halped me.

    Best regards
    Boris Fridman