Estoy usando interrupción basada en UART IO (sin DMA).
HAL_UART_Transmit_ITLa función establece el EIEbit en el CR3registro. De acuerdo con la hoja de datos STM32F407 (y el comportamiento real), esto genera interrupción solo en modo de búfer múltiple (cuando DMARse establece el bit). EIEpermite la generación de interrupciones para error de trama ( FE), error de desbordamiento ( ORE), error de ruido ( NE). Este error, según tengo entendido, solo para recibir.
Parte de la HAL_UART_IRQHandlerfunción:
tmp1 = __HAL_UART_GET_FLAG(huart, UART_FLAG_ORE);
tmp2 = __HAL_UART_GET_IT_SOURCE(huart, UART_IT_ERR);
/* UART Over-Run interrupt occurred ----------------------------------------*/
if((tmp1 != RESET) && (tmp2 != RESET))
{
__HAL_UART_CLEAR_OREFLAG(huart);
huart->ErrorCode |= HAL_UART_ERROR_ORE;
}
if(huart->ErrorCode != HAL_UART_ERROR_NONE)
{
/* Set the UART state ready to be able to start again the process */
huart->State = HAL_UART_STATE_READY;
HAL_UART_ErrorCallback(huart);
}
HAL_UART_IRQHandlercomprueba cada error Si se produjo un error y EIEse establece el bit, restablece el estado UART, pero no restablece los bits de activación de interrupción, por lo que la TXEinterrupción siempre se generará, pero la UART_Transmit_ITfunción trata el estado HAL_UART_STATE_READYcomo no válido y no hace nada. Bucle infinito.
Parte de la UART_Transmit_ITfunción:
static HAL_StatusTypeDef UART_Transmit_IT(UART_HandleTypeDef *huart)
{
uint16_t* tmp;
uint32_t tmp1 = 0;
tmp1 = huart->State;
if((tmp1 == HAL_UART_STATE_BUSY_TX) || (tmp1 == HAL_UART_STATE_BUSY_TX_RX))
{
}
else
{
return HAL_BUSY;
}
}
¿Es un error en Cube HAL?
fuente

Respuestas:
Es un error
Hice la misma pregunta en el foro ST: https://my.st.com/d5c15f59
Ellos lo confirmaron.
fuente
¿Intentaste descargar la última versión de Cube HAL para tu MCU?
Mi función HAL_UART_Transmit_IT () parece muy diferente a la tuya. Tal vez tienes una versión anterior con errores.
Intente acceder a st.com y busque la última versión de Cube HAL. Dentro del archivo encontrarás algunos ejemplos con USART.
fuente
HAL_UART_Transmit_ITyUART_Transmit_ITson diferentes funciones. Primero solo establece interrupciones, mientras que el segundo realmente transmite datos