The PI7C9X762 Line Status Register (LSR) reports errors at two different scopes. Bit 7 indicates that a character somewhere in the receive FIFO still has a parity, framing, or break condition. Bits 4 through 2 describe only the character at the head of the FIFO. Bit 7 can be one while all three head-of-queue error bits are zero. A driver cannot use the queue-wide flag to label the next byte as corrupt or to infer crystal frequency drift.
Read the status before removing the byte
To attribute an error to a byte, have one receive routine read LSR first, then read RHR to remove the current character. Record the head status from the first operation with the data from the second. Removing a character updates bits 4 through 2 to reflect the new head. Reading the data first and then the status can attach the second character’s error to the first. The interrupt routine and a background reader also should not remove bytes from that same FIFO independently; otherwise, even two individually valid reads can describe different bytes.
Check the association without changing the clock
Keep the reference and UART frame format fixed. Send three recognizable characters from a test peer, with a deliberately wrong parity bit only on the middle character. Allow all three to accumulate before reading, without more incoming traffic. The first status read should show a queue error but no parity error for the head. After the first byte is removed, the next head should report the parity error. Once the bad byte is removed, bit 7 should clear if no other errored characters remain. This exposes both kinds of logging mistake: labeling the good byte from the queue summary, and labeling it with the next byte’s status.
Record overrun separately. LSR bit 1 describes an additional character arriving when the FIFO was full; the extra character was not transferred into the queue and cannot be matched to a stored byte this way. If ordinary frames continue to fail after fixing the capture order, compare the correctly paired errors with measured bit width, stop bits, and actual baud rate before blaming the crystal. First make sure the evidence belongs to the byte named in the log.
Related Articles
Related selection guide: MERLIN Crystal Timing: Programming SC16IS752 Divisors for 115200 Baud from a 22.1184 MHz Crystal with Prescaling
Resource link: https://www.mecxtal.com.cn/en/handbook/sc16is752-crystal-predivider-baud.html
