zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
11.01k stars 6.7k forks source link

lora: sx126x: interrupt pin permanently enabled #31569

Closed JordanYates closed 3 years ago

JordanYates commented 3 years ago

Describe the bug The sx126x driver leaves the DIO1 interrupt permanently enabled, resulting in excess power consumption. For nRF SoC's, this means the GPIOTE peripheral is permanently enabled, increasing current draw by ~15uA. Per the datasheet (Table 8-3), DIO1 is not driven as an output in Reset, Startup, or Sleep modes. We can therefore safely turn off the interrupt in sleep mode.

Expected behavior DIO1 pin should only have the interrupt enabled when it is actually needed (Not in sleep mode).

Impact Minor, permanent +15uA to the current consumption of any application.

Environment (please complete the following information):

tagunil commented 3 years ago

Does the sx1276 driver have the same issue?

JordanYates commented 3 years ago

Does the sx1276 driver have the same issue?

Yes, all DIO pins have their interrupts permanently enabled in SX1276IoIrqInit. The sx1276 has a different sleep model, so the same solution doesn't directly apply. That driver also currently uses loramac-node implementations for sleep and standby transitions. I don't have any hardware with the older LoRa modem however, so I can't validate any potential solutions.