Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4883

General • Re: Getting Out Of A UART Framing Error

$
0
0
Thank you for all your answers and clarifications. If I understand correctly this code snippet should do the trick ?

Code:

hw_set_bits (&uart_get_hw(uart1)->rsr, UART_UARTRSR_BITS)
Probably it will, but it's equivalent to:

Code:

uart_get_hw(uart1)->rsr = UART_UARTRSR_BITS;
because the whole point about write-1-to-clear registers is that you can clear selective bits using just ordinary writes.
I added this to my test code and it clears the register but the data stream is still corrupted.
Is your target device continually spewing data at maximum rate (no pauses)? If so, this is a fundamentally impossible problem to solve: the UART can't tell the difference between start/stop bits and character data bits unless there is a pause of several bit times (or you get lucky with the particular byte values).

If that is the problem, and the baudrate isn't too high, you could maybe write a simple PIO program to capture the data as a stream of bits and apply your own heuristic (knowledge of the expected data content) to find the character boundaries in software.

Statistics: Posted by arg001 — Fri Dec 13, 2024 3:19 pm



Viewing all articles
Browse latest Browse all 4883

Trending Articles