void USART2_IRQHandler(void) called continuously for UART with hardware flow control with DMA
I am using UART with DMA to communicate with nRF52833 with hardware flow control enabled. But while receiveing data, I get continuous interrupts and void USART2_IRQHandler(void) is called continuously.
I have enable RXNE interrupt so that I will know when data reception starts. I need this because I maintain state machine in my code and on reception of first byte, I change the state to RX_IN_PROGRESS and then, on RxCpltCallback, I change state to IDLE state.
My controller is STM32L031
My baudrate is 115200.
I am using STM32CubeIDE for my project on ubuntu.
I added following code in USART2_IRQHandler() but didnt help.
if (__HAL_UART_GET_FLAG(&huart2, UART_FLAG_REACK) == SET)
{
__HAL_UART_CLEAR_FLAG(&huart2, UART_FLAG_REACK);
}
if (__HAL_UART_GET_FLAG(&huart2, UART_FLAG_TEACK) == SET)
{
__HAL_UART_CLEAR_FLAG(&huart2, UART_FLAG_TEACK);
}
if (__HAL_UART_GET_FLAG(&huart2, UART_FLAG_TXE) == SET)
{
__HAL_UART_CLEAR_FLAG(&huart2, UART_FLAG_TXE);
}
if (__HAL_UART_GET_FLAG(&huart2, UART_FLAG_TC) == SET)
{
__HAL_UART_CLEAR_FLAG(&huart2, UART_FLAG_TC);
}
if (__HAL_UART_GET_FLAG(&huart2, UART_FLAG_IDLE) == SET)
{
__HAL_UART_CLEAR_FLAG(&huart2, UART_FLAG_IDLE);
}
if (__HAL_UART_GET_FLAG(&huart2, UART_FLAG_RXNE) == SET)
{
rx_uart_data = (uint16_t) READ_REG(&huart2.Instance->RDR);
__HAL_UART_CLEAR_FLAG(&huart2, UART_FLAG_RXNE);
}Below is the screenshot of ISR register.