Skip to content

ports/raspberrypi: pull Pico-PIO-USB deterministic SYNC realignment (Fruit Jam USB host wedge)#11135

Draft
mikeysklar wants to merge 1 commit into
adafruit:mainfrom
mikeysklar:fruitjam-rx-framing-recovery
Draft

ports/raspberrypi: pull Pico-PIO-USB deterministic SYNC realignment (Fruit Jam USB host wedge)#11135
mikeysklar wants to merge 1 commit into
adafruit:mainfrom
mikeysklar:fruitjam-rx-framing-recovery

Conversation

@mikeysklar

@mikeysklar mikeysklar commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

DRAFT. Do not merge as is: the submodule temporarily points at my Pico-PIO-USB fork so CI can fetch the commit before it exists upstream.

Pulls the Pico-PIO-USB deterministic SYNC realignment (sekigon-gonnoc/Pico-PIO-USB#211) into the raspberrypi port.

The PIO USB receiver can lock onto an incoming packet a few bits early, so every byte arrives shifted and the aligned CRC check fails on wire data that is perfectly valid. The device retransmits forever, and the endpoint is stuck until reboot. On the Fruit Jam this presents as hub hot plug delivery dying permanently, gated by unrelated build flags (vectorio compiled in but never imported), because the firmware memory layout steers the timing that decides the framing. Full investigation with captures: hathach/tinyusb#3776.

wedge-trace

Fixes #10563. Same root cause as the 3-year-old sekigon-gonnoc/Pico-PIO-USB#97.

Because a correct packet always begins with SYNC (0x80), the shift is not a guess: the fix drops leading bits until SYNC reappears, confirms with the PID check nibble and a recomputed CRC, then delivers. One observed offset, the captured bytes shifted vs the expected packet:

byte expected received
sync 80 01
PID 4b 97
data 02 04
crc lo c1 82
crc hi 7e fd

Validated on the Fruit Jam layout that previously wedged the port on the first hub hot plug and never recovered: 34 consecutive hot plug events all delivered across an automated cycling harvest.

Screenshot 2026-07-22 at 9 57 15 AM

The PIO USB receiver can lock onto an incoming packet a few bits early,
so every byte arrives shifted and the aligned CRC check fails on wire
data that is perfectly valid. The device retransmits forever and the
endpoint is stuck until reboot. On the Fruit Jam this presents as hub
hot plug delivery dying permanently, gated by unrelated build flags
(vectorio compiled in but never imported), because the firmware memory
layout steers the timing that decides the framing.

Pulls sekigon-gonnoc/Pico-PIO-USB#211, which keys the realignment on the
SYNC byte (0x80) to derive the exact shift and recover the packet.
Fixes the 3-year-old sekigon-gonnoc/Pico-PIO-USB#97.

DRAFT: submodule temporarily points at the mikeysklar fork so CI can
fetch the commit. Repoint to the upstream sekigon-gonnoc SHA and restore
the .gitmodules URL once adafruit#211 merges.
@mikeysklar
mikeysklar force-pushed the fruitjam-rx-framing-recovery branch from 2827170 to 650281d Compare July 23, 2026 16:33
@mikeysklar mikeysklar changed the title ports/raspberrypi: pull Pico-PIO-USB one bit RX framing recovery (Fruit Jam USB host wedge) ports/raspberrypi: pull Pico-PIO-USB deterministic SYNC realignment (Fruit Jam USB host wedge) Jul 23, 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.

USB Host: Unplugging device can break usb.core.find()

1 participant