Mikrokontroler STM32G070 (i nie tylko) wspiera sprzętowe wykrywanie końca ramki odbieranej przez UART, funkcjonalność przydatna w implementacji modbus. Polega to na zaprogramowaniu i uaktywnieniu dodatkowego "timera" który po przekroczeniu czasu ciszy na linii RX ustawia flagę RTOF i generuje przerwanie.
Z informacji w RM opis funkcjonalności
The timeout function and interrupt must be activated, through the RTOEN bit in the USART_CR2 register and the RTOIE in the USART_CR1 register. The value corresponding to a timeout of 2 character times (for example 22 x bit time) must be programmed in the RTO register. When the receive line is idle for this duration, after the last stop bit is received, an interrupt is generated, informing the software that the current block reception is completed.
A z opisu rejestrów
Bits 23:0 RTO[23:0]: Receiver timeout value
This bitfield gives the Receiver timeout value in terms of number of bits during which there is no activity on the RX line.
In standard mode, the RTOF flag is set if, after the last received character, no new start bit is detected for more than the RTO value.
I na koniec uwaga przy opisie flagi
If a time equal to the value programmed in RTOR register separates 2 characters, RTOF is not set. If this time exceeds this value + 2 sample times (2/16 or 2/8, depending on the oversampling method), RTOF flag is set.
Jak można zinterpretować bit time w pierwszym paragrafie, gdzie podano przykład 22 x bit time ?