cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_UART_Transmit_DMA() cannot send 2 as second shows busy

CLH
Associate II

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 =)

1 ACCEPTED SOLUTION

Accepted Solutions
CLH
Associate II

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!

View solution in original post

3 REPLIES 3
KnarfB
Principal III

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

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!