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.

CC2530: 射频发送数据的问题

Part Number: CC2530


我在使用CC2530的ZStack时,将串口1收到的十六进制数据通过射频发送出去。通过串口发送的十六进制数为:02 03 00 01 00 04 15 FA 02 03 08 00 D8 00 00 00 46 00 00 23 4B。但是在做测试时,发现数据不是一次全部发送出去,而是多次发送。我在Debug的时候,却又发现是可以一次全部发送的,请问这是什么问题?我应该如何将串口接收到的数据一次全部发出?程序和图如下(抓包图上边4行是DeBug,下面时正常发送时抓的包)

4442.抓包.psd
}

//串口初始化
uint8 UART_Init(uint8 port, halUARTCBack_t cbFunc)
{
  halUARTCfg_t uartConfig;
  
  uartConfig.configured           = TRUE;
  uartConfig.baudRate             = HAL_UART_BR_9600;
  uartConfig.flowControl          = HAL_UART_FLOW_OFF;  
  uartConfig.rx.maxBufSize        = 128;
  uartConfig.tx.maxBufSize        = 128;
  uartConfig.flowControlThreshold = 64;
  uartConfig.idleTimeout          = 6;
  uartConfig.intEnable            = TRUE;
  uartConfig.callBackFunc         = cbFunc;       //回调函数

  return HalUARTOpen (port, &uartConfig);
}

//串口回调函数
void UART1_CallBack(uint8 port, uint8 event)
{
  uint8 data_TxLen = 0;
  uint8 data_TxBuf[64] = {0};
  uint8 data_TxChar[64];  

  if ((event & (HAL_UART_RX_FULL  | HAL_UART_RX_ABOUT_FULL 
                    | HAL_UART_RX_TIMEOUT)) && !data_TxLen)
  {
    data_TxLen = HalUARTRead( port, data_TxBuf, 80);

    if(data_TxLen)
    {  
	  if(data_TxLen>64)
	  	data_TxLen = 64;
	  
      memcpy(data_TxBuf, data_TxBuf, data_TxLen);
                   
      sendData(0x01, 0, data_TxBuf, data_TxLen);        //将数据通过串口0发送

#ifdef ZDO_COORDINATOR
      GenericApp_DstAddr.addrMode = (afAddrMode_t)Addr16Bit;
      GenericApp_DstAddr.addr.shortAddr = 0xFFFF;
      GenericApp_DstAddr.endPoint = GENERICAPP_ENDPOINT;
#else
      GenericApp_DstAddr.addrMode = (afAddrMode_t)Addr16Bit;
      GenericApp_DstAddr.addr.shortAddr = 0x0000;
      GenericApp_DstAddr.endPoint = GENERICAPP_ENDPOINT;
#endif          
     
          AF_DataRequest( &GenericApp_DstAddr, &GenericApp_epDesc,
                       GENERICAPP_CLUSTERID,
                       data_TxLen,
                       data_TxBuf,
                       &GenericApp_TransID,
                       AF_DISCV_ROUTE, AF_DEFAULT_RADIUS );
          

      memset(data_TxBuf, 0, 64);
      data_TxLen = 0;
	}
  }
}