Skip to main content
Iivan.1
Associate II
November 23, 2021
Solved

wierd behavior of ETH on STM32H7

I am trying to set up ethernet on stm32h745iit6.

I bare ethernet project from the H7 examples and use (low_level_output) func from ethernetif.cpp.

I send buffer, located 0x24000008, where dma can access. And ethernet always send only init string of buffer. When I try to change content of the buf from code, its changes (as i saw in debug) at location 0x24000008. But in wireshark i still recieving init content of the value (string, that no longer exist).

When i change content of the buffer from debug at the same location, its ok and recieve correct string with all changes, that was made in debug.

Also a watch on the descriptor field DESC0, there 0x24000008, where located my buf.

Is there any explanation of this wierd moment? How i should change content of buf so that it works correctly ? Maybe data cashes somewere in DMA or MTL?

This topic has been closed for replies.
TDK
TDKBest answer
November 23, 2021
Align your buffer to cache boundaries.
Call SCB_CleanDCache_by_Addr on the appropriate cache-aligned buffer after writing the data but before sending it out on DMA.
When you receive data, you will need to call SCB_InvalidateDCache_by_Addr after the data is in memory but before you read it.
"If you feel a post has answered your question, please click ""Accept as Solution""."

3 replies

TDK
November 23, 2021

Disable the data cache, or manage it appropriately (e.g. clean buffer before sending out on DMA).

"If you feel a post has answered your question, please click ""Accept as Solution""."
Iivan.1
Iivan.1Author
Associate II
November 23, 2021

yes, it helps to disable D cache. But how to work correctly with enabled D cache ?

TDK
TDKBest answer
November 23, 2021
Align your buffer to cache boundaries.
Call SCB_CleanDCache_by_Addr on the appropriate cache-aligned buffer after writing the data but before sending it out on DMA.
When you receive data, you will need to call SCB_InvalidateDCache_by_Addr after the data is in memory but before you read it.
"If you feel a post has answered your question, please click ""Accept as Solution""."