Question
stm32f427 uart4 interrupts generated without flags
Posted on April 11, 2014 at 18:27
In my programm I use uart4 with 115200 baud. I want to receive data from devices - so I configure UART in RxMode. I enebled only one interrupt source for it
USART_ITConfig(UART4, USART_IT_RXNE, ENABLE); My interrupt handler looks like this:void UART4_IRQHandler(void) { Uart_SR = UART4->SR; Uart_CR1 = UART4->CR1; Uart_CR2 = UART4->CR2; Uart_CR3 = GPS_USART->CR3; if(USART_GetITStatus(UART4_USART, USART_IT_RXNE) != RESET) { char symb; symb = USART_ReceiveData(UART4) & 0xFF; DummyCntr1++; } if(USART_GetITStatus(UART4, USART_IT_TXE) != RESET) { /* Write one byte to the transmit data register */ DummyCntr4++; } DummyCntr5++; }Some time
the data was successfully
received.
But
then
something strange
happens
.All
CPU time
UART4interrupt handler
is executed
(except for
higher-priority
interrupts handlers
)
, while the
interrupt flags
are reseted.
Uart_SR, Uart_CR1, Uart_CR2, Uart_CR3 variables transmitted via CAN, and there values are: 0x1D8, 0x2024, 0x0, 0x0respectively
. Also DummyCntr's transmitted and only DummyCntr5 grows up. So in CR1 only RXNEIE bit installed, in SR RXNE bit is cleared - why interrupt handler executed? What have I missed? #uart-interrupt-stm32f4