Conversation
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.
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
UI color refactor
Config serializer
If Bluefruit.begin fails, BLE OTA mode won't actually start and the board might require a reboot to reattempt. Fixes: - Bluefruit.begin returns false in NRF52Board.startOTAUpdate if OTA mode fails to start. User is notified of the fault through existing error message in CommonCLI and can reattempt "start ota" command.
…e-recovery nRF52840 "start ota" Failure Recovery
Fix unnecessary IRQ clearing
Refactor Companion Interfaces + Add ThinkNode M7 Ethernet Support
Unify IRQ timeout logic across all applicable radio types
Clean up debugs left on in platform.ini files
…advert-names Preserve UTF-8 boundaries in advert names
…system-posts room_server: add room.post command for server-originated posts
CustomLR1110::startReceive() passed RADIOLIB_LR11X0_IRQ_PREAMBLE_DETECTED (1<<4 = 16) as RadioLib's first argument, which is the RX *timeout*, not an IRQ mask. At the LR11x0's 30.52us tick that armed the receiver for ~488us, so it dropped out of RX before any packet could arrive and the node received nothing at all -- while transmitting normally. Symptoms on a SenseCAP T1000-E: tx_air_secs rising, rx_air_secs stuck at 0, recv_errors 0, and the noise floor pinned at the -120 clamp because getCurrentRSSI() never sampled a live receiver. Pass RADIOLIB_LR11X0_RX_TIMEOUT_INF (continuous RX), which is what LR11x0::startReceive() itself uses, keeping the PREAMBLE_DETECTED flag in the reported IRQ flags as intended. Introduced in ea5d7c8 ("LR1110: add PREAMBLE_DETECTED to reported irq flags"). Verified on two T1000-E units: with only the repeater fixed it began receiving (last_rssi -29, SNR 17.0) while the unfixed companion stayed deaf; fixing both brought up the link in each direction.
Board manifest for esp32-c6-devkitm-1 defaults build.flash_mode to qio, which this module's flash chip does not support -- causes a boot crash-loop (repeated USB-Serial-JTAG reconnects) on real hardware. Override with board_build.flash_mode = dio in the common M5Stack_Unit_C6L section so it applies to all envs (ble/usb/repeater/room_server).
…ncryption feat: use nrf52 hardware crypto where we can
…mode-dio fix: M5Stack Unit C6L boot failure caused by flash_mode=qio
Removed unnecessary comments regarding RX timeout and IRQ mask.
LR1110: fix startReceive() passing an IRQ bit as the RX timeout 🤖🤖
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. 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the MuziWorks Base board to MeshCore as a single shared nRF52840 variant, with the radio selected per build environment:
USE_LR1121)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 environmentsboards/muzi_base.jsonboard definitionsrc/helpers/radiolib/CustomLR1121{,Wrapper}.hLR1121 radio driver + wrappersrc/helpers/ui/SH1107Display.{h,cpp}SH1107 OLED display driverBuild environments
For each radio flavor (
muzi_base_duo_*/muzi_base_uno_*):repeater,room_server,companion_radio_usb,companion_radio_ble, andcompanion_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 viaCo-authored-bytrailers.Verification
devhead.