Hallo !
Ich laufe manchmal in einen Receive Overrun, und der UART ist blockiert.
Meine funktionierende Handlerroutine sieht so aus (i ist 0...5 für
UART1...UART6):
1 | void USART_Handler(uint8_t i){
|
2 |
|
3 | if (i >= NUM_UART)
|
4 | return;
|
5 |
|
6 | if (USART_GetITStatus(UART_Handle[i].USARTp, USART_IT_TXE) == SET){
|
7 | USART_BufferTx(i);
|
8 | }
|
9 |
|
10 | if (USART_GetITStatus(UART_Handle[i].USARTp, USART_IT_RXNE) == SET){
|
11 | USART_BufferRx(i);
|
12 | }
|
13 |
|
14 | }
|
15 |
|
16 | ...
|
17 | ...
|
18 |
|
19 | static void USART_BufferRx(uint8_t i){
|
20 | volatile t_UART_Handle * handle ;
|
21 |
|
22 | char c;
|
23 | if (i >= NUM_UART)
|
24 | return;
|
25 |
|
26 | handle = & UART_Handle[i];
|
27 |
|
28 | c = USART_ReceiveData(UART_Handle[i].USARTp); // read data from USART
|
29 | writeToRing(& handle->receiveRing, c);
|
30 | }
|
Im Reference Manual steht:
1 | ...
|
2 | It (ORE) is cleared by a software sequence (an read to the
|
3 | USART_SR register followed by a read to the USART_DR register).
|
USART_GetITStatus liest doch das SR, und USART_BufferRx liest das DR.
Wieso steht ORE dann trotzdem an? Zählt das hintereinander ausführen
nicht als "software sequence" ?
Danke, Michael