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.

C6747 UART and error recovery

Hello,

I am using the UART driver  in the PSP (1.30.01) at 115kbaud and it works fine with valid data.  But when I send it bad data i.e. connect at 38.4kbaud or flood the UART port it produces an error condition

status = GIO_submit(hUart_IN,IOM_READ,buf,&len,NULL);    // read

where status=-1.  That is fine but then i want to recover from the error.  Is this what i should be doing to flush the port and start again?

        if (!((status == IOM_COMPLETED)||(status == IOM_PENDING)))
        {
            status = GIO_control(hUart_IN, Uart_IOCTL_CANCEL_CURRENT_IO, 0);
            status = GIO_control(hUart_IN, Uart_IOCTL_RESET_RX_FIFO, 0);
            status = GIO_control(hUart_IN, Uart_IOCTL_FLUSH_ALL_REQUEST, 0);

         }

Regards,

Fawad

  • Hi Fawad,

    Since GIO_submit(...) is a synchronous call, you need not flush all requests(Uart_IOCTL_FLUSH_ALL_REQUEST), because at any point of time only one IO packet will be available with the driver/GIO. So to recover from the above mentioned error, just reset the RX FIFO, and then cancel the current IO. This sequence should recover UART from the error and ready for the next transaction.

    You can just do this:

            if (!((status == IOM_COMPLETED)||(status == IOM_PENDING)))
            {
                status = GIO_control(hUart_IN, Uart_IOCTL_RESET_RX_FIFO, 0);
                status = GIO_control(hUart_IN, Uart_IOCTL_CANCEL_CURRENT_IO, 0);
            }

    I hope this answers your question, let me know the result.

    Thanks & regards,

    Raghavendra

  • Ragavendra,

    Works like a charm!  Thanks.

    Regards,

    Fawad