Skip to content

Keep each clock counter on its own PIO - #63

Closed
PastorL69 wants to merge 2 commits into
PPUC:ppucfrom
PastorL69:fix_sms_load
Closed

PastorL69 wants to merge 2 commits into
PPUC:ppucfrom
PastorL69:fix_sms_load

Conversation

@PastorL69

Copy link
Copy Markdown
Member

count_clock() claims three state machines one by one, and each claim could land on a different PIO, but all three wrote the same dmd_pio. read_clock_count() then read and released all three counters on that last PIO: the detection read a state machine that never counted and failed, and the counters on the other PIO stayed claimed and running.

This happens when another piece of code already holds state machines, e.g. the HUB75 driver with two chains plus stripes on a PPUCDMD: the first detection always failed and the DMD came up a retry (about 1s) later.

Store each counter's PIO in spi_pio/dmd_pio/frame_pio, next to the state machines and offsets the counters already reuse.

PastorL69 and others added 2 commits November 18, 2026 23:23
count_clock() claims three state machines one by one, and each claim
could land on a different PIO, but all three wrote the same dmd_pio.
read_clock_count() then read and released all three counters on that
last PIO: the detection read a state machine that never counted and
failed, and the counters on the other PIO stayed claimed and running.

This happens when another user already holds state machines, e.g. the
HUB75 driver with two chains plus WS2812 strips on a PPUCDMD: the first
detection always failed and the DMD came up a retry (about 1s) later.

Store each counter's PIO in spi_pio/dmd_pio/frame_pio, next to the
state machines and offsets the counters already reuse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The frame detection starts the reader through a PIO IRQ, and PIO IRQs
only reach state machines of the same PIO. Both were claimed one by
one, so they could land on different PIOs: the reader then waited for
an IRQ that never came and no frame was read.

Before the previous commit the counters a failed detection left behind
happened to fill the PIO that would have split them. Now that they are
released, a PPUCDMD with two HUB75 chains and speaker lights put the
reader and the frame detection on different PIOs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@PastorL69 PastorL69 closed this Nov 18, 2026
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.

1 participant