Skip to content

fix(nrf52): fix poweroff CLI command for T114 and RAK4631#2701

Open
jirogit wants to merge 3 commits into
meshcore-dev:devfrom
jirogit:fix/t114-poweroff
Open

fix(nrf52): fix poweroff CLI command for T114 and RAK4631#2701
jirogit wants to merge 3 commits into
meshcore-dev:devfrom
jirogit:fix/t114-poweroff

Conversation

@jirogit
Copy link
Copy Markdown
Contributor

@jirogit jirogit commented Jun 6, 2026

Problem

T114 and RAK4631 repeater did not shutdown by command.

T114

T114Board::powerOff() called sd_power_system_off() directly with no error handling. If the SoftDevice returns an error, execution silently returned and the device kept running.

Additionally, the SX1262 was left powered (SX126X_POWER_EN HIGH), leaving DIO1 SENSE active and risking an immediate GPIO wakeup from SYSTEMOFF.

RAK4631

RAK4631Board had no powerOff() override at all. The CLI poweroff command called the base class no-op (MainBoard::powerOff()) and the device kept running.

Additionally, RAK4631 has no user buttons. After SX1262 is powered down, DIO1 (P_LORA_DIO_1 = pin 47) is the only GPIO with SENSE configured (set by RadioLib's attachInterrupt()). The floating pin triggers an immediate GPIO wakeup from SYSTEMOFF, so the device restarts instead of staying off.

Fix

T114

Delegate powerOff() to initiateShutdown(SHUTDOWN_REASON_USER), following the pattern used by R1NeoBoard and others with NRF52_POWER_MANAGEMENT. This powers down the SX1262 before SYSTEMOFF and goes through enterSystemOff() with proper error handling and fallback to NRF_POWER->SYSTEMOFF.

RAK4631

  • Add powerOff() override delegating to initiateShutdown(SHUTDOWN_REASON_USER)
  • In initiateShutdown(), call nrf_gpio_cfg_default(P_LORA_DIO_1) immediately after powering down the SX1262 to clear the SENSE configuration and prevent immediate GPIO wakeup from SYSTEMOFF

Test

  • T114 (nRF52840 + SX1262): poweroff CLI stopped ✅
  • RAK4631 (nRF52840 + SX1262): poweroff CLI stopped ✅

jirogit added 3 commits June 5, 2026 17:17
…MOFF

T114Board::powerOff() was calling sd_power_system_off() directly with no
error handling. If the SoftDevice returns NRF_ERROR_BUSY or any other error,
execution silently returned and the device kept running.

Delegating to initiateShutdown(SHUTDOWN_REASON_USER) fixes this by:
- powering down the SX1262 (SX126X_POWER_EN LOW) before SYSTEMOFF,
  preventing immediate GPIO wakeup via DIO1
- going through enterSystemOff() which handles SD errors and falls back
  to NRF_POWER->SYSTEMOFF then NVIC_SystemReset()
RAK4631Board had no powerOff() override, so the CLI poweroff command
called the base class no-op and the device kept running.

Add powerOff() following the R1NeoBoard pattern: delegate to
initiateShutdown(SHUTDOWN_REASON_USER) which powers down the SX1262,
then goes through enterSystemOff() with proper error handling and
fallback to NRF_POWER->SYSTEMOFF.
RAK4631 has no buttons. After SX1262 is powered down, DIO1 (P_LORA_DIO_1)
is the only GPIO with SENSE configured (set by RadioLib's attachInterrupt).
The floating pin can trigger an immediate GPIO wakeup from SYSTEMOFF.

Clear the SENSE configuration with nrf_gpio_cfg_default() before entering
SYSTEMOFF to prevent this.
@jirogit jirogit changed the title fix(t114): fix poweroff command having no effect on device shutdown fix(nrf52): powerOff() not entering SYSTEMOFF on T114 and RAK4631 Jun 6, 2026
@jirogit jirogit changed the title fix(nrf52): powerOff() not entering SYSTEMOFF on T114 and RAK4631 fix(nrf52): fix poweroff CLI command for T114 and RAK4631 Jun 6, 2026
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.

1 participant