Skip to content
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

Fix async SPI with ESP32 #3057

Merged
merged 2 commits into from
Jan 30, 2025
Merged

Fix async SPI with ESP32 #3057

merged 2 commits into from
Jan 30, 2025

Conversation

bugadani
Copy link
Contributor

@bugadani bugadani commented Jan 29, 2025

The previous implementation was very brittle. Based on code alignment (which is a symptom, not a cause), the TransferDone interrupt may or may not fire. This behaviour can be triggered by strategically inserting nops - a certain number triggers the bug, one more or less does not. Sometimes nops inserted at seemingly unrelated places also change the behaviour.

A lot of experimentation leads me to believe that there is some very specific, but (to me) unknown set of conditions, that may prevent the interrupt bit from being set. The issue isn't timing in the sense that inserting a very large delay between start and listen does not trigger the issue - I think the delay has to be very specific.

Code alignment likely had an effect because that timing may have just been precise enough to be sensitive to code cache misses.

This is all very nebulous, but the current PR seems to be resilient against my efforts, so I'm hopeful this issue goes away.

@bugadani bugadani added the skip-changelog No changelog modification needed label Jan 29, 2025
@bugadani

This comment was marked as outdated.

@bugadani bugadani marked this pull request as draft January 29, 2025 13:38
@bugadani bugadani changed the title Insert nop into fifo read loop Fix async SPI with ESP32 Jan 30, 2025
@bugadani bugadani marked this pull request as ready for review January 30, 2025 10:27
Copy link
Contributor

@bjoernQ bjoernQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When working around random weirdness whatever works, works

Copy link
Contributor

@JurajSadel JurajSadel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@JurajSadel JurajSadel enabled auto-merge January 30, 2025 12:04
@JurajSadel JurajSadel added this pull request to the merge queue Jan 30, 2025
Merged via the queue into esp-rs:main with commit 0ddcbf5 Jan 30, 2025
27 of 28 checks passed
@bugadani bugadani deleted the nop branch January 30, 2025 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-changelog No changelog modification needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants