cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H750 DMA HAL_UART_Receive_DMA acting oddly

da66en
Associate II
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.
1 ACCEPTED SOLUTION

Accepted Solutions
Pavel A.
Evangelist III

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.

View solution in original post

2 REPLIES 2
Pavel A.
Evangelist III

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.


@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.