802.15.4 MAC: Always getting errorInvalidParameter when sending a gMlmeDisassociateReq_c

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

802.15.4 MAC: Always getting errorInvalidParameter when sending a gMlmeDisassociateReq_c

1,679 Views
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;
}

Labels (1)
0 Kudos
Reply
2 Replies

818 Views
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 Kudos
Reply

818 Views
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 Kudos
Reply