Переполнения я обработал. А как обрабатывать ошибки? В мануале по Framing error написано следующее:
Цитата
When the stop bit of a received character is a logic 0, a framing error occurs. An UnLSR read clears UnLSR[3]. The time of the framing error detection is dependent on UnFCR0. Upon detection of a framing error, the Rx will attempt to resynchronize to the data and assume that the bad stop bit is actually an early start bit. However, it cannot be assumed that the next received byte will be correct even if there is no Framing Error.
Цитата
Note: A framing error is associated with the character at the top of the UARTn RBR FIFO.
Код
case hw::UART::UxIIR_RLS_bit:
{
byte const lsr = U0LSR; // <1>
if (uarts::uart0.rx_.get_free_size() > 0)
{
basic_uart_t::rx_channel_item_t item;
item.value = '?';
item.lsr = lsr & hw::UART::UxLSR_RX_error_mask;
uarts::uart0.rx_.push(item);
}
else
{
uarts::uart0.rx_overflow_ = true;
}
}
break;
В строчке <1> переменная lsr иногда равна 0xE8 - данных в RX FIFO нет, Framing error - есть. Не соответствует Note из мануала.