cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 HAL_UART_Init blocking forever and failing

SHowr.1
Associate

I've started a new project, using STM32CubeIDE which I downloaded yesterday, and the check for updates says I am on the latest. Nice and simple LED flash and a Hello world over UART.

I am using USART2, setup as asynchronous. I have tried with and without DMA. Bar my blink code, everything is auto generated by the CubeIDE.

In all cases the programme gets stuck in an infinite loop in the HAL_UART_Init(&huart2) call, inside MX_USART2_UART_Init().

Digging deeper I find where it is getting stuck in HAL_UART_Init(&huart2) is:

return (UART_CheckIdleState(huart));

Inside here is it in the call:

/* Wait until TEACK flag is set */
    if (UART_WaitOnFlagUntilTimeout(huart, USART_ISR_TEACK, RESET, tickstart, HAL_UART_TIMEOUT_VALUE) != HAL_OK)
    {
      /* Timeout occurred */
      return HAL_TIMEOUT;
    }

Where it seems that the TEACK flag never gets RESET. Confusingly the comment says SET, but the function call says RESET. I am not sure if this is the issue or not.

Grateful if anyone can point me in the direction of where my setup is going wrong. I thought setting up a new project to do a "hello world" would have been straight forward!

Note; I am familiar with STM32, but am thinking about moving my project over from TrueStudio.

Attached; I have zipped up the project folder if it helps.

Edit; I have now also tried UART4 and UART8, same issue persists

0 REPLIES 0