I return on an Old project which present some problem.
This Project is based on MC13213 with the Beekit 3.0.2 : HCS08 MAC Codebase 2.6.1.
On this project we have some End Device and One coordinator. Device send sometime information over air.
But regulary, we have some difficult to transmit message.
My code follow the given exemple of "UART wireless"
I have the following code to send data:
mpPacket->msgData.dataReq.msduLength = index; //****
// Data was available in the UART receive buffer. Now create an
// MCPS-Data Request message containing the UART data.
mpPacket->msgType = gMcpsDataReq_c;
// Create the header using coordinator information gained during
// the scan procedure. Also use the short address we were assigned
// by the coordinator during association.
FLib_MemCpy(mpPacket->msgData.dataReq.dstAddr, mCoordInfo.coordAddress, 2);
FLib_MemCpy(mpPacket->msgData.dataReq.srcAddr, maMyAddress, 2);
FLib_MemCpy(mpPacket->msgData.dataReq.dstPanId, mCoordInfo.coordPanId, 2);
FLib_MemCpy(mpPacket->msgData.dataReq.srcPanId, mCoordInfo.coordPanId, 2);
mpPacket->msgData.dataReq.dstAddrMode = mCoordInfo.coordAddrMode;
mpPacket->msgData.dataReq.srcAddrMode = mAddrMode;
// Request MAC level acknowledgement of the data packet
mpPacket->msgData.dataReq.txOptions = gTxOptsAck_c;
// Give the data packet a handle. The handle is
// returned in the MCPS-Data Confirm message.
mpPacket->msgData.dataReq.msduHandle = (uint8_t)Evt + 0x11;
//UartUtil_Print("Sending ...\n\r", gNoBlock_d);
// Send the Data Request to the MCPS
res = MSG_Send(NWK_MCPS, mpPacket);
// Prepare for another data buffer
mpPacket = NULL;
MSG_Send return always 0x00.
Then we have the HandleMcpsInput function wichin is call on each MCPS indication:
static void App_HandleMcpsInput(mcpsToNwkMessage_t* pMsgIn)
/* The MCPS-Data confirm is sent by the MAC to the network
or application layer when data has been sent. */
IF_Print_Hex(&pMsgIn->msgData.dataCnf.status, 1, 0);
Thank to My function to print data to the UART, I can see something:
After MSG_Send called, we are notified with HandleMcpsInput with msgType = McpsDataCnf.
On the first transmission, the pMsgIn->msgData.dataCnf.status is well "0x00" and data are well transmitted and received by the coordinator.
On the second, MSG_Send, the Status is 0xE8 (??? not found this value in documentation), then I must recall the MSG_Send a second time...
After that, all MSG_Send must be done 4 time to have a Status of 0x00 instead of 0xE8 to transmit correctly the Data.
And sometime, I transmit it many time (A retry during 3s = about 30 try) I always a confirmation with status of 0xE8... After that, I restart an association.
Sometime this association finish Ok, sometime association fail... (I don't know yet where)
- Why many Time the Confirmation status is 0xE8 (Which mean this returned code?) THis will help me to understand why we need 4 try to transmit and maybe why sometime th transmission failed...
- Like this codebase is old, is the source code is free available for editing?