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,677件の閲覧回数
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 返答(返信)

816件の閲覧回数
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 件の賞賛
返信

816件の閲覧回数
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 件の賞賛
返信