Hi,
I am having trouble recovering from Rx errors in the UART driver provided in the BIOSPSP. It is operating in interrupt mode with FIFO enabled on a c6748. When the Rx error occurs, the error bits OE and FE are set. There is also the IOM_TIMEOUT status value in my app callback function. This is all expected, but I have several problems. The first problem is that the uartHandleRxError function seems to be causing HWI delays (I have a HWI that can at a period of .05 ms ). The second problem is that this will cause a null pointer exception inside the uartIsr. The third problem is how to recover from this error when it occurs. I have tried calling Uart_IOCTL_RESET_RX_FIFO, and Uart_IOCTL_CANCEL_CURRENT_IO as seen from a different post, but the UART does not recover.
Looking at the Uart source files, I think I have narrowed down the causes of the first two problems.
In uartIsr, UartFifoRead is called which calls the uartHandleRxError. Inside uartHandleRxError is this:
do
{
/* Read and throw error byte */
/* Till Line status int is pending */
tempByte = (Uint8)((instHandle->deviceInfo.baseAddress)->RBR);
/* To remove compiler "unused" warnings */
tempByte = tempByte;
iteration--;
while( (instHandle->deviceInfo.baseAddress->LSR
& CSL_UART_LSR_DR_MASK) == 0)
{
if (delay == 0)
{
break;
}
delay--;
}
status = (instHandle->deviceInfo.baseAddress)->LSR;
status &= (CSL_UART_LSR_BI_MASK |
CSL_UART_LSR_FE_MASK |
CSL_UART_LSR_PE_MASK |
CSL_UART_LSR_OE_MASK |
CSL_UART_LSR_RXFIFOE_MASK);
} while( ( status != 0 ) && (iteration != 0) );
if(NULL != chanHandle->activeIOP)
{
Uart_localCompleteCurrentIO(chanHandle);
}
iteration = 16 and delay = 0xFFFF.
Could this be a potential cause to the interrupt delay? and why the delay? I see that the UartIsr is registered as 'unmasked'. what does that mean?
Also, localcompletecurrentIO is called in here, but when it returns up to the uartIsr, localcompletecurrentIO is going to be called again. But this time, the activeIOP is set to NULL and causes exceptions in the callback of GIO- which is my second problem. So is this the expected behavior when Rx error happens?
Lastly, if this error does happen, then is it ok to call the reset routine for the UART handle inside the app callback or should it wait till the uartIsr finishes?
Thank You