Nicolas,
this is the expected behaviour in the demo example code.
If you examine the 802.15.4 spec you will see that you need to do something special to NOT change the address.
Also if you examine the source code of the function that handles the associate procedure you will see the answer to your question (marked with bold):
Code:
static uint8_t App_SendAssociateResponse(nwkMessage_t *pMsgIn){ mlmeMessage_t *pMsg; mlmeAssociateRes_t *pAssocRes; UartUtil_Print("Sending the MLME-Associate Response message to the MAC...", gAllowToBlock_d); /* Allocate a message for the MLME */ pMsg = MSG_AllocType(mlmeMessage_t); if(pMsg != NULL) { /* This is a MLME-ASSOCIATE.res command */ pMsg->msgType = gMlmeAssociateRes_c; /* Create the Associate response message data. */ pAssocRes = &pMsg->msgData.associateRes; /* Assign a short address to the device. In this example we simply choose 0x0001. Though, all devices and coordinators in a PAN must have different short addresses. However, if a device do not want to use short addresses at all in the PAN, a short address of 0xFFFE must be assigned to it. */ if(pMsgIn->msgData.associateInd.capabilityInfo & gCapInfoAllocAddr_c) { /* Assign a unique short address less than 0xfffe if the device requests so. */ pAssocRes->assocShortAddress[0] = 0x01; pAssocRes->assocShortAddress[1] = 0x00; } else { /* A short address of 0xfffe means that the device is granted access to the PAN (Associate successful) but that long addressing is used.*/ pAssocRes->assocShortAddress[0] = 0xFE; pAssocRes->assocShortAddress[1] = 0xFF; } /* Get the 64 bit address of the device requesting association. */ FLib_MemCpy(pAssocRes->deviceAddress, pMsgIn->msgData.associateInd.deviceAddress, 8); /* Association granted. May also be gPanAtCapacity_c or gPanAccessDenied_c. */ pAssocRes->status = gSuccess_c; /* Do not use security */ pAssocRes->securityEnable = FALSE; /* Save device info. */ FLib_MemCpy(maDeviceShortAddress, pAssocRes->assocShortAddress, 2); FLib_MemCpy(maDeviceLongAddress, pAssocRes->deviceAddress, 8); /* Send the Associate Response to the MLME. */ if(MSG_Send(NWK_MLME, pMsg) == gSuccess_c) { UartUtil_Print("Done\n\r", gAllowToBlock_d); return errorNoError; } else { /* One or more parameters in the message were invalid. */ UartUtil_Print("Invalid parameter!\n\r", gAllowToBlock_d); return errorInvalidParameter; } } else { /* Allocation of a message buffer failed. */ UartUtil_Print("Message allocation failed!\n\r", gAllowToBlock_d); return errorAllocFailed; }}
So what you need to do is to change the end device to NOT request an address.
I have marked the line with bold that you need to change:
Code:
static uint8_t App_SendAssociateRequest(void){ mlmeMessage_t *pMsg; mlmeAssociateReq_t *pAssocReq; UartUtil_Print("Sending the MLME-Associate Request message to the MAC...", gAllowToBlock_d); /* Allocate a message for the MLME message. */ pMsg = MSG_AllocType(mlmeMessage_t); if(pMsg != NULL) { /* This is a MLME-ASSOCIATE.req command. */ pMsg->msgType = gMlmeAssociateReq_c; /* Create the Associate request message data. */ pAssocReq = &pMsg->msgData.associateReq; /* Use the coordinator info we got from the Active Scan. */ FLib_MemCpy(pAssocReq->coordAddress, mCoordInfo.coordAddress, 8); FLib_MemCpy(pAssocReq->coordPanId, mCoordInfo.coordPanId, 2); pAssocReq->coordAddrMode = mCoordInfo.coordAddrMode; pAssocReq->logicalChannel = mCoordInfo.logicalChannel; pAssocReq->securityEnable = FALSE; /* We want the coordinator to assign a short address to us. */ pAssocReq->capabilityInfo = gCapInfoAllocAddr_c; /* Send the Associate Request to the MLME. */ if(MSG_Send(NWK_MLME, pMsg) == gSuccess_c) { UartUtil_Print("Done\n\r", gAllowToBlock_d); return errorNoError; } else { /* One or more parameters in the message were invalid. */ UartUtil_Print("Invalid parameter!\n\r", gAllowToBlock_d); return errorInvalidParameter; } } else { /* Allocation of a message buffer failed. */ UartUtil_Print("Message allocation failed!\n\r", gAllowToBlock_d); return errorAllocFailed; }}
I can only recommend downloading the 802.15.4 specification from the
www.ieee.org website so you can look up the behaviour of the different 802.15.4 commands and features.
BR,
Mads