Skip to content

Arduino Nesso N1 support - #10664

Open
fukuen wants to merge 3 commits into
meshtastic:developfrom
fukuen:feature/arduino-nesso-n1-Jun2026
Open

Arduino Nesso N1 support#10664
fukuen wants to merge 3 commits into
meshtastic:developfrom
fukuen:feature/arduino-nesso-n1-Jun2026

Conversation

@fukuen

@fukuen fukuen commented Jun 9, 2026

Copy link
Copy Markdown

This is resubmit of Arduino Nesso N1 support #8784

Issue: [Board]: Arduino Nesso N1 #8744

🤝 Attestations

  • I have tested that my proposed changes behave as described.
  • I have tested that my proposed changes do not cause any obvious regressions on the following devices:
    • Heltec (Lora32) V3
    • LilyGo T-Deck
    • LilyGo T-Beam
    • RAK WisBlock 4631
    • Seeed Studio T-1000E tracker card
    • Other (please specify below)

Summary by CodeRabbit

  • New Features
    • Added support for a new Arduino ESP32-C6 board variant.
    • Included board setup for USB, I2C, SPI, display, radio, battery monitor, and touchscreen-related hardware.
    • Added startup configuration for onboard peripherals and external GPIO expansion.
    • Added a PlatformIO environment with board metadata, flash settings, and required dependencies.

@github-actions github-actions Bot added needs-review Needs human review hardware-support Hardware related: new devices or modules, problems specific to hardware labels Jun 9, 2026
@vidplace7 vidplace7 removed the needs-review Needs human review label Jun 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new ESP32-C6 hardware variant to support the Arduino Nesso N1 board within the Meshtastic firmware variant system (pins, peripherals, and PlatformIO environment).

Changes:

  • Introduces a new arduino_nesso_n1 ESP32-C6 variant with LoRa (SX1262) + TFT (ST7789) pin mappings.
  • Adds board-specific early init code for the PI4IO expanders (and charger configuration) used on the Nesso N1.
  • Adds a new PlatformIO environment and Arduino pin mapping header for the board.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
variants/esp32c6/arduino_nesso_n1/variant.h Board pin/peripheral feature macros (LoRa + TFT + I2C, etc.).
variants/esp32c6/arduino_nesso_n1/variant.cpp Board init for I2C expanders and helper GPIO-ext routines.
variants/esp32c6/arduino_nesso_n1/platformio.ini New arduino-nesso-n1 build environment, deps, and build flags.
variants/esp32c6/arduino_nesso_n1/pins_arduino.h Arduino core pin constants for this environment.

Comment on lines +20 to +24
${esp32c6_base.build_flags}
-D PRIVATE_HW
-D ARDUINO_NESSO_N1
-D M5STACK_UNITC6L
-I variants/esp32c6/arduino_nesso_n1
Comment thread variants/esp32c6/arduino_nesso_n1/platformio.ini
@github-actions

Copy link
Copy Markdown
Contributor

Firmware Size Report

21 targets | no baseline available yet

Target Size
elecrow-adv-35-tft 3,361,552
heltec-ht62-esp32c3-sx1262 2,081,520
heltec-v3 2,205,424
heltec-vision-master-e213-inkhud 2,169,584
pico 735,464
Show 16 more target(s)
Target Size
pico2 728,336
pico2w 1,176,724
picow 1,195,240
rak11200 1,802,000
rak11310 758,048
rak3172 179,580
rak3312 2,212,512
seeed-xiao-s3 2,216,448
seeed_xiao_rp2040 733,664
seeed_xiao_rp2350 726,480
station-g2 2,216,128
station-g3 2,206,752
t-deck-tft 3,752,176
t-eth-elite 2,433,104
tlora-c6 2,315,184
wio-e5 231,916

Updated for 31ca268

@fukuen
fukuen force-pushed the feature/arduino-nesso-n1-Jun2026 branch from ed861a4 to ea2cc62 Compare June 12, 2026 04:43
fukuen and others added 3 commits July 5, 2026 23:37
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@caveman99
caveman99 force-pushed the feature/arduino-nesso-n1-Jun2026 branch from ea2cc62 to 3046f06 Compare July 5, 2026 21:37
@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a new board variant, "arduino_nesso_n1," for the ESP32-C6 platform, including default pin definitions, a PlatformIO build environment configuration, hardware initialization code for I2C-based GPIO expanders and battery charger, and a variant header configuring GPS, I2C, SPI, LoRa (SX1262), TFT display (ST7789), and BQ27220 battery monitor settings.

Changes

Nesso N1 board variant

Layer / File(s) Summary
Base pin definitions
variants/esp32c6/arduino_nesso_n1/pins_arduino.h
New header defines USB VID/PID, disabled TX/RX, and default I2C/SPI pin assignments.
PlatformIO build environment
variants/esp32c6/arduino_nesso_n1/platformio.ini
New environment extends esp32c6_base, sets board/partition scheme, upload protocol, build flags, monitor speed, source filter, and pinned LovyanGFX/BQ27220 dependencies.
I2C helpers and hardware bring-up
variants/esp32c6/arduino_nesso_n1/variant.cpp
Adds I2C register constants/bit macros, i2c_read_byte/i2c_write_byte helpers, c6l_init() sequencing PI4IO expander and AW32001E charger setup, and gpio_ext_set/gpio_ext_get bit-level GPIO expander access.
Variant hardware configuration header
variants/esp32c6/arduino_nesso_n1/variant.h
Declares init/GPIO-expander functions, disables GPS, defines I2C/LCD/SPI/buzzer/IO-expander pins, remaps LoRa pins for SX1262, configures BQ27220 and ST7789 TFT display settings, and leaves touchscreen disabled.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Firmware as Nesso N1 Firmware
  participant c6l_init as c6l_init()
  participant Wire as Wire (I2C)
  participant PI4IO as PI4IO Expanders
  participant AW32001E as AW32001E Charger

  Firmware->>c6l_init: call c6l_init() at boot
  c6l_init->>Wire: i2c_write_byte(PI4IO addr, reg, value)
  Wire->>PI4IO: reset/configure GPIO direction, pull, interrupt mask
  c6l_init->>Wire: i2c_write_byte(AW32001E addr, reg, value)
  Wire->>AW32001E: configure charger registers
  c6l_init->>Wire: i2c_read_byte(reg)
  Wire-->>c6l_init: register value
  Firmware->>Wire: gpio_ext_set(address, pin, value)
  Wire->>PI4IO: read-modify-write output register
Loading

Poem

A new board hops into the den,
Nesso N1 wired up again 🐇
PI4IO blinks, the charger hums,
ST7789 lights as morning comes,
SX1262 whispers on the air—
This bunny's build config runs with care! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: adding Arduino Nesso N1 support.
Description check ✅ Passed The description includes the issue reference and testing attestations, but it is brief and leaves the 'Other' test details unspecified.
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.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
variants/esp32c6/arduino_nesso_n1/variant.cpp (2)

58-58: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use LOG_DEBUG instead of printf.

As per coding guidelines, "Prefer LOG_DEBUG, LOG_INFO, LOG_WARN, and LOG_ERROR for logging in C++ code."

♻️ Suggested fix
-    printf("pi4io_init\n");
+    LOG_DEBUG("pi4io_init");
🤖 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 `@variants/esp32c6/arduino_nesso_n1/variant.cpp` at line 58, Replace the direct
printf logging in variant.cpp with the project’s logging macro. Update the
pi4io_init message to use LOG_DEBUG instead of printf so it follows the C++
logging conventions used elsewhere in the codebase, and keep the change
localized to the initialization path in variant.cpp.

Source: Coding guidelines


104-113: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider named constants for the AW32001E charger address/registers.

0x49 and the raw register offsets (0x2, 0x5, 0x1, 0x0) are used inline, unlike the PI4IO_* macros used above. Named constants would improve readability and reduce risk of typos across the four writes.

🤖 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 `@variants/esp32c6/arduino_nesso_n1/variant.cpp` around lines 104 - 113, The
AW32001E charger configuration in variant.cpp uses inline magic numbers for the
I2C address and register offsets, unlike the nearby PI4IO constants. Replace the
repeated 0x49 and raw register values in the AW32001E setup with named constants
defined near the other board-specific symbols, and update the charger
initialization calls to use those identifiers so the intent is clearer and typos
are less likely.
🤖 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 `@variants/esp32c6/arduino_nesso_n1/variant.cpp`:
- Around line 26-43: The I2C helper routines `i2c_read_byte` and
`i2c_write_byte` currently ignore the return values from
`Wire.endTransmission()` and `Wire.requestFrom()`, so bus errors can silently
propagate stale or invalid data. Update these helpers to check and surface
transmission/read failures, and make callers such as `gpio_ext_set`,
`gpio_ext_get`, and `c6l_init` handle the error path instead of using the read
value when the transaction fails.

---

Nitpick comments:
In `@variants/esp32c6/arduino_nesso_n1/variant.cpp`:
- Line 58: Replace the direct printf logging in variant.cpp with the project’s
logging macro. Update the pi4io_init message to use LOG_DEBUG instead of printf
so it follows the C++ logging conventions used elsewhere in the codebase, and
keep the change localized to the initialization path in variant.cpp.
- Around line 104-113: The AW32001E charger configuration in variant.cpp uses
inline magic numbers for the I2C address and register offsets, unlike the nearby
PI4IO constants. Replace the repeated 0x49 and raw register values in the
AW32001E setup with named constants defined near the other board-specific
symbols, and update the charger initialization calls to use those identifiers so
the intent is clearer and typos are less likely.
🪄 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 Plus

Run ID: b1e89e18-3dc2-4aff-8d39-8e25a66cdeb5

📥 Commits

Reviewing files that changed from the base of the PR and between fe6bf91 and 3046f06.

📒 Files selected for processing (4)
  • variants/esp32c6/arduino_nesso_n1/pins_arduino.h
  • variants/esp32c6/arduino_nesso_n1/platformio.ini
  • variants/esp32c6/arduino_nesso_n1/variant.cpp
  • variants/esp32c6/arduino_nesso_n1/variant.h

Comment on lines +26 to +43
void i2c_read_byte(uint8_t addr, uint8_t reg, uint8_t *value)
{
Wire.beginTransmission(addr);
Wire.write(reg);
Wire.endTransmission();
Wire.requestFrom(addr, 1);
*value = Wire.read();
}

/*******************************************************************/
void i2c_write_byte(uint8_t addr, uint8_t reg, uint8_t value)
{
Wire.beginTransmission(addr);
Wire.write(reg);
Wire.write(value);
Wire.endTransmission();
}
/*******************************************************************/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the target file and nearby usage.
echo "== variant.cpp =="
wc -l variants/esp32c6/arduino_nesso_n1/variant.cpp
sed -n '1,220p' variants/esp32c6/arduino_nesso_n1/variant.cpp

echo
echo "== Search for helper usages =="
rg -n "i2c_read_byte|i2c_write_byte|gpio_ext_set|gpio_ext_get|c6l_init|Wire\.requestFrom|Wire\.endTransmission|Wire\.read" variants/esp32c6/arduino_nesso_n1 -S

echo
echo "== Surrounding call sites if found =="
for f in $(rg -l "i2c_read_byte|i2c_write_byte|gpio_ext_set|gpio_ext_get|c6l_init" variants/esp32c6/arduino_nesso_n1 -S); do
  echo "--- $f ---"
  rg -n -C 3 "i2c_read_byte|i2c_write_byte|gpio_ext_set|gpio_ext_get|c6l_init" "$f"
done

Repository: meshtastic/firmware

Length of output: 14879


Handle I2C errors in these helpers. i2c_read_byte/i2c_write_byte ignore Wire.endTransmission() and Wire.requestFrom(), so a NACK or short read falls through into gpio_ext_set/gpio_ext_get and c6l_init with stale or invalid data. That can misconfigure the expander/charger during bring-up.

🤖 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 `@variants/esp32c6/arduino_nesso_n1/variant.cpp` around lines 26 - 43, The I2C
helper routines `i2c_read_byte` and `i2c_write_byte` currently ignore the return
values from `Wire.endTransmission()` and `Wire.requestFrom()`, so bus errors can
silently propagate stale or invalid data. Update these helpers to check and
surface transmission/read failures, and make callers such as `gpio_ext_set`,
`gpio_ext_get`, and `c6l_init` handle the error path instead of using the read
value when the transaction fails.

@pipefitting

Copy link
Copy Markdown

Confirmed building and running on a physical Arduino Nesso N1 (ESP32-C6, 16 MB).

Built this branch from source and flashed over USB. It boots cleanly to the Meshtastic UI, no watchdog boot loop. All four onboard I2C devices are detected:

  • AHT10 (0x38)
  • SHT31 (0x44)
  • BQ27220 fuel gauge (0x55)
  • MPU6050 IMU (0x68)

The default_16MB.csv partition and the esp_task_wdt_initesp_task_wdt_reconfigure fallback both work as intended on the C6.

One display issue to flag: there's a fixed band of unpainted/garbage pixels along the bottom edge of the screen, plus some scattered garbage pixels elsewhere. It's consistent across reboots and doesn't affect functionality (the UI is fully usable). It looks like it could be a display resolution or column/row offset mismatch in the N1 panel config rather than anything functional, but I haven't traced it. Photo attached.
IMG_2147

Happy to test a fix against the hardware if that's useful.

@pipefitting

Copy link
Copy Markdown

Follow-up / correction after more testing.

Updating my earlier "fully usable" comment with what I've now actually verified on the hardware:

  • Touchscreen: works. I can navigate the on-device UI by touch. (I initially misread the variant as having touch disabled — it's active.)
  • Onboard button: doesn't work. It's routed through the I/O expander via BUTTON_EXTENDER rather than a direct BUTTON_PIN, and pressing it doesn't navigate or wake the UI.
  • BLE: works. Paired the iOS app to the node successfully, so configuring the device from the phone is fine.

So the device is usable on-device via touch and via the phone app; the one gap is the physical button not being wired up. (Display offset band from my earlier note still stands.)

Happy to test button fixes against the hardware.

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

Labels

hardware-support Hardware related: new devices or modules, problems specific to hardware

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants