Commit Graph
5 Commits
Author SHA1 Message Date
Claude cddb085d4e firmware: Bluetooth for pico-serial W (BLE NUS, SPP, pairing)
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
2026-10-18 10:53:28 +00:00
Claude d5f9e0bd2d Auto-baud: don't lock on a single character
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
2026-10-18 01:36:52 +00:00
Claude d18fcbcca7 Firmware: learn the far end's baud rate (auto-baud)
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
2026-10-18 01:18:45 +00:00
Claude 886d6742d9 Licensing: firmware under AGPL-3.0-only or a commercial licence
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
2026-10-18 00:37:17 +00:00
Claude d61e37ba5e Firmware v0.1: USB CDC to RS-232 with DCE/DTE auto-detect
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
2026-10-17 19:15:50 +00:00