Skip to main content
Visitor II
January 12, 2023
Question

How to use UART DMA RX?

  • January 12, 2023
  • 2 replies
  • 1975 views

Hello.

I developed UART by DMA method and it works normally, but I am posting because I have one question.

In the case of the sites I found, most of the main function or initial HAL_UART_Receive_DMA function was called, and the HAL_UART_RxCpltCallback function also called HAL_UART_Receive_DMA. So I also wrote the same.

I thought the reason for doing so was to make the DMA controller listen again. So I thought that the HAL_UART_RxCpltCallback function also calls the HAL_UART_Receive_DMA function.

However, UART works normally without calling HAL_UART_Receive_DMA in HAL_UART_RxCpltCallback. Can you tell me why?

The environment is:

- STM32F407VE MCU

- FreeRTOS

The referenced implementation is:

0693W00000Y83ErQAJ.png 

Thank you

    This topic has been closed for replies.

    2 replies

    Super User
    January 12, 2023

    Are you using circular DMA? What sites have you followed? I recommend https://github.com/MaJerle/stm32-usart-uart-dma-rx-tx

    hth

    KnarfB

    Technical Moderator
    January 13, 2023

    Hello @JLEE.21​ and welcome to the Community :),

    Are you using an ST example?

    You can use HAL_UART_Receive_DMA in HAL_UART_RxCpltCallback function to keep receiving data, otherwise you will only receive it once.

    Also, you can add a breakpoint in HAL_UART_Receive_DMA in HAL_UART_RxCpltCallback function to stop the program after data is received, and check rxbuffer.

    When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.

    Thank you

    Kaouthar