Skip to main content
Associate
May 1, 2025 12:57 PM UTC
Solved

STM32H7S Uart TX using GPDMA only transmits 0x00 if DCache is enabled

Hi,

I have a well functioning application transmitting on uart4 using GPDMA1 CH1.

If I turn on DCache, then it does transmit the correct length, only all characters are 0x00 (no problem in turning ICache on).

In HAL_UART_Transmit_DMA(huart, (const uint8_t*)pTx, len), if I make this substitution: HAL_UART_Transmit_DMA(huart, (const uint8_t*)"Hi "/*pTx*/, 3/*len*/), then it works.

I have tried allocating the variable pointed to by pTx to just about any available memory area / type without success.

Any suggestions?

 

This topic has been closed for replies.
TDK
TDKBest answer
May 1, 2025 1:01 PM UTC

After writing the values to memory, but before sending them with DMA, clean the cache with SCB_CleanDCache_by_Addr.  You'll need to ensure the buffer is aligned to a cache page.

 

Managing Cache Coherency on Cortex-M7 Based MCUs

"If you feel a post has answered your question, please click ""Accept as Solution""."

4 replies

TDK
TDKBest answer
May 1, 2025 1:01 PM UTC

After writing the values to memory, but before sending them with DMA, clean the cache with SCB_CleanDCache_by_Addr.  You'll need to ensure the buffer is aligned to a cache page.

 

Managing Cache Coherency on Cortex-M7 Based MCUs

"If you feel a post has answered your question, please click ""Accept as Solution""."
ThorPSAuthor
Associate
May 7, 2025 11:24 AM UTC

Thanks, it solved the problem about transmission.

It seems there is a similar issue with reception, but now I know what to do I guess.

 

TDK
May 7, 2025 12:52 PM UTC

> It seems there is a similar issue with reception

As the app note says, after receiving data with DMA, but before reading it with the CPU, invalidate that region with SCB_InvalidateDCache_by_Addr.

"If you feel a post has answered your question, please click ""Accept as Solution""."