Repository navigation
machine/rp2: stop SPI1 transmit from restarting SPI0 DMA - #6010
Merged
deadprogram merged 1 commit intoOct 24, 2026
Merged
Conversation
Each SPI1 transmit restarted the SPI0 DMA channel, so SPI0 sent bytes from memory past the end of its previous buffer. The SPI DMA channels now chain to themselves, and SPI1 no longer affects SPI0. Fixes tinygo-org#6009
deadprogram
approved these changes
Oct 24, 2026
deadprogram
left a comment
Member
There was a problem hiding this comment.
Tested and it does what it claims @davecheney thank you very much. Now merging.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On RP2040 and RP2350, each SPI1 transmit restarted the SPI0 DMA channel. SPI0 then sent bytes from memory after the end of its last buffer. That memory can be freed, reused, or outside the allocation. This has been present since DMA SPI was added in 3b4e543.
With this change, SPI1 transmits no longer affect SPI0.
The traces below are from a Pico 2 W with both buses at 1 MHz. The test sends 64 bytes on SPI0, then 2 bytes on SPI1. Without the fix, SPI0 sends 512 extra clock pulses carrying bytes 0x40 to 0x7f, the unsent half of the buffer. With the fix, SPI0 stays idle.
Tested on a Pico 2 W. I did not test on a Pico (RP2040), but it uses the same code.
Fixes #6009