802.15.4 MAC: Always getting errorInvalidParameter when sending a gMlmeDisassociateReq_c

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

802.15.4 MAC: Always getting errorInvalidParameter when sending a gMlmeDisassociateReq_c

1,344 次查看
MarcB
Contributor I
I'm trying to send a gMlmeDisassociateReq_c message from a device to a coordinator. Find below the function's code. This was used in a previous MAC library and was working. Now I've ported the code to the latest 802.15.4 codebase and the MSG_Send(NWK_MLME, pMsg) call always returns errorInvalidParameter.

Any ideas?

static uint8_t sendDisAssociateRequest(void) {
  mlmeMessage_t *pMsg;
  mlmeDisassociateReq_t *pAssocReq;

  /* Allocate a message for the MLME message. */
  pMsg = MSG_AllocType(mlmeMessage_t);
  if (pMsg == NULL) // Allocation of a message buffer failed. */
    return errorAllocFailed;

  /* This is a MLME-DISASSOCIATE.req command. */
  pMsg->msgType = gMlmeDisassociateReq_c;

  /* Create the disassociate request message data. */
  pAssocReq = &pMsg->msgData.disassociateReq;

  /* Use the coordinator info we got from the Active Scan. */
  FLib_MemCpy(pAssocReq->deviceAddress, aExtendedAddress, 8);
  pAssocReq->disassociateReason = 0x02; // device wishes to leave the PAN
  pAssocReq->securityEnable = FALSE;

  /* Send the Associate Request to the MLME. */
  if (MSG_Send(NWK_MLME, pMsg) == gSuccess_c)
    return errorNoError;
  else
    return errorInvalidParameter;
}

标签 (1)
0 项奖励
回复
2 回复数

483 次查看
Mads
Contributor V
Hi MarcB,
 
The problem is that you are not providing the correct extended address in the disassociate request.
You provide your own address, where you must provice the extended address of the your parent.
 
the parent address is found in the gMPibCoordExtendedAddress_c PIB.
 
BR,
Mads Westergreen
0 项奖励
回复

483 次查看
MarcB
Contributor I
Hi Mads,
This indeed did solve my problem, thanks! I guess the older version of the MAC lib did not check for this.
0 项奖励
回复