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.

CC2642R: CC2642 UART0 UARTBusy()函数卡死

Part Number: CC2642R


我使用中断的方式来发送一帧数据,使用下列函数发送该帧的第一个字节,并启动发送(后续字节在发送完成中断中发送并计数),

当使用115200波特率时,该UARTBUSY()函数有卡死现象.

当使用19200波特率时,发送一帧数据的最后一个字节会卡死.处于UARTBusy()死循环中出不来.

请问如何解决.

当不使用该函数(注释掉)后,第一帧的最后一个字节出现在了间隔很长时间后才发的第二帧的第一个字节上. 该现象在115200bps时没有,在19200bps时出现,且必现.

注意,我未使用(也无法使用)芯片中uart的FIFO特性,它已在初始化时被禁用(disable).

void cc26xx_uart0_write_start(uint8_t firstByte){
//等待发送为空
while(UARTBusy(hwAttrs->baseAddr)){};//实测发现UARTBusy有时会卡死在这里

/* Enable TX,and interrupt */
HWREG(hwAttrs->baseAddr + UART_O_CTL) |= UART_CTL_TXE;
UARTIntClear(hwAttrs->baseAddr,UART_INT_TX);
UARTIntEnable(hwAttrs->baseAddr,UART_INT_TX);

/* send first byte trigger innterrupt */
UARTCharPutNonBlocking(hwAttrs->baseAddr,firstByte);
}