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.

发送数据丢包

做透传测试,现条件如下:
1,串口最大接收缓存1024个字节
2,每个包80个字节 ,若发送成功,继续发送下一包,发送不成功,产生SERIALAPP_SEND_RETRY事件,继续发送此包
我现在每次发送900多个字节,然后分成80个字节每包往外发送,前面的6个包都没有问题,到第7个包的时候由于消息队列已满,所以发送失败,触发ERIALAPP_SEND_RETRY事件,一直循环,等到队列有空余的时候继续发送。可是我抓包发现一共才发出去8个包640个字节,不知道哪里出了问题。
代码如下:

while(1) {
  if(serial.txrepeat == false) {
	HAL_ENTER_CRITICAL_SECTION(intState);
	serial.txLen = HalUARTRead(SERIAL_APP_PORT, serial.txBuf, SERIAL_APP_TX_MAX);
	HAL_EXIT_CRITICAL_SECTION(intState);
  } 
  
  if(serial.txLen){
	tmpBuf[0] = ++serial.txSeq;  //sequence number at first byte
	memcpy(&tmpBuf[1], serial.txBuf, serial.txLen);
	res = zcl_SendCommand( UARTBRIDGE_ENDPOINT, &serial.txAddr, ZCL_CLUSTER_ID_UARTBRIDGE_TRANSPARENT, CMD_UARTBRIDGE_SEND, TRUE, ZCL_FRAME_CLIENT_SERVER_DIR, /*FALSE*/TRUE, 0, 0, serial.txLen + 1, tmpBuf );
	if(res != ZSuccess) {
		serial.txrepeat = true;
		serial.txSeq--;
		osal_set_event(zclGetZigbeeModuleTaskID(), SERIALAPP_SEND_RETRY);    //retry
		break;
	} else {
		serial.txrepeat = false;
	}
  } else {
	break;
  }
}