Skip to content

Commit fb71ad5

Browse files
Jordan Yatesnashif
authored andcommitted
lora: sx12xx_common: force sleep on boot
Force sx12xx modems into sleep mode on boot. This is the default state of the modem when not being used due to the TX/RX complete callbacks. This reduces current consumption by 600uA before the modems are used for the first time. As sleep is the normal state after TX/RX when using the LoRa API, it is garaunteed that this will not change the behaviour of application code. LoRaWAN starts by calling Radio.Init(), which resets the modem, so any sleep configuration we do here is discarded. Fixes #31567. Signed-off-by: Jordan Yates <[email protected]>
1 parent 893857b commit fb71ad5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/lora/sx12xx_common.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,5 +148,14 @@ int sx12xx_init(const struct device *dev)
148148
dev_data.events.RxDone = sx12xx_ev_rx_done;
149149
Radio.Init(&dev_data.events);
150150

151+
/*
152+
* Automatically place the radio into sleep mode upon boot.
153+
* The required `lora_config` call before transmission or reception
154+
* will bring the radio out of sleep mode before it is used. The radio
155+
* is automatically placed back into sleep mode upon TX or RX
156+
* completion.
157+
*/
158+
Radio.Sleep();
159+
151160
return 0;
152161
}

0 commit comments

Comments
 (0)