feat(rak3401): cold-sleep RAK4631 onboard SX1262 on RAK13302 builds

A RAK4631 core paired with a RAK13302 leaves the core's own SX1262
powered but never initialized, idling in STDBY_RC for the life of the
board. Firmware cannot cut its supply -- P1.05 is the RF switch rail,
not the radio's -- so bring it up on its own pins just long enough to
issue a cold sleep, before std_init() repins SPI onto the RAK13302.

Gated behind RAK4631_ONBOARD_SX1262_SLEEP and exposed through seven
RAK_4631_13302_* envs, so RAK_3401_* artifacts are unchanged.

The sleep is issued regardless of what begin() returns: Module::init()
runs first, so SPI stays usable even if TCXO calibration fails. NSS is
then held high, since the SX1262 wakes on an NSS falling edge.

Verified on RAK19007 + RAK4631 + RAK13302: begin=0 sleep=0, RAK13302
init clean (device_errors=0x0000), TX and RX both confirmed. The
current saving itself is derived from the datasheet (600 uA STDBY_RC
-> 160 nA cold sleep) and is not measured.
This commit is contained in:
agessaman committed 2026-08-17 21:04:06 -07:00
1 parent 22bc13804c
commit 974564b89c
3 files changed
+173

No files matched your search

+15
View File
@@ -175,6 +175,21 @@ static const uint8_t AREF = PIN_AREF;
#define P_LORA_BUSY SX126X_BUSY
#define P_LORA_RESET SX126X_RESET
// The RAK4631 core carries its own SX1262, which is unused when a RAK13302
// supplies the RF path. RAK4631_ONBOARD_SX1262_SLEEP builds put it into cold
// sleep at boot; on a genuine RAK3401 these pins are unconnected.
#ifdef RAK4631_ONBOARD_SX1262_SLEEP
#define ONBOARD_LORA_NSS (42) // P1.10
#define ONBOARD_LORA_SCLK (43) // P1.11
#define ONBOARD_LORA_MOSI (44) // P1.12
#define ONBOARD_LORA_MISO (45) // P1.13
#define ONBOARD_LORA_BUSY (46) // P1.14
#define ONBOARD_LORA_DIO_1 (47) // P1.15
#define ONBOARD_LORA_RESET (38) // P1.06
#define ONBOARD_LORA_ANT_SW (37) // P1.05, powers the onboard RF switch
#define ONBOARD_LORA_TCXO_VOLTAGE 1.8
#endif
// enables 3.3V periphery like GPS or IO Module
// Do not toggle this for GPS power savings
#define PIN_3V3_EN (34)