LP-CC2652RB: Issues with migration from CC2530 / ZNP to CC2652RB / ZNP

Part Number: LP-CC2652RB
Other Parts Discussed in Thread: CC2530, CC2652RB

Tool/software:

Hello,

Some years ago, I wrote an app with a CC2530 and ZNP which receives Green power frames.

Setup of ZNP was pretty straigthforward : reset / setPanId / StartUpFromApp. With this, the chip will send the frames I needed.

In this sequence, setPanId was in fact ZB_WRITE_CONFIGURATION with configId 0x83 and len = 0x02. I'm not sure (it's a long time ago) but I think I firstly tried with UTIL_SET_PANID which did not work and somebody in a forum told me to use ZB_WRITE_CONFIGURATION which does the job.

Today, I need to listen to the same devices but using a CC2652RB. Here's what I did:

- I compiled ZNP by importing ZNP from simplelink examples using CCS20.10. I flashed the mint compiled firmware to the device.

- I tried to apply the same sequence : reset / set pan id using ZB_WRITE_CONFIGURATION / StartupFromApp. Here's the frames sequence:

Reset 
-> fe 01 41 00 00 40
<- fe 06 41 80 00 02 00 02 07 01 c1

Set panid
-> fe 04 26 05 83 02 0b 00 ad
<- fe 03 60 00 01 26 05 41

Startup 
-> fe 02 25 40 00 00 67
<- fe 01 65 40 00 24 fe 03 4f 80 01 02 04 cb

Initialization complete
<- fe 01 45 c0 01 85
<- fe 01 45 c0 08 8c
<- fe 01 45 c0 09 8d fe 03
<- 4f 80 00 02 00 ce

From this sequence, I can see that ZB_WRITE_CONFIGURATION answers with CMD0=0x60 and CMD1=0x00. From the documentation this response is SRSP + Reserved. What should I interpret from this?

Maybe ConfigId is different from CC2530 and CC2652RB but I didn't find documentation that describe the configuration memory map. 

I also tried with UTIL_SET_PAN_ID. Here's the sequence:

--- reset ---
-> fe 01 41 00 00 40
<- fe 06 41 80 00 02 00 02 07 01 c1

--- set panid ---
-> fe 02 27 02 0b 00 2c
<- fe 01 67 02 0a 6e

--- startup ---
-> fe 02 25 40 00 00 67
<- fe 01 65 40 00 24 fe 03 4f 80 01 02 04 cb

Initialization complete
<- fe 01 45 c0 01 85
<- fe 01 45 c0 08 8c
<- fe 01 45 c0 09 8d fe 03
<- 4f 80 00 02 00 ce

WIth this sequence the answer to UTIL_SET_PANID is CMD0=0x76, CMD1=0x02, Status=0x0A. The documentation states that Status can be 0(success) or 1 (failure) so 0x0A is not a valid answer.

  • Follow up.

    - What's wrong with what I did?

    - Did I build ZNP the right way?

    - What about the invalid return codes?

    - Anything that sounds weird?

    I forgot to say that I'm using LP_CC2652RB eval board.

    Thanks for your attention

    Julien

  • Hello Julien,

    Here is the TI Z-Stack Monitor and Test API for easy reference.

    The MT SAPI (Simple API) layer is no longer supported for SimpleLink F2 devices, hence the errors you are receiving.  I believe you've built the ZNP correctly since the firmware is indeed responding (be sure to factory reset or erase all memory before reprogramming to remove previous NV flash memory).  You just need to migrate your host code to support the correct API set. 

    UTIL_SET_PANID should be identical as before.  One difference is that the status value is reflective of the osal_nv_write return value.

    static void MT_UtilSetPanID(uint8_t *pBuf)
    {
      uint16_t temp16;
      uint8_t retValue;
      uint8_t cmdId;
    
      /* parse header */
      cmdId = pBuf[MT_RPC_POS_CMD1];
      pBuf += MT_RPC_FRAME_HDR_SZ;
    
      temp16 = OsalPort_buildUint16( pBuf );
    
      retValue = osal_nv_write(ZCD_NV_PANID, osal_nv_item_len( ZCD_NV_PANID ), &temp16);
    
      /* Build and send back the response */
      MT_BuildAndSendZToolResponse(((uint8_t)MT_RPC_CMD_SRSP | (uint8_t)MT_RPC_SYS_UTIL), cmdId, 1, &retValue);
    }
    

    osal_nv_write(_ex) will return NV_OPER_FAILED (0x0A) if not SUCCESS or NV_ITEM_UNINIT, which doesn't 

    uint8_t osal_nv_write_ex( uint16_t id, uint16_t subId, uint16_t len, void *buf )
    {
      uint8_t rtrn = SUCCESS;
      uint8_t status;
    
      if ( pZStackCfg && pZStackCfg->nvFps.updateItem )
      {
        NVINTF_itemID_t nvId;
    
        nvId.systemID = NVINTF_SYSID_ZSTACK;
        nvId.itemID = (uint16_t)id;
        nvId.subID = (uint16_t)subId;
    
        status = pZStackCfg->nvFps.updateItem( nvId, len, buf );
    
        if(status == NVINTF_SUCCESS)
        {
            rtrn = SUCCESS;
        }
        else if(status == NVINTF_NOTFOUND)
        {
            rtrn = NV_ITEM_UNINIT;
        }
        else
        {
            rtrn = NV_OPER_FAILED;
        }
      }
    
      return rtrn;
    }

    Here is the updateItem API

    static uint8_t NVOCMP_updateItemApi(NVINTF_itemID_t id, uint32_t len, void *pBuf)
    {
        uint8_t err;
        NVOCMP_itemHdr_t iHdr;
    
        // Parameter Sanity Check
        if (pBuf == NULL || len == 0)
        {
            return(NVINTF_BADPARAM);
        }
    
        err = NVOCMP_checkItem(&id, len, &iHdr, NVOCMP_FINDSTRICT);
        if(err)
        {
          return(err);
        }
    
        // Check voltage if possible
        NVOCMP_FLASHACCESS(err)
        if(err)
        {
          return(err);
        }
    
        // Prevent RTOS thread contention
        NVOCMP_LOCK();
    
        err = NVOCMP_findItem(&NVOCMP_nvHandle, NVOCMP_nvHandle.actPage, NVOCMP_nvHandle.actOffset, &iHdr,
                              NVOCMP_FINDSTRICT, NULL);
    
        if(err == NVINTF_SUCCESS)
        {
          // Create the new item
          err = NVOCMP_addItem(&NVOCMP_nvHandle, &iHdr, pBuf, NVOCMP_UPDATE);
          if((err == NVINTF_SUCCESS) && (iHdr.hofs > 0))
          {
              // Mark old item as inactive
              NVOCMP_setItemInactive(&NVOCMP_nvHandle, iHdr.hpage, iHdr.hofs);
    
              err = NVOCMP_failW;
          }
        }
        else if(err == NVINTF_NOTFOUND)
        {
          err = NVINTF_NOTFOUND;
        }
        else
        {
          NVOCMP_ALERT(false, "updateItem failed.")
          err = NVINTF_FAILURE;
        }
    
    #ifdef NV_LINUX
        if(err == NVINTF_SUCCESS)
        {
            NV_LINUX_save();
        }
    #endif
    
        NVOCMP_UNLOCK(err);
    }

    You can further debug these functions if CCS if you wanted.  Although I believe using SYS_OSAL_NV_WRITE with an Id of 0x0083 (ZCD_NV_PANID), offset 0, len 2, and value of your PanID should be just as effective.  Take heed to erase NV memory as I described earlier. here is a blog which covers how that can be accomplished.

    Regards,
    Ryan