How amr-lounis/pico-dcsd works
This RP2040 firmware replaces a DCSD Alex cable: a connected Apple device triggers a Lightning/Tristar handshake, which enables its debug UART, then the Pico bridges that UART to the host over USB CDC. The main loop initializes USB, launches the protocol task on Core 1, and tracks session changes to start or stop the bridge. Handshake framing uses a CRC helper and PIO programs for SDQ signaling. README capabilities such as repair diagnostics and recovery are uses of the exposed serial console, not separate firmware stages. Source excerpts establish the main calls; PIO implementation details were not sampled.
Main entry points: tristar.c Tristar state machine · main.c Main loop · dcsd_uart.c UART bridge · tusb_config.h TinyUSB CDC
Components 10
Firmware control
- Main loop
main.c
Lightning handshake
- Tristar state machine
tristar.c - SDQ receive program
lightning_rx.pio - SDQ transmit program
lightning_tx.pio - CRC helper
crc.c
Serial transport
- UART bridge
dcsd_uart.c
USB interface
- CDC descriptors
usb_descriptors.c - TinyUSB CDC
tusb_config.h
Other components
- Apple device
- PC terminal
Connections 13
- Main loop → TinyUSB CDC: initializes
main.c - Main loop → Tristar state machine: launches task
main.c - Main loop → Tristar state machine: checks session
main.c - Tristar state machine → SDQ receive program: receives SDQ
tristar.c - Tristar state machine → SDQ transmit program: sends replies
tristar.c - Tristar state machine → CRC helper: calculates CRC
tristar.c - Apple device → Tristar state machine: sends requests
README.md - Tristar state machine → Apple device: replies handshake
README.md - Main loop → UART bridge: starts or stops
main.c - Main loop → UART bridge: runs bridge task
main.c - UART bridge → TinyUSB CDC: exchanges CDC data
dcsd_uart.c - CDC descriptors → PC terminal: identifies device
README.md - PC terminal → TinyUSB CDC: reads console
README.md