-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
STM32 Cache coherence #520
Comments
Hi mulcmu Same questions/ideas:
Best regards Peter |
... another thought: |
Everything looks good in the stack snapshot, let me do a similar analysis on the STM32F746 target. |
Cycle time was the default 200ms. At 200ms the malformed packets appeared randomly distributed, I didn't see any patterns. This post on ST community forum discusses similar problem. Seems that on my H745, sometimes the processor cached data is written out to the memory before the DMA reads it for the valid packets. For the malformed packets the outgoing message buffer data is only in the MCU cache, so the DMA is copying the SRAM memory that holds random data. OpENer/source/src/ports/generic_networkhandler.c Lines 682 to 719 in 70d6947
I reverted my prior hack and then on line 693 of the SendUdpData() an explicit cache flush was added.
This change also resolved the malformed packet issue for the implicit messaging. |
Great, that you found out this so quickly! |
I was still working through things, I have 2 H7 (H757 & H745), an H563, and the F746. The clean cache() function doesn't seem to hurt the F746 but there were a few times ping, http, and list identity would work but then the rest of the ethernet/IP appeared with errors. Still trying to figure out what was changing. I started a branch with the changes. https://github.com/mulcmu/OpENer/tree/stm32-flush-cache-CMSISv2. |
@PeterChristen577 First off, thanks for contributing the STM32 port. Below problem was encountered running on a H7 cpu.
I got the demo running fine on the STM32F746-Disco board. I imported OpENer successfully into a new STM32F746-Disco TouchGFX template project. Needed one small change for freeRTOS CMSIS_V2 vs _V1. Both these were tested with enip/explorer and wireshark. Explicit and implicit messaging working perfect.
I imported into a STM32H745I-Disco TouchGFX template project. Got everything setup for this board but started getting some random data in the enip/explorer implicit messaging. Wireshark showed a few good packets were transmitted and then one or two malformed packets would be sent. Troubleshooting this lead to what appears to be a cache coherence issue.
In cipioconnection.c SendConnectData(...) I changed the the outgoing message to
and stuck this with the non-cached lwip heap memory. This got the sample application running on this board without any malformed io packets (at least for single connection). The cpu frequency was higher on this board and the ETH is MII vs RMII which might be contributing factors. I didn't check the F746 to see if malformed packets were still occurring but just way less frequently.
Any ideas for a more elegant solution than the above hack?
The text was updated successfully, but these errors were encountered: