cancel
Showing results for 
Search instead for 
Did you mean: 

wierd behavior of ETH on STM32H7

Iivan.1
Associate II

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?

1 ACCEPTED SOLUTION

Accepted Solutions
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".

View solution in original post

3 REPLIES 3
TDK
Guru

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

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

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