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

clear any pending interrupt flag #9680

Merged
merged 1 commit into from
Oct 4, 2024

Conversation

jepler
Copy link
Member

@jepler jepler commented Oct 3, 2024

While debugging, I found that on RP2040 the first looped background write on a StateMachine would be garbled: It the first few outputs would be as expected, but then the data would go back to the start of the buffer.

I realized that this could be due to there already being a pending interrupt on this DMA channel that had occurred previously but never been acknowledged. In fact, by printing the value of dma_hw->intr before this, I could see that it was the case.

After this change, both my special case reproducer from the related issue works, and the odd gaps in LED data transmission seen in the WIP code for TM1814 LEDs was fixed.

I never saw this problem on Feather RP2350, only on Metro RP2040, but I don't know why. It would depend on what had previously happened to the DMA channel that ends up allocated to this PIO state machine. Less likely, it could depend on details of the DMA peripheral that changed between the chips.

Closes: #9678

This PR was prepared so that 9.1.x could be selected as the base branch if desired, but I'm opening this PR with the base branch set to main.

Ping @ladyada

While debugging, I found that on RP2040 the first looped background
write on a StateMachine would be garbled: It the first few outputs
would be as expected, but then the data would go back to the start
of the buffer.

I realized that this could be due to there already being a pending
interrupt on this DMA channel that had occurred previously but never
been acknowledged. In fact, by printing the value of `dma_hw->intr`
before this, I could see that it was the case.

After this change, both my special case reproducer from the related
issue works, and the odd gaps in LED data transmission seen in the
WIP code for TM1814 LEDs was fixed.

I never saw this problem on Feather RP2350, only on Metro RP2040,
but I don't know why. It would depend on what had previously
happened to the DMA channel that ends up allocated to this PIO
state machine. Less likely, it could depend on details of the DMA
peripheral that changed between the chips.

Closes: adafruit#9678
@dhalbert dhalbert merged commit 321d6e9 into adafruit:main Oct 4, 2024
136 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect PIO background write on RP2040
3 participants