Skip to content

feat(autoresearch): accept LPC-Link2 CMSIS-DAP VID:PID for LPC845-BRK - #3494

Merged
zackees merged 1 commit into
masterfrom
feat/lpc-link2-vidpid
Jul 1, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/lpc-link2-vidpid

Conversation

@zackees

@zackees zackees commented Jul 1, 2026 •

Copy link
Copy Markdown
Member

Summary

Newer LPC845-BRK / LPCXpresso boards ship with NXP's LPC-Link2 CMSIS-DAP firmware pre-flashed on the on-board debug probe. That firmware presents the LPC845's USART0 as a VCOM alongside the CMSIS-DAP HID interface at VID:PID 1FC9:0132 (NXP's own VID), not the community-pool 16C0:0483 used by the older LPCXpresso VCOM firmware. ci/util/port_utils.py only knew about the latter, so bash autoresearch lpc845brk failed at port detection on any board with the newer firmware.

Change the map from single-VID:PID to tuple-of-VID:PIDs so an env accepts any of several firmware variants. All five LPC8xx canary envs now accept both fingerprints; the first port matching any listed pair wins.

Backwards compat

  • Renamed to ENVIRONMENT_TO_VCOM_VID_PIDS (plural).
  • Kept ENVIRONMENT_TO_VCOM_VID_PID as a shim derived from the first entry per env — deprecated, slated for removal once no in-repo callers remain.
  • Error message now lists BOTH accepted fingerprints when neither is found.

Tests

TestAutoDetectUploadPort — 5/5 pass:

Ruff clean.

Refs

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • USB device detection now supports multiple accepted fingerprints for an environment, improving compatibility with more hardware variants.
    • Added coverage for additional LPC845BRK connection fingerprints.
  • Bug Fixes

    • Port auto-detection now recognizes either supported VID:PID match instead of requiring one exact pair.
    • Error messages now show all accepted fingerprints when no match is found, making setup issues easier to diagnose.

Newer LPC845-BRK / LPCXpresso boards ship with NXP's LPC-Link2 CMSIS-DAP
firmware pre-flashed on the on-board debug probe. That firmware presents
the LPC845's USART0 as a virtual COM port alongside the CMSIS-DAP HID
interface at VID:PID 1FC9:0132 — NXP's own USB VID, not the community
"V-USB" pool used by the older LPCXpresso VCOM firmware (16C0:0483).

`ci/util/port_utils.py::ENVIRONMENT_TO_VCOM_VID_PID` only knew about
16C0:0483, so `bash autoresearch lpc845brk` failed at port detection on
any board with the newer firmware:

    No USB serial port matched expected VCOM fingerprint for 'lpc845brk'
    (VID:PID 16C0:0483). Detected USB ports: COM10=1FC9:0132, ...

Change the map from single-VID:PID to tuple-of-VID:PIDs so an env can
accept any of several firmware variants. All four LPC8xx canary board
envs (lpc845brk, lpc845, lpc804, lpcxpresso845max, lpcxpresso804) now
accept both fingerprints; the first port matching ANY listed pair wins.

## Backwards compatibility

Renamed the map to `ENVIRONMENT_TO_VCOM_VID_PIDS` (plural). A shim
`ENVIRONMENT_TO_VCOM_VID_PID` derived from the first entry of each list
is exported for any external caller that still reads the singular name;
deprecated and slated for removal once no in-repo callers remain.

Error message now lists BOTH accepted fingerprints when neither is
found, so users on Windows can immediately see which firmware the
scanner is looking for:

    No USB serial port matched expected VCOM fingerprint for 'lpc845brk'
    (VID:PID 16C0:0483 or 1FC9:0132). Detected USB ports: ...

## Tests

Added three test cases to `TestAutoDetectUploadPort` covering:

  - Match on the primary (LPCXpresso) 16C0:0483 fingerprint.
  - Match on the LPC-Link2 CMSIS-DAP 1FC9:0132 fingerprint.
  - Error message mentions BOTH VID:PIDs when neither matches.

Also fixed a pre-existing stale assertion in the same test class:
`test_expected_environment_probe_failure_falls_back_to_descriptor`
was asserting `detect_attached_chip("COM9", timeout=3.0)` but the
call site dropped the explicit 3.0s timeout override in #3446 so the
richer 15s default kicks in. Assertion now matches the actual call.

5/5 tests in `TestAutoDetectUploadPort` pass. Ruff clean.

Refs #3468 (unblocks on-silicon `bash autoresearch --pwm-dma-cl` port
detection for the SCT+DMA channels-API validation harness) and the
broader #3300 / #3450 LPC restoration meta.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@zackees
zackees merged commit aca1bc5 into master Jul 1, 2026
7 of 10 checks passed
@coderabbitai

coderabbitai Bot commented Jul 1, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a1511465-9aff-43e8-aa58-9789ff35c517

📥 Commits

Reviewing files that changed from the base of the PR and between 67edc42 and b1a45c1.

📒 Files selected for processing (2)
  • ci/tests/test_autoresearch_phases.py
  • ci/util/port_utils.py

📝 Walkthrough

Walkthrough

This PR extends USB VCOM fingerprint matching in auto_detect_upload_port to accept multiple VID:PID pairs per environment via a new plural mapping, updates the mismatch error to list all accepted fingerprints, and adds/adjusts corresponding tests.

Changes

Multi-fingerprint VCOM detection

Layer / File(s) Summary
Plural VID:PID mapping and matching logic
ci/util/port_utils.py
Adds ENVIRONMENT_TO_VCOM_VID_PIDS for multiple accepted VID:PID pairs per environment, derives the legacy single-pair constant from it, updates matching to accept any port whose VID:PID is in the accepted set, and updates the mismatch error message to list all accepted fingerprints.
Test coverage for fingerprint matching
ci/tests/test_autoresearch_phases.py
Removes explicit timeout=3.0 assertion on detect_attached_chip call, and adds tests validating both accepted lpc845brk VID:PID fingerprints plus a failure test asserting both are listed when neither matches.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • FastLED/FastLED#3339: Modifies the same ci/util/port_utils.py VID:PID fingerprint matching and mismatch error logic for LPC845-BRK detection.
  • FastLED/FastLED#3447: Touches the same auto_detect_upload_port/detect_attached_chip timeout handling that this PR's test update reflects.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/lpc-link2-vidpid

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant