I am using STM32 Nucleo F334R8 board. I transmit some data using UART in asynchronous mode to my PC using:

HAL_UART_Transmit_IT(&huart2, &data, sizeof(data));

I noticed that after enabling ADC in DMA mode microcontroller started to send incorrect data over UART.

When I just only commented out:

HAL_ADC_Start_DMA(&hadc1, adc_dma_values, 2);

UART transmission sends correct data.

When I replaced HAL_UART_Transmit_IT() with HAL_UART_Transmit() it also surprisingly works well.

I do not understand how HAL_ADC_Start_DMA() may affect HAL_UART_Transmit_IT().

Here's whole code of main.c, maybe it would be helpful.


1 Answer 1


Based on the followings:

  • the UART is working if you are using it without interrupts along with the DMA, and

  • if DMA is not used the UART works with interrupts.

The DMA interrupts possibly happens so often that it do not let the UART IRQ to be executed as the CPU is always busy to handle DMA interrupts.

Giving higher priority to UART IRQ should solve the issue.

  • \$\begingroup\$ You are perfectly right. That was my problem. I changed priorities of interrupts and now works well. Thank you! \$\endgroup\$
    – Madras
    Jan 24, 2018 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.