mirror of
https://github.com/D-Modem/hardware.git
synced 2026-11-28 17:48:05 -08:00
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
24 lines
861 B
C
24 lines
861 B
C
/*
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
* Copyright (C) 2026 Neo-Desktop
|
|
*/
|
|
// The WB stick's codec on the RP2040: its pins, MCLK, I2C, and its I2S
|
|
// frames (PIO and DMA) with the samples through wb_audio.c. Implements
|
|
// wb_hal.h.
|
|
#pragma once
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
#include "wb_audio.h"
|
|
|
|
// The samples (USB reads and writes their streams; the DMA interrupt runs them).
|
|
extern wb_audio_t g_audio;
|
|
|
|
// Pins, LEDs, MCLK (the 12 MHz crystal on GPIO21), I2C1, the PIO program
|
|
// and the DMA channels. Leaves the codec in reset. Call once at startup,
|
|
// before wb_dev_init().
|
|
void codec_hw_init(void);
|
|
// The host opened (alternate setting 1) or closed the stream: the FIFOs emptied.
|
|
void codec_stream(bool on);
|
|
// The modem's samples from USB OUT, into the stream (overruns counted).
|
|
void codec_from_host(const int16_t *s, uint32_t n);
|