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.

CC2340R5: NVS Question for basic_ble.

Part Number: CC2340R5
Other Parts Discussed in Thread: SYSCONFIG

Tool/software:

Hi teams,

I am running the basic_ble project in LP-EM-CC2340R5. I want to use NVS for some test. 

In the syscfg, the CONFIG_NVSINTERNAL was added automatically when I imported the project. Without searching the NVS_open() called in the project, I just want to use this NVS region to test. 

However, I can't open this region correctly. Please find the output below.

My NVS_init function snippet shows below.

void mine_nvs_init()
{
    NVS_init();
    NVS_Params nvsParams;
    NVS_Attrs regionAttrs;

    NVS_Params_init(&nvsParams);

    nvsHandle = NVS_open(CONFIG_NVSINTERNAL, &nvsParams);

    NVS_getAttrs(nvsHandle, &regionAttrs);

    /* Display the NVS region attributes */
    MenuModule_printf(0, 0, "Region Base Address: 0x%x",
                   regionAttrs.regionBase);
    MenuModule_printf(0, 0, "Sector Size: 0x%x",
                   regionAttrs.sectorSize);
    MenuModule_printf(0, 0, "Region Size: 0x%x\n",
                   regionAttrs.regionSize);
}

I am wondering what this CONFIG_NVSINTERNAL  uses for? And confirm whether the application is able to use the CONFIG_NVSINTERNAL.

SDK version: simplelink_lowpower_f3_sdk_8_10_01_02

Thanks!

  • Hi Connor,

    The existing internal NVS allocation is reserved for the Gap Bond Manager, although there are some NV IDs available for custom usage.  Thus the NV memory will already be initialized and used by the BLE source code.  Please see the Flash Section of the BLE5-Stack User's Guide.  If this isn't suitable for your needs then you should create a second internal NVS instance inside of SysConfig to configure and use at your leisure.

    Regards,
    Ryan

  • Thanks for your explaination. So I want to confirm the initialization of the internal NVS is not visible to the developer. Am I right? Could you share in which source code and which line the Gap Bond Manager will execute the initialization related to the existing internal NVS?

    And I have another question about the re-initialization in my provied case. What is the shown base address for? What is the proper way to detect re-open of the NVS?

  • The initialization of NVOCMP_initNvApi as used by BLE source is visible through common/Drivers/NV/nvocmp.c, you can further review how NVS APIs are called though source\ti\ble5stack_flash\osal\src\mcu\cc26xx\osal_snv_wrapper.c, and you can further copy a version of source\ti\drivers\nvs\NVSLPF3.c to your project if you'd like to further debug the NVS APIs themselves.  Then you should create a second NVS instance, since the first is handled by the BLE stack, and further debug the project to understand the contents of regionAttrs. NVSLPF3_open should return NULL if the NVS_config[index].object has already been opened previously.

    Regards,
    Ryan