cancel
Showing results for 
Search instead for 
Did you mean: 

Unexpected UART timeout error HAL_TIMEOUT with the STM32G0B1RET MCU

Kmax18
Senior

I completed an alpha prototype design with the NUCLEO-G071RB, the STM32 Nucleo-64 development board with a STM32G071RB MCU plus a custom daughter board. Hardware and software using the HAL library work well, so I moved on to the next step, a beta design: a custom board with the STM32G0B1RET MCU for extra memory.

The alpha source code was ported to the new MCU using the HAL library, and MX was used to adjust the pinout.
Result: the beta device establishes UART communication with the external device, but reports unexpected HAL_TIMEOUT errors:

err = HAL_UART_Receive(huart1, (uint8_t*) uart_RxBuffer, packLen, timeout);

The variable 'timeout' is 20 ms, and the oscilloscope shows that a response received within 4 ms. It should work, so why teh timeout error. (I assume the measurement unit is milliseconds.)

What can cause these timeout errors? Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

Set the timeout to HAL_MAX_DELAY, see if it works. Probably it doesn't, which means data isn't coming in and the timeout is valid.

> The alpha source code was ported to the new MCU using the HAL library, and MX was used to adjust the pinout.

Guessing the pin isn't properly initialized but it could be any number of things including invalid clock.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

1 REPLY 1
TDK
Guru

Set the timeout to HAL_MAX_DELAY, see if it works. Probably it doesn't, which means data isn't coming in and the timeout is valid.

> The alpha source code was ported to the new MCU using the HAL library, and MX was used to adjust the pinout.

Guessing the pin isn't properly initialized but it could be any number of things including invalid clock.

If you feel a post has answered your question, please click "Accept as Solution".