Skip to main content
Explorer II
June 24, 2023
Solved

STM32H750 DMA HAL_UART_Receive_DMA acting oddly

  • June 24, 2023
  • 1 reply
  • 1543 views
This is weird.  Also it was working at one point and stopped working, can't track down the code change that broke this.

 

So, I use HAL_UART_Receive_DMA() to start a DMA RX.  I can use _HAL_DMA_GET_COUNTER() to check how many characters have been received and I am receiving characters, but the contents of the buffer I passed to HAL_UART_Receive_DMA() is not changing.  Why would the DMA counter increase but not the memory buffer contents?  I checked the hdmarx handle in the UART handle, the Instance pointer in the hdamarx handle, and the MOAR and PAR pointers in the DMA peripheral - everything looks correct.

 

What more can I do to try to diagnose this problem?

 

Normal DMA (not circular), Peripheral to Memory.  Interrupt should be enabled but I don't think I need it with checking the buffer contents as it's received.

 

I got the idea to poll DMA contents while receiving from this blog post:
And it worked for a while until something in the code broke.

 

This is a program with TouchGFX and it has always been trouble, just stuff in the HAL randomly breaking that has worked before. I currently have TouchGFX disabled right now.
    This topic has been closed for replies.
    Best answer by Pavel A.

    Why would the DMA counter increase but not the memory buffer contents? 

    Mind the cache. Check that the destination memory address can be accessed by the DMA.

    1 reply

    Pavel A.Answer
    Super User
    June 24, 2023

    Why would the DMA counter increase but not the memory buffer contents? 

    Mind the cache. Check that the destination memory address can be accessed by the DMA.

    da66enAuthor
    Explorer II
    June 26, 2023

    @Pavel A. wrote:

    Why would the DMA counter increase but not the memory buffer contents? 

    Mind the cache. Check that the destination memory address can be accessed by the DMA.


    Thanks, I think it was this.  I also got a lot of help from this:

    DMA is not working on STM32H7 devices - STMicroelectronics Community

    I moved DMA buffers to a fixed location and made a new MPU region with cache disabled.