Skip to main content
KiptonM
Senior III
Feb 27, 2021 12:30 AM UTC
Solved

How can you tell if HAL_UART_Transmit_DMA() function has not finished?

I have been looking for something in the structure.

while ((huart1.hdmatx->State != HAL_DMA_STATE_READY) && (huart1.hdmatx->Lock != HAL_UNLOCKED))

But that does not seem to work.

The only other way I can think of is when you call HAL_UART_Transmit_DMA() set a variable to 1, and then setup a callback complete and set it to 0. Is that the best way to do it?

This topic has been closed for replies.
Vangelis Fortounas
Associate II
Feb 27, 2021 9:19 AM UTC

Hello

The HAL way (the best way depends to peogrammer) to know when HAL_UART_Transmit_DMA is finished , is when HAL_UART_TxCpltCallback(..) called by HAL.

2 replies

Vangelis Fortounas
Associate II
Feb 27, 2021 9:19 AM UTC

Hello

The HAL way (the best way depends to peogrammer) to know when HAL_UART_Transmit_DMA is finished , is when HAL_UART_TxCpltCallback(..) called by HAL.

Piranha
Principal III
Feb 28, 2021 6:15 PM UTC

One should not use driver structures internal elements externally, because it's not thread safe and not future proof. The driver state is returned by HAL_UART_GetState(). Though that function is also not thread safe, as is almost everything in the broken HAL...