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/LAUNCHXL-CC1352R1: Question for ZED Examples. Does these use NVS External driver?

Part Number: LAUNCHXL-CC1352R1
Other Parts Discussed in Thread: SYSCONFIG, Z-STACK

Tool/software: Code Composer Studio

Hi TI Support Team,

I am curious on how ZED Example store non volatile information. Does this use external driver? 

But when I tried to find any instances of the variable CONFIG_NVSEXTERNAL that is defined in sysconfig. I can't find any.

Regards,

Jonathan

  • Hi Jonathan,

    CONFIG_NVSEXTERNAL is specifically used for interfacing with the MX25R8035 external flash memory device for the purposes of storing OTA download images. http://dev.ti.com/tirex/content/simplelink_cc13x2_26x2_sdk_3_40_00_02/docs/zigbee/html/zigbee-guide/oad-secure-index.html 

    You can refer to NV_INIT, NV_RESTORE, osal_nv.c/h, nvocmp.c/h, nvintf.h, zcomdef.h, zd_app.c, and zd_sec_mgr.c for information regarding how non-volatile information is stored.  http://dev.ti.com/tirex/content/simplelink_cc13x2_26x2_sdk_3_40_00_02/docs/zigbee/html/zigbee/z-stack-overview.html#non-volatile-memory-items 

    Regards,
    Ryan

  • Hi Ryan,

    Thank you for your great response. The link that you gave really helped me understand on how NVS Drivers being used on zstack examples.

    By the way I have one last question, as I dig into the use of NVS Driver in zed example, I am curious on where the values of NVOCMP_NVS_INDEX being derived? By default it has a value of 0. Does this mean it is using internal flash, and if I set it to 1, will it use external flash?

    Regards,

    Jonathan

  • Hi Jonathan,

    No, NVOCMP_NVS_INDEX controls which NVS_config indice is used to initialize the NVS.  External flash is only purposed for OTA download images and does not pertain to the NV flash memory operation of Z-Stack.  I understand that this is confusing given the acronyms and naming conventions used.

    Regards,
    Ryan

  • Hi Ryan, 

    Sorry for the late response, I just got back on this task of mine to solve the issue with NVS _Flash.

    I am a little bit confused, because in nvs_external examples, the first parameter of the nvs_open() is the name of instance of nvs external flash in the sysconfig.

    bool flash_open(void)
    {
        if (!isOpen)
        {
            nvsHandle = NVS_open(Board_NVSEXTERNAL, &nvsParams);
            if (nvsHandle != NULL)
            {
                isOpen = true;
                // Also read the region's attribute
                NVS_getAttrs(nvsHandle, &regionAttrs);
            }
        }
    
        return (isOpen);
    }

    But how come that in zstack example, it was used in different way? instead of using nvs external/internal instances from sysconfig in its first parameter, it uses NVOCMP_NVS_INDEX instead?

  • Hi Jonathan,

    This is just the name of the NVS instance, as described in SysConfig: This name is declared in the generated ti_drivers_config.h file so applications can reference this instance symbolically. Additionally, this name is used to declare an 'extern const' which allows libraries to define symbolic names for required driver configurations without needing to rebuild library source files. The 'const' identifier is declared as the same name with a _CONSTsuffix. The name can be set to any globally unique name that is also a valid C/C++ identifier.

    Regardless, either are defined as zero to be used as index for NVS_open

    /*!
     *  @brief  Open an NVS region for reading and writing.
     *
     *  @pre    NVS_init() was called.
     *
     *  @param  index         Index in the #NVS_Config table of the region
     *                        to manage.
     *
     *  @param  params        Pointer to a parameter region.  If NULL, default
     *                        parameter values will be used.
     *
     *  @return  A non-zero handle on success, else NULL.
     */
    extern NVS_Handle NVS_open(uint_least8_t index, NVS_Params *params);

    Regards,
    Ryan