I think the LL_PWR_DisablePUPDCfg() turns off - undoes - the settings you did above. It turns off the APC bit in PWR_CR3. For the per-bit settings to work, at least remove that.
What power-down mode are you putting the MCU in? I think the PUPDCfg hardware applies to the MCU in the Standy and Shutdown states; if I recall correctly the MCU is in STOP2 state when running the LoRaWAN stack (at least with the ST LoRaWAN port). So I suspect these bits don’t apply here. It’s the regular pull-up/down configuration for the GPIO bits you need to address.
If you’re using the LL code generation, I think that’s LL_GPIO_SetPinPull() you want to set. In fact, I think you want to initialize the GPIO pull mode regardless of what low power mode you use.
I’m using RUI3 API on Arduino. I didn’t find the function to disable Pull-Up in RUI3, I tried to find something in the STM32WLE files, because I didn’t have an option. I have no knowledge about this API. I still haven’t found a solution.
I don’t have the source codes for RUI3 at hand, so I made a quick check.
pinMode(WB_IO1, INPUT); ==> ~0.25V on the pin pinMode(WB_IO1, INPUT_PULLUP); ==> ~3.29V on the pin
So RUI3 does disable the pullups as expected.
Run the same quick test on PA4, PA5 and PA6 which are setup by RUI3 as SPI_NSS, SPI_CLK and SPI_MISO.
They show the same values. ~.25V when setup as INPUT , ~3.29V when setup as INPUT_PULLUP.
@danak6jq
Good idea and you unfortunately you are correct with the side-effect.
If I add the attachInterrupt() the voltage levels are up to 3.3V and setting pin mode “Input” without pullup doesn’t work.
Now I am not a STM32 expert and I don’t know if the pullup is automatically enabled if you setup a GPIO as interrupt source.
I tried both attachInterrupt(WB_SPI_CS, int_handler, FALLING); and attachInterrupt(WB_SPI_CS, int_handler, RISING); and the result is the same.
Thank you @beegee for running the experiment - very useful.
On a couple of RAK3172s here running firmware generated from a fairly enhanced branch of danak6jq/RAK3172: Port of STM32WLxx example for RAK3172 (github.com) - bare metal on the STM32WLE5 using STM32Cube - I’ve configured pins as external interrupts (EXTI) and they do not have the internal pull-ups configured. Here’s the Cube-generated code:
These have a total of ~500k as a pull-up externally (as part of a level-shifter) and show ~6.3uA when pulling one down. So I’ll try a quick experiment and set the Pull mode to GPIO_PULLUP, build, flash, and…
Indeed, with the internal pull-up enabled on the GPIO, I see ~83uA when pulling one down. So the RUI3 attachInterrupt() appears to be explicitly turning-on the internal pull-up as a side-effect.
How can I achieve a current consumption of 1.67 µA? I measured the current on the module alone—with no pins connected—and I’m getting 20 µA (only the power pins are connected). Here is my code using the Arduino RUI Library:
Hello Bernd,
I tested and same power consumption.
What I observed it is that the serial RX are still running and waiting for a char.
Is it expected? Its possible do disable it?
For info: I`m using RUI_4.1.1_RAK3172-E_final.hex bootloader.
For which condition I can assume 2uA of power consumption?