ZigBee:MAC problems, MSG_Send...doesn't send!!!

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

ZigBee:MAC problems, MSG_Send...doesn't send!!!

1,537 Views
bradomyn
Contributor I

Hi,
 
I'm rookie in this world of ZigBee. I want to use as example the "Ex05", "My Wireless App", code that freescale furnishes like example of communication between one coordinator and a device, through the hyperterminal, isn't it?
 
I want to use the function "App_TransmitUartData" but instead of send a input message, through the serial port, I want to send a fix character...
 
"pPacket->msgData.dataReq.msdu[0] = 'h';"
 
and I use the primitive "NR MSG_Send(NWK_MCPS, pPacket);" to put into the NWK_MCPS_queue the request but, doesn't work...I saw that nothing going into the  NWK_MCPS_queue ( I debugged and saw that when I use the original App_TransmitUartData function, the packet goes into...) what is the problem?
 
and what means the "NR" ?, I only see these instruction in the example, and if I cancel these instruction the original code has problems. I've seen in the Reference Manual that only I need to put  MSG_Send, I'm going to post the complete code.

 

thank you in advance,

Cesar
 
//************************************************************************************************************************************
void App_TransmitInfo(void)
{  
   
          
      pPacket = MSG_Alloc(sizeof(nwkToMcpsMessage_t) - 1 + DEFAULT_DATA_LENGTH);
      msduLength=1;
      pPacket->msgData.dataReq.msdu[0] = 'h';
      pPacket->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. */

      memcpy(pPacket->msgData.dataReq.dstAddr, coordInfo.coordAddress, 8);
      memcpy(pPacket->msgData.dataReq.srcAddr, myAddress, 8);
      memcpy(pPacket->msgData.dataReq.dstPanId, coordInfo.coordPanId, 2);
      memcpy(pPacket->msgData.dataReq.srcPanId, coordInfo.coordPanId, 2);
      pPacket->msgData.dataReq.dstAddrMode = coordInfo.coordAddrMode;
      pPacket->msgData.dataReq.srcAddrMode = myAddrMode;
      pPacket->msgData.dataReq.msduLength = msduLength;

      /* Request MAC level acknowledgement of the data packet */
      pPacket->msgData.dataReq.txOptions = gTxOptsAck_c;

      /* Give the data packet a handle. The handle is
         returned in the MCPS-Data Confirm message. */
      pPacket->msgData.dataReq.msduHandle = msduHandle++;
    
    
      /* Send the Data Request to the MCPS */
      NR MSG_Send(NWK_MCPS, pPacket);
     //MSG_Send(NWK_MCPS, pPacket);
    
    /* Prepare for another data buffer */
      pPacket = NULL;
      numPendingPackets++;
     
}
 
//**************************************************************************************************************

Labels (1)
0 Kudos
Reply
3 Replies

640 Views
Spell
Contributor I
Hi Bradomyn,
the error maybe is here:

      pPacket->msgData.dataReq.msdu[0] = 'h';



Try with thus code:
Code:
static uint8_t dataBuffer[mDefaultValueOfDataLen_c];dataBuffer[0] = 'h';mpPacket->msgData.dataReq.pMsdu = (uint8_t *)(&(dataBuffer));

 Regards,
Filippo

0 Kudos
Reply

640 Views
JonathanCo
Contributor I
In the version you have of the codebase,
 
Packet->msgData.dataReq.msdu   was replaced by ...
Packet->msgData.dataReq.pMsdu 
 
but this probably doesn't apply to him since his code would not even compile in that case.
 
My best guess in his case is that "MSG_Alloc" returns NULL and he needs to see why.
 
Jonathan
0 Kudos
Reply

641 Views
lex4098
Contributor III
NR = No Return
It means that you discard the return value, and it's like  a "  (void)  " cast before calling the function.

Check if (pPacket==NULL) after this:
pPacket = MSG_Alloc(sizeof(nwkToMcpsMessage_t) - 1 + DEFAULT_DATA_LENGTH);

If NULL, buffer is full.

Best Regards,
Lex
0 Kudos
Reply