This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

What's wrong with my function to write all received messages to serial port?

Other Parts Discussed in Thread: CC2430

I trying to use this function to write all received messages to the serial port and add the 16bitaddress of the sender. This all works good for sometime thens it simply stops writing to the serial port, and sometimes coordinator stops. I'm using a java parser tu read serial data. I also use a serial porte sniffer, wich tells me that when it stops nothing is beeing writed to the serial port.

I'm using one coordinator and 8 enddevices sending 2 messages each. Is it too quick to the coordinator to write all the messages in such a small time? 8 messages are received in the same second.

Please can someone give me any light about the proble i'm faced. Zstack 1.4.3 CC2430

 

void GenericApp_MessageMSGCB( afIncomingMSGPacket_t *pkt )
{
     afAddrType_t addType;
     unsigned char* bit16address;
     unsigned char* bit16addressPtr;
     uint16 address;
    switch ( pkt->clusterId )
    {
      case GENERICAPP_CLUSTERID:
          // int16 RSSI=GenericApp_RSSI((uint8)pkt->LinkQuality);
              addType=pkt->srcAddr;
              address=addType.addr.shortAddr;
      //SEND DATA TROUGH SERIAL PORT
      //HalLcdWriteStringValue("Txbuf",Hal_UART_TxBufLen(SERIAL_APP_PORT),10,1);
             
       bit16addressPtr=_ltoa((long)address,bit16address, 10);
             HalUARTWrite(SERIAL_APP_PORT,pkt->cmd.Data,(pkt->cmd.DataLength)-1);
             HalUARTWrite(SERIAL_APP_PORT,"&",1);
             HalUARTWrite(SERIAL_APP_PORT,bit16address,digitcount(address));
              HalUARTWrite(SERIAL_APP_PORT,"#",1);

             break;
      default:
           break;
    }
}

uint8 digitcount (uint16 number){
return (uint8)(log10((float)number)) + 1;
}