Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

Correct way to recover from UART receive timeout on C6748 using PSP 01_30_01 UART driver

$
0
0

Hi

I am trying to use the PSP UART driver with the C6748 with UART 2 and the following setup: 

   uartParams_.opMode            = Uart_OpMode_INTERRUPT;
   uartParams_.baudRate          = Uart_BaudRate_9_6K;
   uartParams_.stopBits          = Uart_NumStopBits_1;
   uartParams_.charLen           = Uart_CharLen_8;
   uartParams_.parity            = Uart_Parity_NONE;
   uartParams_.rxThreshold       = Uart_RxTrigLvl_4;

In my application I wish to send a number of bytes representing a command to a remote device and the receive a simple confirmation.  To make sure I receive the correct data, I call GIO_control( channelInHandle_, Uart_IOCTL_RESET_RX_FIFO, NULL ) before I write my data so that the first byte I receive should be the start of my confirmation.  So far so good and it all appears to work ok.

I have a requirement that I can detect and recover from a read timeout.  I have set a timeout in the GIO_attrs structure passed to GIO_create and I have also tried modifying the timeout at run time by modifying channelInHandle_->timeout.  I can time out successfully.  However, I seem to be unable to recover and resume normal operation following my first timeout.  If a timeout occurs I have tried calling GIO_control( channelInHandle_, Uart_IOCTL_CANCEL_CURRENT_IO, NULL ) and/or GIO_abort( channelInHandle_ ) but to no avail and I systematically read the first received byte following a timeout incorrectly.  (More frustratingly I can often see the byte I want in RBR in the CCS4 registers view but get a completely different value back from my call to GIO_read()).  I don't know if it is a clue but I also see LSR[OE] (and LSR[DR]) asserted in the registers view in CCS4.

Are there any known issues with the PSP driver for the C6748 UART or am I being dozy and following the incorrect procedure for recovering from a timeout.  I am getting quite desparate so any ideas would be gratefully received.  I would of thought that of all the errors one might need to tolerate in a system using a UART a receive timeout is one of them.  That said I was unable to find any other posts relating to my problem.

Thanks in advance

Tim

 


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>