SLAA557: the PGA soft-steps from mute after power-up; page 0 register
36 D7/D3 say when it has reached the programmed gain. The bring-up now
waits for them with the ADCs' power flags (200 ms at most), and a test
covers a codec whose MicPGAs never get there.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013PRsUCpxazyipPn5UGGkF8
pico-serial WB (SPEC-WB.md): the Line stick's USB device in front of a
TLV320AIC3204 codec at 96 kHz (48 and 192 kHz for tests), USB 1209:0003.
- Clocks (SPEC-WB 4): MCLK is the 12 MHz crystal on GPIO21 (GPOUT0);
the codec's PLL P=1 R=1 J.D=8.1920 makes 98.304 MHz; NDAC=NADC=
MDAC=MADC=4; 96 kHz: DOSR=AOSR=64, PRB_P7/PRB_R7, BCLK N=4 (6.144
MHz, 64 a frame); 192 kHz: 32, PRB_P17/PRB_R13, N=2; 48 kHz: 128,
PRB_P1/PRB_R1, N=8. The codec is the I2S master, 32-bit words.
- Bring-up (src/core/wb_codec.c) in SLAA557's order: pin and software
reset, PLL, dividers, I2S, INT1 on MFP5, weak AVDD off then the A-LDO
at 1.77 V, CM 0.9 V, the left DAC's + and - to HPL and HPR (one DAC,
a differential drive), drivers up and their gain flags waited for,
then the DAC and both ADCs, their flags waited for.
- The hybrid in the left MicPGA: + IN1L, IN1R; - IN2R, IN3R; 10 k each
(P1 R52=0x41, R54=0x14): line minus replica. The right MicPGA takes
the line alone (IN2R - IN1L, 20 k); the replica alone can't be routed
differentially.
- I2S slave in PIO (src/wb/i2s.pio), full duplex, DMA ping-pong blocks of
32 frames into src/core/wb_audio.c; out of step, it stops and is
restarted (counted).
- Requests (src/core/wb_proto.h): info, status (peaks, codec flags),
rate, carrier LED, TX gain (DAC volume), RX gain (MicPGA), input
channel, firmware and codec loopbacks, codec register read/write by
page, reset, UF2. Mono S16 packets up to 240 samples (480 bytes).
- test_wb.c: the clocks re-derived from the registers and checked
against SLAA557's limits for every rate, the MicPGA bits against the
netlist, the bring-up order and timeouts, packet sizing, the samples
path, the requests. Each of 15 deliberate breaks is caught.
- CI builds PS_BOARD=wb and runs test_wb.
All five boards build (SDK 2.3.1, TinyUSB 0.21.0); host tests and
check_docs pass. Nothing has run on a WB board yet.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013PRsUCpxazyipPn5UGGkF8
Ahead of the wideband stick, which needs the same USB device and the
same sample streams as the Line stick:
- src/core/sstream.c: the two sample streams (head start, under- and
overruns, counters), out of daa_frame.c; line_stream_t is now the
frames plus an sstream_t.
- src/stick/usb_stick.c (was src/line/usb_line.c): descriptors, class
driver and Microsoft OS 2.0 set, with the stick's numbers and requests
behind stick.h; the Line stick's part is src/line/line_stick.c. The
descriptors are the same bytes as before.
- sfifo.h: SFIFO_SIZE can be set per build.
Line builds; host tests (test_line unchanged but for field paths) and
check_docs pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013PRsUCpxazyipPn5UGGkF8
pico-serial Line's firmware: a USB front end for its Si3056 + Si3018 DAA,
the modem itself being D-Modem on the host (SPEC-L.md).
- Si3056 bring-up: 48 MHz MCLK from the USB PLL on GPIO21, reset in
serial mode 0, PLL1 N = 125 / M = 256, 9600 Hz, 16-bit mode, line side
powered up; FDT checked.
- si3056.pio: the RP2040 as the serial port's slave; every word through
the portable frame engine (daa_frame.c) from the PIO's interrupt.
Register accesses ride in secondary frames (LSB flag, then FC pin).
- USB: one vendor interface shaped like the SmartUSB56's (alt 1:
isochronous OUT/IN at 1 ms, IN lengths set by the codec's clock, and an
interrupt endpoint for events), vendor requests for rate, hook, flash,
line monitor, register access, status, reset, UF2; 1209:0002.
- Host tests (test_line.c): the frame engine against a model of the
Si3056's serial port, the sample streams, the device logic; mutations
of the frame engine are caught. PROTOCOL.md "Line stick" documents it
for the host's driver; CI builds it.
Not yet run on hardware.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013PRsUCpxazyipPn5UGGkF8
PS_BOARD=w builds for the W board: the RM2 wired as on Pico W, with
BTstack polled from the main loop.
- Classic SPP server ("pico-serial", RFCOMM 1) with credit-based flow
control; LE Nordic UART Service plus the pico-serial control service
(line coding, outputs, inputs, mode, break, flow, credits, info).
- Port ownership (SPEC-W 4.6) in a new portable links layer
(src/core/link.c): USB with its port open, else the first wireless
link, else USB. The wired boards behave as before.
- Over SPP, DCD follows the phone's CONNECT / NO CARRIER.
- Pairing only in a 2-minute window (at power-up with no bonds, PAIR
button, or a new USB request); hold PAIR 10 s to forget. Up to 4 bonds
in flash, below the settings sector. Just Works with LE Secure
Connections / SSP; data and control need an encrypted link.
- BT LED shows advertising, the pairing window or a connection; RD/SD go
to the RM2's GPIOs.
- Host tests for the links layer; CI builds the W image.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013PRsUCpxazyipPn5UGGkF8
A rate too fast can split one character (a lone CR, as Enter sends on
many terminals) into two "characters", which passed the 2-character
rule: a lone CR locked onto the wrong rate in 80% of trials. Now the
rate is chosen first, and the 2 characters are counted only at that
rate, so one character waits.
Tests: one-character cases (CR, LF, 0x55, 0xFF...) at every rate must
not decide; CR LF and CR CR must lock and decode at every rate. Docs
note that Enter (CR LF), or Enter twice on a CR-only terminal, is
enough to learn the rate.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013PRsUCpxazyipPn5UGGkF8
As DCE the board now works out the computer's baud rate from what it
types, like a Hayes modem, so the host's speed setting doesn't have to
match the terminal's.
- PIO (autobaud.pio) times each low/high stretch on the RX pin while the
UART keeps the pin.
- src/core/autobaud.c decodes those timings at every standard rate
(110-230400) and picks the one they fit: bit length vs the shortest
stretch, edges on bit boundaries, framing/parity, then the slowest rate
whose edges score near the best.
- The characters it learned from ("AT") are decoded and passed on; the
UART switches only once the line is idle.
- Re-learns on 3 framing errors in 2 s, AUTOBAUD_RESTART, or a new peer.
- Baud mode setting (saved, settings byte 7): auto (learn as DCE, host's
as DTE), host, learn. Vendor requests 8 SET_BAUD_MODE and
9 AUTOBAUD_RESTART; GET_INFO grows to 14 bytes with flags
BAUD_LOCKED/BAUD_LEARNING and the baud mode.
- Tests: detector suite (every rate, 5 formats, jitter, rate error,
glitches, mid-character starts), 5 new core tests, and the emulator
test drives "AT\r" at 9600 and "ATI3\r" at 115200 onto GP1 with PIO
stepped per CPU cycle.
- Docs: firmware README, PROTOCOL.md, SPEC.md 5.7 and 6.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013PRsUCpxazyipPn5UGGkF8
Same arrangement as the rest of D-Modem: LICENSING.md, the AGPL text in
firmware/COPYING, and an SPDX-License-Identifier line in every firmware
source file (and the generated pin header, via build_netlist.py). Notes
the third-party parts (Pico SDK, picotool, TinyUSB, rp2040js, the boot
ROM, KiCad symbols). The hardware's licence is not yet decided.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013PRsUCpxazyipPn5UGGkF8
firmware/: Pico SDK 2.3.1 + TinyUSB 0.21.0 (for CDC SERIAL_STATE).
- portable core (src/core): role detection from chip A STATUS / chip B
INVALID with both chips off (3 x 50 ms samples, 1 s loss), modem-line
mapping (DCE: host DTR -> DCD+DSR, RTS -> CTS; DTE: DTR/RTS through),
hold-off at 3/4 buffer, FLOW_AUTO latch for 3-wire cables, SERIAL_STATE
with one-shot error events, line coding with flagged adjustments,
timed break, settings in flash with CRC
- RP2040 layer: GPIO with the transceivers' inversion, UART with IRQs and
per-byte error flags, UART pins routed to the active chip, flash
settings, watchdog; USB composite: CDC, the pico-serial control vendor
interface (PROTOCOL.md) and Raspberry Pi's reset interface (picotool)
- GPIO numbers generated from the netlist (build_netlist.py now writes
firmware/src/generated/board_pins.h)
- boards: hood (16 MB flash, crystal margin) and a Pico bench rig
Tests: 22 host tests on the core with a fake HAL (sanitizers; checked by
breaking the core on purpose), and an end-to-end test that boots the real
image in rp2040js: enumeration, detection, line mapping, data both ways,
SERIAL_STATE, vendor requests, DTE mode (20 checks). CI workflow runs
both plus builds for both boards. Not yet run on hardware.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013PRsUCpxazyipPn5UGGkF8