Not sure yet. BTW that ret variable maps to error codes:
HAL_OK = 0x00,
HAL_ERROR = 0x01,
HAL_BUSY = 0x02,
HAL_TIMEOUT = 0x03
I’m getting HAL_BUSY when I introduce the 1ms delay. If we look at the receive code that tells us that we are failing this check huart->RxState == HAL_UART_STATE_READY
.
The comment there says Check that a Rx process is not already ongoing
.
Running the debug probe confirms we’re in state HAL_UART_STATE_BUSY_RX
.