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
37 lines
1.3 KiB
Makefile
37 lines
1.3 KiB
Makefile
# SPDX-License-Identifier: AGPL-3.0-only
|
|
# Copyright (C) 2026 Neo-Desktop
|
|
# Host tests for the portable core: make -C firmware/test
|
|
CFLAGS ?= -std=c11 -O1 -g -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -fsanitize=address,undefined
|
|
CORE = ../src/core/core.c ../src/core/autobaud.c
|
|
DEPS = $(CORE) $(wildcard ../src/core/*.h) fake_hal.h wave.h wave.c
|
|
|
|
all: test_core test_autobaud test_link test_line test_wb
|
|
|
|
test_core: test_core.c fake_hal.c $(DEPS)
|
|
$(CC) $(CFLAGS) -o $@ test_core.c fake_hal.c wave.c $(CORE) -lm
|
|
|
|
test_autobaud: test_autobaud.c $(DEPS)
|
|
$(CC) $(CFLAGS) -o $@ test_autobaud.c wave.c ../src/core/autobaud.c -lm
|
|
|
|
test_link: test_link.c fake_hal.c ../src/core/link.c $(DEPS)
|
|
$(CC) $(CFLAGS) -o $@ test_link.c fake_hal.c ../src/core/link.c $(CORE) -lm
|
|
|
|
LINE = ../src/core/daa_frame.c ../src/core/sstream.c ../src/core/line_dev.c
|
|
test_line: test_line.c $(LINE) $(wildcard ../src/core/*.h)
|
|
$(CC) $(CFLAGS) -o $@ test_line.c $(LINE)
|
|
|
|
WB = ../src/core/sstream.c ../src/core/wb_audio.c ../src/core/wb_codec.c ../src/core/wb_dev.c
|
|
test_wb: test_wb.c $(WB) $(wildcard ../src/core/*.h)
|
|
$(CC) $(CFLAGS) -DSFIFO_SIZE=4096u -o $@ test_wb.c $(WB)
|
|
|
|
.PHONY: all run clean
|
|
run: all
|
|
./test_core
|
|
./test_autobaud
|
|
./test_link
|
|
./test_line
|
|
./test_wb
|
|
|
|
clean:
|
|
rm -f test_core test_autobaud test_link test_line test_wb
|