请问我的CC2541串口我就发了一条数据进去,然后会连续不断的进入串口回调函数,这是怎末回事。
static void Uart_Init(halUARTCBack_t SunnyCBack) {
halUARTCfg_t uartConfig;
// configure UART
uartConfig.configured = TRUE;
uartConfig.baudRate = NPI_UART_BR;
uartConfig.flowControl = NPI_UART_FC;
uartConfig.flowControlThreshold = NPI_UART_FC_THRESHOLD;
uartConfig.rx.maxBufSize = NPI_UART_RX_BUF_SIZE;
uartConfig.tx.maxBufSize = NPI_UART_TX_BUF_SIZE;
uartConfig.idleTimeout = NPI_UART_IDLE_TIMEOUT;
uartConfig.intEnable = NPI_UART_INT_ENABLE;
uartConfig.callBackFunc = (halUARTCBack_t)SunnyCBack;
halUARTCfg_t uartConfig;
// configure UART
uartConfig.configured = TRUE;
uartConfig.baudRate = NPI_UART_BR;
uartConfig.flowControl = NPI_UART_FC;
uartConfig.flowControlThreshold = NPI_UART_FC_THRESHOLD;
uartConfig.rx.maxBufSize = NPI_UART_RX_BUF_SIZE;
uartConfig.tx.maxBufSize = NPI_UART_TX_BUF_SIZE;
uartConfig.idleTimeout = NPI_UART_IDLE_TIMEOUT;
uartConfig.intEnable = NPI_UART_INT_ENABLE;
uartConfig.callBackFunc = (halUARTCBack_t)SunnyCBack;
(void)HalUARTOpen( NPI_UART_PORT, &uartConfig );
return;
}
return;
}
//串口回调函数
static void UartCallBack(uint8 port, uint8 event) {
if (event & (HAL_UART_RX_TIMEOUT|HAL_UART_RX_FULL)) {
Sunny_Send_Data("CCCCC",5);
osal_set_event(UartTaskId, UART_RXCB_EVT);
}
}
static void UartCallBack(uint8 port, uint8 event) {
if (event & (HAL_UART_RX_TIMEOUT|HAL_UART_RX_FULL)) {
Sunny_Send_Data("CCCCC",5);
osal_set_event(UartTaskId, UART_RXCB_EVT);
}
}
da qin zheng sheng:
把中断标记清除一下。
user4941551:
回复 da qin zheng sheng:
请问使用这种DMA的方式也要清空吗,我看资料利用这种方式写的没有看见清空标志啊