STMicroelectronics / STM32CubeH7

STM32Cube MCU Full Package for the STM32H7 series - (HAL + LL Drivers, CMSIS Core, CMSIS Device, MW libraries plus a set of Projects running on all boards provided by ST (Nucleo, Evaluation and Discovery Kits))
https://www.st.com/en/embedded-software/stm32cubeh7.html
Other
479 stars 298 forks source link

HAL_UART_Transmit can generate faulty error #272

Closed ra1u closed 3 months ago

ra1u commented 10 months ago

Function HAL_UART_Transmit() can return HAL_TIMEOUT error that should not be returned.

Issue is that HAL_UART_Transmit() uses UART_WaitOnFlagUntilTimeout()

In case that there is rx timeout (data was regularly received during transmission and rx timout isr is raised) HAL_TIMEOUT is returned during transmission.

TOUNSTM commented 10 months ago

Hello @ra1u,

Thank you for this report. We will get back to you as soon as we analyze it further. This may take some time. Thank you for your comprehension.

With Regards,

ASELSTM commented 10 months ago

Hi @ra1u,

Would it be possible to share the whole project you have used to reproduce the issue in order to allow a better analysis of the problem.

With regards,

ra1u commented 10 months ago

I am sorry I cant share project, but out of my head it should be following.

// config Config uart set rx timeouts ->HAL_UART_ReceiverTimeout_Config(UART_HandleTypeDef *huart, uint32_t TimeoutValue) enable rx timeout -> HAL_StatusTypeDef HAL_UART_EnableReceiverTimeout(UART_HandleTypeDef *huart)

In our case we use customised uart ISR handler, however issue remains.

We would expect, that timeouts for RX and TX are to be handled separately and that Rx timeout does not trigger error in UART_WaitOnFlagUntilTimeout() when waiting for TX to complete. Our internal patch for this is that we added additional argument for UART_WaitOnFlagUntilTimeoutthat distinguish direction. (it is equivalent as replacing UART_WaitOnFlagUntilTimeoutwith two functions UART_WaitOnFlagUntilTimeout_RX and UART_WaitOnFlagUntilTimeout_TX )

KRASTM commented 4 months ago

Hello @ra1u,

Just to be sure, in your project you used HAL_UART_Transmit() to transmit Data, and for the receiving part you used an ISR to receive data for ex: HAL_UART_Receive_IT()?

Can you share more information about your config & project, so we can reproduce it.

With regards

KRASTM commented 4 months ago

Hello @ra1u,

Any news please?

With regards.

KRASTM commented 4 months ago

Hello @ra1u,

As a result of the STM32CubeH7 being recently updated to v1.11.2, can you please verify that the issue still remains.

With regards.

KRASTM commented 3 months ago

Hello @ra1u,

Please allow me to close the issue, since there is no activity in a while.

With regards.