求助:cc2530, uart 接收串口数据异常
genericapp; 2.5.1a
CC2530,回复收到的信息给PC
现象: pc串口助手发送不同长度的内容给CC2530,但每次只收到一个0X00;
//1
void MyUart0Init(void)
{
halUARTCfg_t uartConfig;
uartConfig.configured = TRUE;
uartConfig.baudRate = HAL_UART_BR_57600;
uartConfig.flowControl = FALSE;
uartConfig.flowControlThreshold = 80;
uartConfig.rx.maxBufSize = 128;
uartConfig.tx.maxBufSize = 128;
uartConfig.idleTimeout = 6;
uartConfig.intEnable = TRUE;
uartConfig.callBackFunc = RxUart0Data_CB;
HalUARTOpen (HAL_UART_PORT_0, &uartConfig);
}
//2
static void RxUart0Data_CB( uint8 port, uint8 event ) //UART0串口回调函数
{
uint8 buf = 0;
while ( Hal_UART_RxBufLen(HAL_UART_PORT_0))
{
HalUARTRead(HAL_UART_PORT_0,&buf,1);
HalUARTWrite(HAL_UART_PORT_0,&buf,1);
}
}
//3
GenericApp_Init
{
...
MyUart0Init();
HalUARTWrite(0,"BOOT...\n",8); //此处能正常输出到串口助手。
}
建议将帖子移到 zigbee技术
请删除这个帖子吧,是硬件的问题。