Skip to content

Add Muzi Base (Duo + Uno + SuperIO) support - #1

Open
tjdownes wants to merge 224 commits into
devfrom
muzi-base
Open

Add Muzi Base (Duo + Uno + SuperIO) support#1
tjdownes wants to merge 224 commits into
devfrom
muzi-base

Conversation

@tjdownes

@tjdownes tjdownes commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Summary

Adds the MuziWorks Base board to MeshCore as a single shared nRF52840 variant, with the radio selected per build environment:

  • Base Duo LR1121 (USE_LR1121)
  • Base Uno SX1262 (USE_SX1262)

Both are the same PCB; only the radio module and the DIO1 IRQ pin differ (LR1121 = P1.08, SX1262 = P1.06). All board logic is shared under variants/muzi_base/.

Also supports the optional SuperIO add-on: SH1107 128×128 OLED, GPS, buzzer, and joystick.

What's included

  • variants/muzi_base/* shared board / target / variant + all PlatformIO environments
  • boards/muzi_base.json board definition
  • src/helpers/radiolib/CustomLR1121{,Wrapper}.h LR1121 radio driver + wrapper
  • src/helpers/ui/SH1107Display.{h,cpp} SH1107 OLED display driver

Build environments

For each radio flavor (muzi_base_duo_* / muzi_base_uno_*):
repeater, room_server, companion_radio_usb, companion_radio_ble, and companion_radio_ble_superIO.

Provenance

Consolidates meshcore-dev PR meshcore-dev#2054 (Base Duo, @lbibass) with @andyshinn's shared-base + Uno refactor, rebased onto the latest dev. Original authorship preserved via Co-authored-by trailers.

Verification

  • All 10 environments build and link against the current dev head.
  • A hostile multi-agent code review was performed on the added files (every external RadioLib / Adafruit SH110X / nRF52-core API usage verified against pinned upstream source). No critical issues; a small set of low/medium cleanups and a few hardware-schematic confirmations (ADC divider ratio, TCXO presence, I2C address strap) are noted for follow-up.

Note: IMU and the SuperIO toggle switch are not yet wired (matching the original PR's scope).

NickDunklee and others added 30 commits June 23, 2026 11:39
While working on some sensor code implementations, I ran into
some hard crashes that root-caused to the 4KB loop task stack
being exhausted.

Looking for various optimization schemes resulted in this relatively
low-lift fix. RAK3401 and RAK4631 both support hardware crypto.

Rather than loading in one of the two software crypto libs,
we can just use the onboard hardware. This is faster, should
consume less power, and in testing used a scant up to 700
bytes in the run loop vs 2.5-3KB per advert.

This change **only** affects advert verification processing, which
currently consumes a significant chunk of the 4KB run loop.

I figured such a change should likely be implemented in phases.

After soaking, this hardware crypto verification
process could be implemented across the entire MeshCore
cryptographic function on RAK nodes. Also possible other nodes
have available hardware crypto, however, I have not checked,
so future improvements may also exist there.

Tested on:
  - RAK3401 RAK 1W
  - RAK4631 19001
Tested Heltec t096 and Seeed t1000-e, both support this
hardware feature.
The M6's L76K GPS streams NMEA at 9600 baud on its own, but the firmware
reported no GPS. Root cause: pin 29 (PIN_GPS_RESET / the module's REINIT
line) was driven HIGH, which holds the L76K silent so it never emits any
sentences and detection fails.

variant.cpp drove pin 29 HIGH at boot, and because PIN_GPS_RESET was
defined, MicroNMEALocationProvider also drove it HIGH in begin(). Bench
testing on a sealed M6 (passive NMEA capture, no logic analyzer) confirmed:
pin 29 driven HIGH = 0 bytes; pin 29 floating = full NMEA stream.

Define GPS_RESET (-1) so the location provider never touches pin 29, and
stop driving it in initVariant. This matches the Meshtastic M6 variant,
which leaves the same pin as a floating input.
After soaking for a bit on the adverts without issue on multiple nodes,
I added more hardware crypto.

Supported nodes is unchanged in this PR addition, but if others can verify,
they can easily be added.

Some info on the CC310: https://docs.nordicsemi.com/r/bundle/ps_nrf9151/page/cryptocell.html

**Added:**

- AES-128 packet encryption/decryption now use hardware crypto
- HMAC-SHA-256 authentication now uses hardware crypto
- ACK hash computation and channel ID derivation now use hardware crypto
- RNG (random number generator) now uses hardware crypto rather than
  radio noise + weak software RNG (which can have issues if there's
  no surrounding radio noise.) NIST SP 800-90B certified.
  - Runs hardware self-tests on startup
  - Runs continuous health tests during operation
  - Uses thermal noise/shot noise for randomness

**Unchanged:**

- calcSharedSecret remains software - it would be a split hw/sw solution
  and added complexity for likely not a lot of gains. This only happens
  when establishing a new contact, so not too frequent to be worth it.
- ed25519_create_keypair remains software. This is only called when a
  node is first initialized. It does use the hardware RNG change, however,
  so better randomization.

Tested on (so far):

- Heltec t096

Build test on:
- Heltec t096 companion ble
- t1000e companion ble
- RAK 4631 repeater
- RAK 3401 companion BLE
- Heltec v3 companion wifi
for hardware encryption. Now `USE_CC310_HW_CRYPTO`
* new prefs file now "/prefs.json"
* color displays now with a new light theme
Select nodes had this flag enabled, testing by the community
and hardware specs indicate this can be enabled global for all
node types using this chipset.

Any nodes down the line that may be quirky can be individually
disabled with `-U USE_CC310_HW_CRYPTO`.
# Conflicts:
#	test/mocks/Arduino.h
#	test/mocks/Stream.h
mkdocs will only consider the first H1 (if any) and subheaders under it for the table of contents

this increases the header levels of everything below "important concepts" by 1 so that the table of contents correctly resolves them
…DocsFormatting

Increase header levels on "Payloads" documentation page to fix table of contents
skandragon and others added 29 commits September 5, 2026 23:15
arduino-pico's WiFi.begin() blocks for up to 2x its 15s timeout, which
stalled the mesh loop on every reconnect attempt; use beginNoBlock().
Log the IP when the link comes up, and the status code when retrying.
- scope the serial config CLI to RP2040; it was exposing the rescue CLI
  (cat/rm/erase) on every ESP32 WiFi build, which gates it behind a
  physical long-press
- bound and space out RP2040 rejoins: the core's join busy-waits, so cap
  it at 5s and retry every 30s instead of every 10s
- stamp the reconnect timer in setup(), so the first loop() doesn't tear
  down an association that is still finishing DHCP
- treat stored credentials as a pair, and pass NULL (not "") for an open
  network
- teach build_as_lib.py where SerialWifiInterface moved
'custom:{}' (a DynamicConfigSerializer with nothing set) hits EXPECT_KEY
with a '}' and returns TOK_ERROR, so loadSerial stops there and silently
drops every property after it. Nothing follows 'custom' in NodePrefs
today, so it goes unnoticed until you add one.

Also include stdlib.h, which Arduino.h was providing on-device but not
in the native test build.
Companion CLI: fixed txdelay, direct.txdelay, agc.reset.interval, int.thresh
fix: LR2021 to use correct macro for IRQ_DETECTED in startReceive()
Previously project configuration would fail with "fatal: couldn't find remote ref d541301" (git v2.55.0)

Per https://git-scm.com/docs/git-fetch#Documentation/git-fetch.txt-refspec, the <src> needs to be either a ref or a "**fully spelled** hex object name"

This requirement is also mentioned in this SO answer: https://stackoverflow.com/a/30701724

After this change, project configuration now succeeds.
219812
…gurationgit

Fix Git error during project configuration
…LENGTH

Payloads of 166 or 167 bytes previously passed the frame-sized bound
(MAX_CHANNEL_DATA_LENGTH = 167) but were rejected by sendGroupData
against MAX_GROUP_DATA_LENGTH (165), causing ERR_CODE_TABLE_FULL (retry
later) to be returned instead of ERR_CODE_ILLEGAL_ARG.

Fixes meshcore-dev#3345
…ad-bound

fix(companion): gate CMD_SEND_CHANNEL_DATA payload on MAX_GROUP_DATA_LENGTH
…clamp

[HIGH] Ensure command buffers stay NUL-terminated to prevent overflow
Validate set af input to prevent out-of-range airtime factors
One nRF52840 variant shared across both radios, picked per env: Duo runs
the LR1121, Uno the SX1262. Same PCB, only the radio and its DIO1 pin
change.

SuperIO adds the SH1107 OLED, GPS, buzzer and joystick. GPS is driven by
the 3-position mode switch (Mode 2 = on), polled live the way thinknode_m1
does it.

Five quick user-button presses power the unit off; a press wakes it back
on (arms the button as an nRF52 GPIO SENSE source before SYSTEMOFF).

Consolidates meshcore-dev#2054 and andyshinn's shared-base/uno work, rebased on dev.

Co-authored-by: lbibass <ewdries02@gmail.com>
Co-authored-by: Andy Shinn <andys@andyshinn.as>
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.