cancel
Showing results for 
Search instead for 
Did you mean: 

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

KiptonM
Lead

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?

1 ACCEPTED SOLUTION

Accepted Solutions

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.

View solution in original post

2 REPLIES 2

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
Chief II

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...