Skip to content

stm32wl: enable LSE/RTC/deep-sleep on all variants - #11491

Open
ndoo wants to merge 3 commits into
meshtastic:developfrom
meshmy:stm32wl-lse-all-variants
Open

stm32wl: enable LSE/RTC/deep-sleep on all variants#11491
ndoo wants to merge 3 commits into
meshtastic:developfrom
meshmy:stm32wl-lse-all-variants

Conversation

@ndoo

@ndoo ndoo commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Recent flash-savings work now allows RTC & LowPower libraries to fit on all STM32WL variants.

  • Add STM32RTC/STM32LowPower lib_deps to the stm32_base environment
  • Drop lib_deps from variants where RTC & LowPower are now redundant:
    • rak3172
    • nucleo_wl55jc
  • Define HAS_LSE & STM32WL_LSE_DRIVE macros on the remaining STM32WL variants:
    • russell
    • wio-e5
    • CDEBYTE_E77-MBL
    • milesight_gs301
  • Move MESHTASTIC_EXCLUDE_AIR_QUALITY_SENSOR into stm32_base and drop the per-variant copies. No STM32WL variant has populated air-quality hardware, and excluding it in the shared base is what brings nucleo_wl55jc back under its flash budget.

Flash usage

Rebased onto develop at 7e9525a. Allocated flash is 242.0 KiB (247808 B) on every STM32WL variant.

Variant Flash used (%) Flash used/allocated (KiB)
CDEBYTE_E77-MBL 86.7% 209.8/242.0
rak3172 88.0% 212.9/242.0
wio-e5 95.2% 230.3/242.0
nucleo_wl55jc 96.7% 234.0/242.0
russell 97.2% 235.1/242.0

milesight_gs301 fails to build due to a pre-existing develop error unrelated to this change (PIO_FRAMEWORK_ARDUINO_NANOLIB_FLOAT_PRINTF guard in architecture.h). Fixed separately in #11649.

🤝 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)
      • rak3172 flashed, check for RTC init, set RTC, reboot, readback RTC
      • russell flashed, booted (no further test - functionally identical to rak3172)
      • CDEBYTE_E77-MBL flashed, check for RTC init, set RTC, reboot, readback RTC
      • wio-e5 flashed, check for RTC init, set RTC, reboot, readback RTC
      • nucleo_wl55jc flashed, check for RTC init, set RTC, reboot, readback RTC
      • milesight_gs301 not tested due to pre-existing build error
      • build-verified after rebase: rak3172, russell, wio-e5, CDEBYTE_E77-MBL, nucleo_wl55jc

Set RTC/Readback RTC Procedure

  1. Disable DEBUG_MUTE in RTC.cpp (temporarily; not committed)
  2. Flash firmware
  3. meshtastic --port <port> --set-time
  4. Request reboot
  5. Check serial for readFromRTC epoch=... accepted
  6. Confirm the readback timestamp is the current time

Summary by CodeRabbit

  • New Features

    • Added low-speed external oscillator support for several STM32WL-based boards.
    • Configured low-drive oscillator operation for improved hardware compatibility and power-conscious performance.
    • Extended support to CDEBYTE E77-MBL, Milesight GS301, Russell, and Seeed Wio-E5 variants.
    • Enabled air-quality sensor functionality on supported STM32 board variants.
    • Added appropriate radio timing support for the Seeed Wio-E5.
  • Build Improvements

    • Standardized STM32 platform configuration for low-power and real-time clock functionality.
    • Improved filesystem error recovery.
    • Simplified board-specific build configuration.

@github-actions

Copy link
Copy Markdown
Contributor

⚡ Try this PR in the Web Flasher

Note

Building this pull request… the flash button, badges and supported-board
list will appear here automatically once CI finishes.

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 87733b06-956c-4e08-9893-776c935b400d

📥 Commits

Reviewing files that changed from the base of the PR and between 31f6703 and 0b48761.

📒 Files selected for processing (1)
  • variants/stm32/stm32.ini
🚧 Files skipped from review as they are similar to previous changes (1)
  • variants/stm32/stm32.ini

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

STM32WL variant headers now configure low-drive LSE support. Shared STM32 settings add RTC and low-power dependencies, air-quality exclusion, and recoverable LittleFS assertions. Selected environments remove duplicate dependencies and local air-quality exclusions.

Changes

STM32 support updates

Layer / File(s) Summary
Centralize STM32 build settings
variants/stm32/stm32.ini
The shared STM32 configuration adds STM32RTC 1.9.0, STM32LowPower 1.5.0, the air-quality sensor exclusion flag, and recoverable lfs_assert() handling.
Remove environment-specific settings
variants/stm32/nucleo_wl55jc/platformio.ini, variants/stm32/rak3172/platformio.ini, variants/stm32/*/platformio.ini
Selected environments remove duplicate library dependencies and local air-quality sensor exclusion flags.
Configure STM32WL hardware
variants/stm32/*/variant.h
CDEBYTE E77-MBL, Milesight GS301, Russell, and Wio-E5 enable LSE with RCC_LSEDRIVE_LOW. Wio-E5 also defines SX126X_DIO3_TCXO_VOLTAGE as 1.7.

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

Merge Risk: ⚪ Minimal · up to 0b487

This change enables RTC and low-power support across STM32WL variants and adjusts shared build configuration. No actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: enabling LSE, RTC, and deep-sleep support across STM32WL variants.
Description check ✅ Passed The description is complete and relevant. It documents the dependency changes, affected variants, flash usage, build limitation, testing performed, regression status, and RTC test procedure.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 4…
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.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 4 files. (1 skipped: 1 unsupported.)

✨ 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.

@ndoo

ndoo commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ndoo
ndoo force-pushed the stm32wl-lse-all-variants branch from 833f8aa to 365dd17 Compare August 14, 2026 00:48
@ndoo
ndoo force-pushed the stm32wl-lse-all-variants branch from 365dd17 to 38479b8 Compare August 28, 2026 17:53
@ndoo
ndoo marked this pull request as ready for review August 28, 2026 17:53
@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@ndoo

ndoo commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Recent flash-savings work now allows RTC & LowPower libraries to fit on
all STM32WL variants.

- Add STM32RTC/STM32LowPower lib_deps to stm32_base environment
- Drop lib_deps from variants where RTC & LowPower are now redundant:
  - rak3172
  - nucleo_wl55jc
- Define HAS_LSE & LSEDRIVE level macros on remaining STM32WL variants:
  - russell
  - wio-e5
  - CDEBYTE_E77-MBL
  - milesight_gs301
- Move MESHTASTIC_EXCLUDE_AIR_QUALITY_SENSOR into stm32_base and drop the
  per-variant copies. No STM32WL variant has populated air-quality
  hardware, and excluding it in the base is what keeps nucleo_wl55jc
  within its flash budget.

Assisted-by: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Andrew Yong <me@ndoo.sg>
@ndoo
ndoo force-pushed the stm32wl-lse-all-variants branch from 38479b8 to 8f12df9 Compare August 28, 2026 19:54
Resolves additive conflicts in variants/stm32/CDEBYTE_E77-MBL/variant.h and
variants/stm32/wio-e5/variant.h: upstream meshtastic#10964 adds TCXO macros next to this
branch's HAS_LSE/STM32WL_LSE_DRIVE defines; both blocks are kept.

Assisted-by: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Andrew Yong <me@ndoo.sg>
@ndoo

ndoo commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author
  • Moved MESHTASTIC_EXCLUDE_AIR_QUALITY_SENSOR=1 out of variants and into general STM32
  • As a result of the above NUCLEO WL55JC fits within the flash budget again (it wouldn't have otherwise with the RTC/LowPower added)
  • Merge develop HEAD and fix conflicts

Resolves an additive conflict in variants/stm32/stm32.ini: upstream
reordered the shared MESHTASTIC_EXCLUDE build flags and added
MESHTASTIC_EXCLUDE_RTTTL while this branch added
MESHTASTIC_EXCLUDE_AIR_QUALITY_SENSOR; both flags are kept.

Assisted-by: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Andrew Yong <me@ndoo.sg>
@ndoo

ndoo commented Aug 30, 2026

Copy link
Copy Markdown
Contributor Author

Merge of #10989 caused a conflict here which has now been fixed.

Took the reordered block and kept the branch's AIR_QUALITY_SENSOR flag alongside it. No flags dropped.

@Stary2001 Stary2001 added enhancement New feature or request hardware-support Hardware related: new devices or modules, problems specific to hardware labels Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request 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.

2 participants