We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
CMSIS Driver UART Revision: V1.02
file C:\Keil\ARM\Pack\Keil\STM32F4xx_DFP\1.0.8\RTE_Driver\UART_STM32F4xx
function UART_IRQHandler (UART_RESOURCES *ptr_uart)
static void UART_IRQHandler (UART_RESOURCES *ptr_uart) { uint32_t sr; volatile uint32_t val; sr = ptr_uart->uart->SR; ... // Overrun error if (sr & USART_SR_ORE) { if (ptr_uart->info->event_mask & (1 << ARM_UART_EVENT_RX_OVERRUN)) ptr_uart->info->cb_event(ARM_UART_EVENT_RX_OVERRUN); } ... // Read data register not empty if (sr & USART_SR_RXNE) { if (ptr_uart->uart->CR1 & USART_CR1_RXNEIE) { if ((ptr_uart->info->rx.idx_in != ptr_uart->info->rx.idx_out) || ((ptr_uart->info->rx.idx_in == ptr_uart->info->rx.idx_out) && (ptr_uart->info->rx.empty == true))) { ptr_uart->rx_buffer[ptr_uart->info->rx.idx_in] = ptr_uart->uart->DR; ptr_uart->info->rx.empty = false; ptr_uart->info->rx.idx_in = (ptr_uart->info->rx.idx_in + 1) & (ptr_uart->rx_buffer_size - 1); val = (ptr_uart->info->rx.idx_in - ptr_uart->info->rx.idx_out) & (ptr_uart->rx_buffer_size - 1); val = (ptr_uart->rx_buffer_size - 1) - val; if ((ptr_uart->hw_flow == true) && (ptr_uart->manual_rts_cts == false)) { if (ptr_uart->flow_ctrl_threshold == val) GPIO_PinWrite(ptr_uart->pin_rts.port, ptr_uart->pin_rts.num, 1); } if (val == ptr_uart->info->rx.threshold) { if (ptr_uart->info->event_mask & (1 << ARM_UART_EVENT_RX_THRESHOLD)) ptr_uart->info->cb_event(ARM_UART_EVENT_RX_THRESHOLD); } } else { ptr_uart->uart->CR1 &= ~USART_CR1_RXNEIE; } } } ... } } }
Sometimes there's a situation when ORE flag is set, but RXNE is cleared. In that case the program is stucked in this UART_IRQ_Handler. If you want to see this situation in the debugger, you should close USART Registers Debug window, otherwise the debugger will read DR register and thus ORE flag will be cleared.