Skip to content

Add nice!nano v2 board support#100

Open
RandoSY wants to merge 1 commit into
h2zero:masterfrom
RandoSY:agent/add-nice-nano-v2
Open

Add nice!nano v2 board support#100
RandoSY wants to merge 1 commit into
h2zero:masterfrom
RandoSY:agent/add-nice-nano-v2

Conversation

@RandoSY

@RandoSY RandoSY commented Jul 10, 2026

Copy link
Copy Markdown
  • Added nicenano_v2 board entry in boards.txt
  • Added variants/nice_nano_v2
  • Mapped Pro Micro-style Nice!Nano pins, LED, VBAT, VCC cutoff, UART, I2C, SPI
  • Added UF2 generation for Nice!Nano using family 0xADA52840
  • Added README docs for Nice!Nano and UF2 drag/drop

Validation passed:

  • Blink-style sketch compiles
  • BLE_Advertiser NimBLE example compiles with NimBLE-Arduino 2.5.0
  • UF2 output starts at 0x26000
  • UF2 family is 0xADA52840
  • Generated UF2 matched Adafruit uf2conv.py byte-for-byte for the same HEX

Summary by CodeRabbit

  • New Features

    • Added support for the nice!nano v2 board, including pin mappings, LED initialization, USB settings, and configurable communication interfaces.
    • Added UF2 firmware export for compatible boards, including command-line conversion from Intel HEX files.
    • Added board options for bootloader type, wireless roles, and debug logging.
  • Documentation

    • Added nice!nano v2 to the supported boards list.
    • Documented uploading firmware through UF2 bootloader mode, including the Python 3 requirement.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

Arrr, this adds complete nice!nano v2 support: board and variant definitions, UF2 conversion from Intel HEX, upload configuration, bootloader options, and documentation for UF2 programming.

nice!nano v2 hardware variant

Layer / File(s) Summary
Board hardware contract and pin interfaces
variants/nice_nano_v2/variant.h, variants/nice_nano_v2/variant.cpp
Defines clocks, pin constants, analog/serial/SPI/I2C mappings, digital pin translation, and LED startup initialization.

UF2 export and board integration

Layer / File(s) Summary
Intel HEX to UF2 conversion
tools/uf2conv.py, platform.txt
Validates Intel HEX records, builds aligned UF2 blocks, writes family-tagged images, and configures Python commands by platform.
Board build and upload configuration
boards.txt, platform.txt
Adds the nice!nano v2 board definition, upload settings, build metadata, UF2 recipe, bootloader variants, and nRF utility configuration.
UF2 usage documentation
README.md
Lists nice!nano v2 as supported and documents bootloader reset, UF2 copying, and the Python 3 requirement.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ArduinoBuild
  participant uf2conv.py
  participant UF2Bootloader
  participant nice_nano_v2
  ArduinoBuild->>uf2conv.py: Convert Intel HEX with family ID
  uf2conv.py-->>ArduinoBuild: Produce UF2 image
  ArduinoBuild->>UF2Bootloader: Copy UF2 image
  UF2Bootloader->>nice_nano_v2: Program firmware
Loading

Poem

Arrr, new pins be charted in neat array,
UF2 treasures sail the buildin’ way.
HEX lines parse, blocks march in a row,
Bootloader doors swing open below.
nice!nano v2 joins the crew—
Compile, copy, and set sail true!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely matches the main change: adding nice!nano v2 board support.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@README.md`:
- Around line 127-131: Expand the “Uploading via UF2” section with the exact IDE
action used to export the .uf2 file, then document how to reset the board into
its UF2 bootloader, including the required reset-button or reset-sequence steps
before copying the file to the mounted drive.

In `@tools/uf2conv.py`:
- Around line 31-44: The HEX parser must reject type-specific structural errors
and trailing data after EOF. Update the record parser function containing the
length/checksum validation to enforce required payload lengths and addresses for
each supported record type, including a valid zero-length EOF record; then
update the main record-processing loop to require exactly one EOF, reject any
non-empty records after it, and fail when EOF is missing instead of silently
stopping.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 25c5a43d-dd9f-43bc-9d38-7c74a46489f6

📥 Commits

Reviewing files that changed from the base of the PR and between 470a97a and 1f082f7.

📒 Files selected for processing (6)
  • README.md
  • boards.txt
  • platform.txt
  • tools/uf2conv.py
  • variants/nice_nano_v2/variant.cpp
  • variants/nice_nano_v2/variant.h

Comment thread README.md
Comment on lines +127 to +131
### Uploading via UF2
Boards with an Adafruit UF2 bootloader, such as the nice!nano v2, can be reset
into the bootloader and programmed by copying the exported `.uf2` file to the
mounted bootloader drive. UF2 export requires Python 3 to be available on the
system path.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Arrr, add the missing UF2 workflow steps.

This section says to copy an “exported” .uf2 file but does not explain how to export it or how to trigger the board’s UF2 bootloader. Add the exact IDE action and reset sequence so users can complete the documented workflow.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` around lines 127 - 131, Expand the “Uploading via UF2” section
with the exact IDE action used to export the .uf2 file, then document how to
reset the board into its UF2 bootloader, including the required reset-button or
reset-sequence steps before copying the file to the mounted drive.

Comment thread tools/uf2conv.py
Comment on lines +31 to +44
if len(raw) < 5:
raise ValueError(f"line {line_number}: record is too short")

count = raw[0]
if len(raw) != count + 5:
raise ValueError(f"line {line_number}: record length mismatch")

if (sum(raw) & 0xFF) != 0:
raise ValueError(f"line {line_number}: checksum mismatch")

address = (raw[1] << 8) | raw[2]
record_type = raw[3]
payload = raw[4:4 + count]
return record_type, address, payload

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Arrr, reject malformed HEX records before generating firmware.

The parser accepts invalid type-specific lengths—for example, extended-address records with payloads other than 2 bytes—and accepts malformed EOF records. It also stops at the first EOF and silently ignores any subsequent records, which can produce a partial or incorrectly addressed UF2 image.

Validate each record type’s required byte count and address, require exactly one valid EOF record, and reject non-empty content after EOF.

Also applies to: 57-71

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tools/uf2conv.py` around lines 31 - 44, The HEX parser must reject
type-specific structural errors and trailing data after EOF. Update the record
parser function containing the length/checksum validation to enforce required
payload lengths and addresses for each supported record type, including a valid
zero-length EOF record; then update the main record-processing loop to require
exactly one EOF, reject any non-empty records after it, and fail when EOF is
missing instead of silently stopping.

@RandoSY

RandoSY commented Jul 11, 2026

Copy link
Copy Markdown
Author

I test on Arm(Nim)BLE Boards 4.0. Work well on BLE Scan example.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant