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.

CCS/CC1352R: How to use osal_snv from user application

Part Number: CC1352R

Tool/software: Code Composer Studio

Hy,

in my CC1352 I need to persist some values. I want to use osal_snv to use internal flash to do so. Does that sound OK?

I read the user manual and tried the following:

In my source code I included

#include <Drivers/nv/nvintf.h>
#include "osal_snv.h"

Then I defined some snv IDs:

#define BLE_NVID_CUST_VL53SETTINGS   0x80
#define BLE_NVID_CUST_TIMING         0x81
#define BLE_NVID_CUST_CALIBDATA      0x82

During start up from function RemoteDisplay_init after ICall_registerApp I call

    uint8_t status;

    status = osal_snv_read(BLE_NVID_CUST_TIMING, sizeof(ttimingSettings), timingSettings);
    if (NVINTF_SUCCESS != status )
    {
        memcpy(timingSettings, &defaultTimingSettings, sizeof(ttimingSettings));
    }

When I try this, osal_snv_read always returns not NVINTF_SUCCESS, which is clear because I have never written any data into SNV.

But then I try to write data by calling

osal_snv_write(BLE_NVID_CUST_TIMING, 20, timingSettings)

This function also returns NVINTF_FAILURE and no data is written to flash.

I tried several project settings, at the moment I have

-DOSAL_SNV=2

in my .opts file of the application, also in the opts file of the stack library.

osal_snv_init seems to get called somewhere, at least nvFptrs is filled:

Any hints? Any help appreciated.

Regards

Harald

  • Hi Harald,
    Assigning this internally for follow-up.
  • Hi,

    Which SDK version is this, and can it be reproduced on an out of the box example?

    osal_snv, at least with BLE projects is only used via ICall, which means you'd want to include icall_ble_api.h instead of the actual header file osal_svn.h and company.

    The below seemed to work for me, sdk 3.10 for 13x2/26x2, dmm_154sensor_remote_display_app, remote_display.c;

    // No extra include statements
    
    volatile uint32_t myNiceValue = 0x2;
    static void RemoteDisplay_init(void)
    {
      // ...
      ICall_registerApp(&selfEntity, &syncEvent);
      // ...
      if(0 != osal_snv_read(0x80, sizeof(myNiceValue), &myNiceValue))
      {
          uint32_t defaultValue = 0xABBABEEF;
          osal_snv_write(0x80, sizeof(defaultValue), &defaultValue);
      }
    // ...
    

    First boot I get 2 as the value in that global, next boot I got ABBABEEF.

    Best regards,
    Aslak