Skip to main content
Visitor II
November 23, 2021
Solved

wierd behavior of ETH on STM32H7

  • November 23, 2021
  • 1 reply
  • 1158 views

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.
    Best answer by TDK
    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.

    1 reply

    Super User
    November 23, 2021

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

    Iivan.1Author
    Visitor II
    November 23, 2021

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

    TDKAnswer
    Super User
    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.