2024-01-30 08:13 AM - edited 2024-01-30 08:13 AM
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!
Solved! Go to Solution.
2024-01-30 08:59 AM - edited 2024-01-30 09:00 AM
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.
2024-01-30 08:59 AM - edited 2024-01-30 09:00 AM
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.