cancel
Showing results for 
Search instead for 
Did you mean: 

UART_DMATransmitCplt bug report (Cube 4.19.0)

Nicolae Mihalache
Associate II
Posted on March 06, 2017 at 22:42

There is an extra 'else' at the end of UART_DMATransmitCplt function which prevents the HAL_UART_TxCpltCallback to be called in normal (non-circular) mode

[...]

}

 

/* DMA Circular mode */

 

else

  {

    HAL_UART_TxCpltCallback(huart);

  }

Compare to UART_DMAReceiveCplt which ends normally with 

[...]

}

  HAL_UART_RxCpltCallback(huart);

1 ACCEPTED SOLUTION

Accepted Solutions
Posted on March 07, 2017 at 09:45

Yes, Jan, you're right.

HAL_UART_TxCpltCallback

() in DMA normal mode will be called after TC interrupt will be raised (this means UART interrupt has to be enabled).

It is not a bug : this has been implemented for ensuring that user callback is not executed while last data was still on transmitting (please consider that UART_DMATransmitCplt() is called when DMA has loaded last data in TDR, but data transmission is not completed yet).

Without this check, if in user callback, user wants for example to disable USART block, it might lead to last data not properly transmitted.

Regards

Guenael

View solution in original post

5 REPLIES 5
Nicolae Mihalache
Associate II
Posted on March 06, 2017 at 23:16

Maybe that is not the bug that prevents 

HAL_UART_TxCpltCallback to be called, as the DMA transfer ends before the UART transfer? 

In any case, does 

HAL_UART_TxCpltCallback get called for anyone after a DMA transfer?

Nicolae Mihalache
Associate II
Posted on March 06, 2017 at 23:54

I have found the following workaround / solution: one has to activate UART global interrupt in cube even if all transfers are done using DMA.

Not sure it is a feature or a bug, hope it helps!

Posted on March 07, 2017 at 01:22

Isn't

https://community.st.com/0D50X00009XkYAlSAN

and

https://community.st.com/0D50X00009XkYAlSAN

a related information?

JW

Posted on March 07, 2017 at 09:45

Sure, thank you. I had more or less discovered this by trial and error [+ code inspection]. I was maybe a bit too quick to post is as bug. Just comparing the code of the two functions and the asymmetric behavior, I was convinced it was a bug that survived for too long.

General remarks. I am new to the platform and I find Cube + HAL refreshing comparing to my old platform. On top of great hardware. Definitely new to this community / forum.

Posted on March 07, 2017 at 09:45

Yes, Jan, you're right.

HAL_UART_TxCpltCallback

() in DMA normal mode will be called after TC interrupt will be raised (this means UART interrupt has to be enabled).

It is not a bug : this has been implemented for ensuring that user callback is not executed while last data was still on transmitting (please consider that UART_DMATransmitCplt() is called when DMA has loaded last data in TDR, but data transmission is not completed yet).

Without this check, if in user callback, user wants for example to disable USART block, it might lead to last data not properly transmitted.

Regards

Guenael