Marc Boscher

802.15.4 MAC: Always getting errorInvalidParameter when sending a gMlmeDisassociateReq_c

Discussion created by Marc Boscher on Nov 28, 2008
Latest reply on Dec 1, 2008 by Marc Boscher
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;
    return errorInvalidParameter;