Skip to main content
CLH
Associate II
February 18, 2020
Solved

HAL_UART_Transmit_DMA() cannot send 2 as second shows busy

  • February 18, 2020
  • 3 replies
  • 1056 views

I have the following code:

HAL_UART_Transmit_DMA(Outgoinghuart, (uint8_t *)message, sizeOfMessage);
delay(10000);
HAL_UART_Transmit_DMA(Outgoinghuart, (uint8_t *)message, sizeOfMessage);

The second DMA transmit is always busy, no matter how big the delay. (I checked the delay function is 100% working on the scope)

I have tried using:

/*##-3- Wait for the end of the transfer ###################################*/ 
 while (UartReady != SET)
 {
 } 
 
 /* Reset transmission flag */
 UartReady = RESET;

and tried everything else in that GitHub example. It doesn't make any difference the gState

is always busy after the first transfer.

It works 100% if I use HAL_UART_Transmit().

Any ideas would be great (I have scanned every forum post on this and none of them work)

Even ideas on diagnosing the issue would be great! Thanks =)

This topic has been closed for replies.
Best answer by CLH

After an entire week wasted thinking it was a code issue. It was attolic studio. Breakpoints to be specific.

To fix the issue:

1) Clear all breakpoints

2) Power cycle board

3) Re-flash the board

now everything works... This IDE finds new ways to annoy the hell out of me!

3 replies

KnarfB
Super User
February 18, 2020

It works for me on a STM32F042 Nucleo. There is (was?) a bug concerning the generated init code: DMA must be init before UART:

 MX_GPIO_Init();
 MX_DMA_Init();
 MX_USART2_UART_Init();

If this doesn't help, post more details.

hth

KnarfB

CLH
CLHAuthorBest answer
Associate II
February 21, 2020

After an entire week wasted thinking it was a code issue. It was attolic studio. Breakpoints to be specific.

To fix the issue:

1) Clear all breakpoints

2) Power cycle board

3) Re-flash the board

now everything works... This IDE finds new ways to annoy the hell out of me!