Question
Stm32cubeL0 loop in USART IT
Posted on September 11, 2014 at 17:54
Im using STM32Cube_FW_L0_V1.1.0 on a STM32L052C8T6
Why there is some loops into TX and RX IT functions? For example: inUART_Receive_IT()
At the end of the reception there is:while(HAL_IS_BIT_SET(huart->Instance->ISR, UART_FLAG_RXNE))
{
} and in
UART_Transmit_IT()
at the end of the sending there is a call to:UART_WaitOnFlagUntilTimeout().
which is a blocking function It is very dangerous to have such loop in a IRQ handler it can cause an overrun or worst. For example when the last Byte is transmit you can't receive any byte without having an overrun because the IT handler is waiting for the TX Byte to be transmit :( Is it done on purpose or have you an explanation for this? Gwendal #rtfm #stm32cube-stm32l0xx