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.

CC2651P3: Bad pointer in zstackmsg_CmdIDs_ZDO_DEVICE_ANNOUNCE

Part Number: CC2651P3

I am trying to subscribe to ZDO_DEVICE_ANNOUNCE to receive the nwk and IEEE address of devices when they send the announce message. I am using zc_sampleapp_LP_CC2651P3_tirtos7_ticlang (simplelink_cc13xx_cc26xx_sdk_6_41_00_17). I receiving a bad pointer from the callback.

I have subscribed with this:
zdoCBReq.has_deviceAnnounce = true;
zdoCBReq.deviceAnnounce = true;
(void)Zstackapi_DevZDOCBReq(sampleApp_serviceTaskId, &zdoCBReq);

The handler is here:
static void sampleApp_processZStackMsgs(zstackmsg_genericReq_t *pMsg)
{
  switch(pMsg->hdr.event)
  {
    case zstackmsg_CmdIDs_ZDO_DEVICE_ANNOUNCE:
    {
      zstackmsg_zdoDeviceAnnounceReq_t *pReq = (zstackmsg_zdoDeviceAnnounceReq_t *)pMsg;
      processDeviceAnnounce(pReq->pReq);
    }
    break;

I have set a breakpoint at the processDeviceAnnounce() line. When I join a new device to the network, it sends Device Announce and then the breakpoint is triggered. Using the debugger, I look at pMsg. pMsg is a valid pointer.

This is the pMsg struct definition:
typedef struct _zstackmsg_genericreq_t
{
  /** message header<br>
  * event field must be set to @ref zstack_CmdIDs
  */
  zstackmsg_HDR_t hdr;

  /** Message command fields */
  void *pReq;

} zstackmsg_genericReq_t;

with

typedef struct _zstackmsg_HDR_t
{
  /** event */
  uint8_t event;
  /** Will hold the default response status field. */
  uint8_t status;
#ifdef OSAL_PORT2TIRTOS
  uint8_t srcServiceTask;
#endif
} zstackmsg_HDR_t;

These are the values observed using the debugger:
pMsg->hdr.event           0x48
pMsg->hdr.status          0
pMsg->hdr.srcServiceTask  0
pMsg->pReq                0x515D515D

0x515D515D is not a valid RAM address. In CC2651 RAM starts at 0x20000000.

The value 0x515D515D is not consistent. For example, in 3 attempts I saw 0x515D515D, 0x2A0B2A0B, and 0x5E735E73.

Thanks,
Andy

  • Hi Andy,

    zstackmsg_zdoDeviceAnnounceReq_t is not the correct structure for zstackmsg_CmdIDs_ZDO_DEVICE_ANNOUNCE messages, please use zstackmsg_zdoDeviceAnnounceInd_t instead.  This is demonstrated by the application example's code (i.e. light/sw) as well as the Zigbee Fundamentals SimpleLink Academy Lab.  You can also refer to the Z-Stack API Guide.  

    Regards,
    Ryan

  • Hi Ryan,

    OK, I see the problem is I was referencing zstackapi.h which specifies the use of zstackmsg_zdoDeviceAnnounceReq_t:

    ZStack Indications (callbacks)
    ============================
    The following messages will be delivered to your application through an
    OsalPort message after you register at least one endpoint with
    Zstackapi_AfRegisterReq(), you must call Zstackapi_freeIndMsg() to
    free the message when you are done processing:
    <BR>

    - zstackmsg_CmdIDs_AF_DATA_CONFIRM_IND - [zstackmsg_afDataConfirmInd_t]
    (@ref _zstackmsg_afdataconfirmind_t)
    - zstackmsg_CmdIDs_AF_INCOMING_MSG_IND - [zstackmsg_afIncomingMsgInd_t]
    (@ref _zstackmsg_afincomingmsgind_t)

    The following messages will be delivered to your application through an
    OsalPort message after you request them by setting the correct fields
    (has and flag) to 'true' in
    [zstack_devZDOCBReq_t](@ref _zstack_devzdocbreq_t) and calling
    Zstackapi_DevZDOCBReq(), you must call Zstackapi_freeIndMsg() to
    free the message when you are done processing:
    <BR>

    - zstackmsg_CmdIDs_ZDO_DEVICE_ANNOUNCE - [zstackmsg_zdoDeviceAnnounceReq_t]
    (@ref _zstackmsg_zdodeviceannouncereq_t)
    - zstackmsg_CmdIDs_ZDO_NWK_ADDR_RSP - [zstackmsg_zdoNwkAddrRspInd_t]
    (@ref _zstackmsg_zdonwkaddrrspind_t)
    - zstackmsg_CmdIDs_ZDO_IEEE_ADDR_RSP - [zstackmsg_zdoIeeeAddrRspInd_t]
    (@ref _zstackmsg_zdoieeeaddrrspind_t)
    - zstackmsg_CmdIDs_ZDO_NODE_DESC_RSP - [zstackmsg_zdoNodeDescRspInd_t]
    (@ref _zstackmsg_zdonodedescrspind_t)
    - zstackmsg_CmdIDs_ZDO_POWER_DESC_RSP - [zstackmsg_zdoPowerDescRspInd_t]
    (@ref _zstackmsg_zdopowerdescrspind_t)

    Thanks,
    Andy