USART i receiver timeout value

Pytania dotyczące problemów ze zrozumieniem kart katalogowych, not aplikacyjnych dla mkrokontrolerów ARM firmy STMicroelectronics, rozwiązania układowe z zastosowaniem STM.
Awatar użytkownika
Marcin
User
User
Posty: 309
Rejestracja: środa 09 wrz 2015, 19:30
Lokalizacja: Królewskie miasto Sandomierz

USART i receiver timeout value

Postautor: Marcin » czwartek 02 maja 2019, 22:17

Cześć wszystkim.

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 ?

m4tt
Posty: 1
Rejestracja: wtorek 17 kwie 2018, 18:27

Re: USART i receiver timeout value

Postautor: m4tt » środa 08 maja 2019, 10:53

Czy bit time to nie jest przypadkiem czas podtrzymania stanu niskiego lub wysokiego dla konkretnego bitu w ramce? Przykładowa długość 22xbit time mogłaby wtedy określać czas, podczas którego można odebrać 2 znaki przy założeniu, że używamy 8 bitów danych, 1 bitu parzystości, 1 bitu startu i 1 bitu stopu (8+1+1+1 = 11bitów, 11bitów x 2 znaki = 22).


Wróć do „STM - problemy układowe”

Kto jest online

Użytkownicy przeglądający to forum: Obecnie na forum nie ma żadnego zarejestrowanego użytkownika i 6 gości