UART on Sharp 79524

I've implemented an interrupt driven UART handler for a Sharp LH79524 and it seems to be working OK. When I receive a message from my host system then I transmit one back. All seems fine on that front and the two will chat away for hours without any bad packets. If I unplug the comms cable then I get a timeout reported but when I plug it back in comms is restored the next time a message is received.

However, if I short Tx to Rx then the system fails to recover and keeps on reporting timeouts. Is this something to do with how the Sharp UART handles hardware errors and is there anyway of firstly detecting the problem and secondly fixing it? I've assumed (risky I know) that a break in the line is conceptually the same as a short so I can't see why ythe UART will recover from one but not the other.

Many thanks in advance.

Reply to
Loading thread data ...

"Tom" wrote in message news:436a0188$0$82639$

That *really* sounds like a software problem.

(Connecting Tx to Rx is not a hardware fault mode - indeed I often do exactly that, deliberately, in a half-duplex RS485 context so that I can detect end of transmission.)

What does your Rx code do with a packet that's either a) as Txed or b) incomplete?


formatting link

Reply to
Steve at fivetrees

When the Rx FIFO gets to 3/4 full (28bytes) then the interrupt is flagged and 27 bytes are read out into a buffer (leaving one to allow the UART to flag a timeout to signify the last byte.) When the timeout occurs then the FIFO is read into the buffer until it is empty. This appears to be where it gets stuck. The read is done using a while loop which exits when the Rx FIFO empty flag is 1.

The contents of the buffer are examined and various status words and CRCs are checked to test the validity of the message. If the message is valid then the program uses the data but if it is not then an error message is written to the LCD screen and the program waits for the next message to be received.

Reply to

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.