Skip to content

ThinkNode-M1: deep sleep with key wake, dual-GPS support, LEDs and low-voltage handling - #3734

Open
Elecrow-RD wants to merge 1 commit into
meshcore-dev:devfrom
Elecrow-RD:thinknode-m1-r55
Open

Elecrow-RD wants to merge 1 commit into
meshcore-dev:devfrom
Elecrow-RD:thinknode-m1-r55

Conversation

@Elecrow-RD

Copy link
Copy Markdown

ThinkNode-M1: deep sleep with key wake, dual-GPS support, LED and low-voltage handling

Board-level work for the Elecrow ThinkNode-M1 (nRF52840 + SX1262 + 1.54" e-paper),
reviewed on 2026-08-21 and rebased onto dev.

Summary

Area Change
Deep sleep hibernate() → SYSTEMOFF, wake on a short page-key press; progress markers on the boot screen; controlled reboot if SYSTEMOFF fails
Sleep current V1.5 measured: 1.88 mA → 320 µA (GPS switch off) and 30 mA → 391 µA (GPS switch on)
E-paper sleep page kept on screen and panel put into deep sleep (~1.7 mA → µA)
GPS one firmware, two hardware revisions detected automatically (L76K / AG3352)
LEDs BLE pairing blink, RX pulse, low-battery red blink
Low voltage hibernate at 3.45 V, power off at 3.28 V (consecutive-sample counters)
Battery gauge 3.0 V reference, longer sample-and-hold, averaging, offset calibration

Deep sleep

ThinkNodeM1Board::hibernate() enters SYSTEMOFF and wakes on SENSE_LOW on the page key
(P1.10). The order of the shutdown sequence is what mattered most and is documented in
m1_hibernate_pin_table():

  1. display off + LoRa sleep;
  2. GNSS put to sleep while the UART is still usable;
  3. every GPIO OUTPUT+0 → high-Z, except the radio SPI/CS/NRESET pins, NFC and buttons
    (same table Meshtastic's variant_shutdown() uses);
  4. the pins that must hold a defined level are driven last: radio NRESET low,
    NSS high, backlight-rail enable low, LEDs off, GNSS standby low;
  5. the peripheral rail (PERIPHERAL_EN, P0.12) is pulled low, cutting VDD (QSPI flash,
    e-paper, battery divider);
  6. wake source is armed, then SYSTEMOFF.

Driving the pins before the generic pin table was the bug behind the old sleep current:
the table released NRESET and the GNSS standby pin again, which left the SX1262 in
STDBY_RC (~1.2-1.5 mA) and the GNSS receiver tracking (~28 mA).

E-paper

GxEPDDisplay::turnOff(false) now leaves the last frame on screen and sends the panel to
deep sleep. A driven e-paper controller keeps drawing ~1.7 mA even for a static image,
while deep sleep is in the µA range, and the panel is bistable, so the sleep page stays
visible at almost no cost.

GPS: V1.5 and V2.0 in one firmware

V1.5 (L76K) V2.0 (AG3352)
power mechanical slide switch K5, not software switchable P1.01 → 0.8 V regulator enable
standby / reset P1.02 = WAKE_UP (high = run), P1.05 = RESET_N (low = reset) P1.05 → transistor → RESET_N (high = reset)
board signature P0.08 hard-wired to BAT_ADC P0.08 has a 100 kΩ pull-up

Both bring-up paths are tried, so a wrong detection can never leave the device without GPS.
P1.01 on V1.5 is only a 2 MΩ switch-position sense input and must be read as a plain
input; P0.08 must never be driven on V1.5 because it is the battery-sense node. The UART
pins/baud are matched per revision, and NMEA output is requested from both command families
($PMTK314 / $PAIR062), so either module starts reporting.

LEDs and low voltage

  • BLE pairing: blue 1 Hz blink for up to 30 s, solid for 30 s after pairing, then off.
  • LoRa RX: one short blue pulse per valid received packet.
  • Low battery: red 1 Hz blink below 3.5 V (the red LED is shared with the charger IC, so the
    firmware does not drive it while charging).
  • 3.45 V for 10 consecutive checks (30 s apart) → deep sleep; 3.28 V twice, 10 s apart →
    power off.

Verification

  • Builds with pio run -e ThinkNode_M1_companion_radio_ble against this branch.
  • Deep sleep, wake-by-key, LED behaviour and GNSS were verified on both V1.5 and V2.0
    hardware; sleep-current numbers above were measured on V1.5 with USB unplugged.

Base branch for this PR: dev.

…w-voltage handling

Board support for the Elecrow ThinkNode-M1 (nRF52840 + SX1262 + 1.54" e-paper),
following the 2026-08-21 design review.

- hibernate(): enter SYSTEMOFF and wake on a short page-key press. The pin table is
  taken from Meshtastic's variant_shutdown(); the pins that must hold a defined level
  (radio NRESET/NSS, backlight-rail enable, LEDs, GNSS standby) are driven *after* the
  generic high-Z pass and the peripheral rail (P0.12) is cut last. Measured on V1.5:
  1.88 mA -> 320 uA with the GNSS switch off, 30 mA -> 391 uA with it on.
- e-paper: keep the sleep page on screen and deep-sleep the panel on turn-off
  (~1.7 mA static draw -> uA, image retained).
- GPS: detect V1.5 (L76K) vs V2.0 (AG3352) from the P0.08/P1.01 hardware signature,
  run the matching bring-up/sleep path, try both paths as a fallback, and request
  NMEA output from both command families.
- LEDs: BLE pairing blink, RX pulse, low-battery red blink (charger IC keeps control
  while charging).
- Low voltage: hibernate after consecutive 3.45 V readings, power off at 3.28 V.
- Battery gauge: 3.0 V reference, longer sample-and-hold, averaging, offset calibration.
@fdlamotte

Copy link
Copy Markdown
Collaborator

Thank you for this big PR that will give us lots of insights on the M1 internals ;)

Sadly I don't have an M1 to test it ...

I don't think it will be pulled as is, because there is too much device dependent code (in UI_Task for instance) and if we start going this way, the main code would become unreadable, but I'll try to digest it, backport some of the interesting functionalities here, break things in smaller PRs and try to incorporate things mainstream

It's nice to have your support ...

@kroegerama

Copy link
Copy Markdown

As an M1 owner this PR looks so intriguing to me. I hope most of it can find the way into the firmware. So nice to see official support from Elecrow here :)

@kroegerama

Copy link
Copy Markdown

I have flashed this version to my M1. Here's what I found:

Positive:

  • The Display finally works correctly. It's unusable on the current upstream version. Using the M1 standalone is finally possible.
  • The Sleep-Icon is a nice touch
  • Finally correct battery measurements. The upstream firmware drops out at ~44% battery left.

Buggy:

  • If the Hardware GPS Switch is Off, booting takes ~20 Seconds showing "Loading...". I guess it's because the GPS chip detection does not work.

  • When Hibernating after a few seconds, the display shows:

    Hibernating...
    release key to sleep
    wake: either key
    m1-r55

    • "release key to sleep": Which key needs to be released? I'm not pressing any button.
    • In this mode, no BLE connection is possible. So I cannot receive messages anymore on my smartphone. In my opinion, this mode should not be activated by default.

@fdlamotte

Copy link
Copy Markdown
Collaborator
  • The Display finally works correctly. It's unusable on the current upstream version. Using the M1 standalone is finally possible.
  • The Sleep-Icon is a nice touch

current upstream is dev ... is it not working for you ? Or do you talk about 1.18 which is now largely outdated and known not to work on this device ?

Maybe you can try this firmware

About the firmware in this PR, this is really a great contribution from the Elecrow team. It can be used for people to test their view of the firmware, which is really good, and I think it's a good way for working together, by doing a custom firmware for their devices

We'll try to backport things in dev branch, but it has to be done thinking how things fit with the whole ecosystem. For instance for GPS part, there is an urge to clean all the mess between EnvironmentSensorManager and LocationProvider

@kroegerama

Copy link
Copy Markdown

current upstream is dev ... is it not working for you ? Or do you talk about 1.18 which is now largely outdated and known not to work on this device ?

Oh, you are right. By upstream I meant the 1.18 release. Sorry for using the wrong term here. I flashed the current dev branch (actual upstream) now. That version works good with the E-Ink display as well. And it doesn't have the hibernation problem from this PR that disables BLE. I'll keep it for now on my M1 🙂

@lyusupov

Copy link
Copy Markdown

@Elecrow-RD

You say that

... The UART pins/baud are matched per revision ..

but that PR meshtastic/firmware#12306 contains the following

nRF52840 L76K boards (unchanged) AG3352 boards (V2.0)
P1.08 / P1.09 MCU TX / MCU RX, 9600 baud MCU RX / MCU TX (swapped), 115200 baud

Which one is correct ?

This branch has not been deployed

No deployments
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.

4 participants