I'm trying to lower the power consumption in the s.c. "System ON" mode. I need to run in System ON mode to keep the RTC running. However I need to wake the CPU on an external IRQ activity and I'm using the GPIOTE driver to setup the wake up event (nrf_drv_gpiote_in_event_enable()).
Right now the CPU consumes ~9.5uA in this mode. By disabling the GPIOTE driver (nrf_drv_gpiote_uninit()) I can lower the consumption to about 6uA+, but then I lose the wake-up functionality. Is there a way to keep this functionality but have the GPIOTE driver disabled or somehow bypass the driver and implement just the wake-up functionality? Is there a way to control the peripheral internal clock and/or the CPU clock itself?
Additionally, how can I disable the softdevice when I don't need BLE functionality?
Do you have any other GPIOs configured than the one used for wakeup? And how have you configured that pin? obviously as an input, but how is the rest of the configuration?
If there are any others, especially if any are used as output pins, you should disable these pins before going to "System ON" mode.
And what pin do you use as wakeup pin? Is it P0.09 or P0.10? Or any of the others?
Hi, thanks for your input.
I have other pins configured as well. I have some output pins which are not actively being used. They are used at startup to enable other devices on the board. Does disabling the pins preserve their output state?
As for input pins I have two and they are configured as follows:
static nrf_drv_gpiote_in_config_t irq1_config = GPIOTE_CONFIG_IN_SENSE_LOTOHI(true);
irq1_config.pull = NRF_GPIO_PIN_NOPULL;
APP_ERROR_CHECK(nrf_drv_gpiote_in_init(LIS2DH_IRQ1, &irq1_config, irq1_handler));
static nrf_drv_gpiote_in_config_t irq2_config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(true);
irq2_config.pull = NRF_GPIO_PIN_NOPULL;
APP_ERROR_CHECK(nrf_drv_gpiote_in_init(LIS2DH_IRQ2, &irq2_config, irq2_handler));
nrf_gpio_cfg_sense_input(LIS2DH_IRQ2, NRF_GPIO_PIN_NOPULL/*NRF_GPIO_PIN_PULLUP*/, NRF_GPIO_PIN_SENSE_LOW);
IRQ1 pin is used as a regular IRQ and I can disable it when going into "system ON" sleep and later enable i only prior I need it.
As fro IRQ2 that one is used as a wake-up and as shut-down as well. I can reconfigure even that one to uses it just as a sense pin for wakeup without having the irq handler functionality. I just need to find a way to know why I was waken up. Was this the RTC (1 second) event or was it the IRQ2 pin? Any hints there like reading a status register or similar?
It is probably the output pins that draw the current. Can you try to disable them?
Sorry, I was a bit quick on the trigger.
The pins will not maintain the state while they are disabled, but they will be remembered until you init them again, since the state is written in a different register.
If you need to keep them in a certain state while you are in system ON, this will draw some current. That is how electronics work.
But to check whether that is actually the part drawing current here, can you check whether the current consumption drops if you try to uninit the pins before going to sleep?
Try to use the nrf_drv_gpiote_in_uninit() on the pins that are used for output pins.