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.

why does Uart lose one byte while resending the Rx data to PC side?

Other Parts Discussed in Thread: CC2530

Hi  all

     i  know  it is  unbelievable  about  this  phenomenon。 but  i would like to share my  debug process、

     first time i  add  two private function  about  initial UART0  and receive data .

    

void SerialInit(void)
{
  halUARTCfg_t uartconfig;
  uartconfig.configured = TRUE;
  uartconfig.baudRate = FS_UART_DEFAULT_BAUDRATE;// 115200
  uartconfig.flowControl = FALSE;

  uartconfig.flowControlThreshold = 5;
  uartconfig.rx.maxBufSize        = 128;
  uartconfig.tx.maxBufSize        = 128;
  uartconfig.idleTimeout          = 6;
  uartconfig.intEnable            = TRUE;
  
  uartconfig.callBackFunc = SerialCallBackFunc;  
  
  HalUARTOpen(0,&uartconfig);
}

/**
**FUNCNAME SerialCallBackFunc
**/
void SerialCallBackFunc(uint8 port, uint8 event)
{
  unsigned char rcvdata[MSG_UARTRX_MAXLEN];
  unsigned int rcvlength = 0x00;

  osal_memset( rcvdata,0,sizeof(char)*MSG_UARTRX_MAXLEN);

  ch = Hal_UART_RxBufLen(port);
  rcvlength = HalUARTRead(0,rcvdata,ch);
  HalUARTWrite(0,rcvdata, ch);
  URX0IF = 0;
}

    and  i  add those function  in  APP initial function

void zclSampleDoorLock_Init( byte task_id )
{

  ......

  SerialInit();
  HalUARTWrite(0,"12",sizeof("12"));
}

       

    when i  sending  22byte  HEX data from PC side  to CC2530,  i  trace the code one by one 

     Sending data  :“ 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF 12 23 56 45 78 89 ”

     PC side RX Data  : "00 22 33 44 55 66 77 88 99 AA BB CC DD EE FF 12 23 56 45 78 89"  

     lose  the second byte , no matter how long or how short the data  i test to send.

    

     trace  receive data  from PC side  , and  the data length  is right  .

    

       and  data is also right

   

 

 then  i  trace  the code in  HalUARTWriteDMA  

 altough  the  txBuf data is also same with RX.

but  PC side  Only receive 21Byte data,  and nomatter  how long and how stort  the data  is  , it  was  always  lose  the second byte

  

BR