-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add intercore communication example for STM32H755CM4 and CM7 #4184
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
base: main
Are you sure you want to change the base?
Conversation
…ot work in release for now (for some reason)
…probably things that can be done to be able to keep lto, I haven't found yet)
@diondokter Asking for your point of view on this since you did all of the work for the dual core H7 on embassy |
self.led_states.store(new_value, Ordering::SeqCst); | ||
core::sync::atomic::fence(Ordering::SeqCst); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a bunch of places you do this fence after an atomic operation. I don't think this is necessary (though I could be wrong)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed them, it still works
@Ragarnoy Are you referring inlining in the embassy libs? |
nope, inlining the functions in the example |
This pull request introduces intercore communication examples for the STM32H755CM4 and CM7.
This runs fine in dev.
A lot of inlining has to be disabled for this to work in release, otherwise the following symptoms may appear:
Expected behaviour of the example
CM7 Main Loop
Counter increment: every 100 ms, CM7 does counter.store(counter+1).
Green LED toggle: when counter % 10 == 0 (i.e. every 1 s), CM7 flips the green‐bit in led_states.
Yellow LED toggle: when counter % 30 == 0 (i.e. every 3 s), CM7 flips the yellow‐bit.
CM4 Observer Task
Heartbeat Task: CM4’s blink_heartbeat toggles the red LED every 500 ms, independent of shared memory.
Shared‐LED Sync: In its main loop (polled every 10 ms), CM4:
Visual Result
Red LED blinking steadily at 2 Hz (heartbeat).
Green LED blinking at 0.5 Hz (1 s on/off).
Yellow LED blinking at ≈0.166 Hz (3 s on/off), phase-aligned to the green toggles.
When detaching the RTT logging, the first core is halted, but the red led will keep blinking since it's driven by the second core.