Hello Nordic team,
Our current setup:
- nRF52840
- nRF SDK v15.00
In our current setup, the steps we take are as following:
Initialize nRF52840 -> BLE fast advertisement -> BLE slow advertisement -> Deep sleep
Once the timeout is completed for BLE advertising, we put nRF52840 to deep sleep.
We want to wake up our nRF system when we receive an external interrupt (High).
To accomplish this, we set up a pin as shown below
nrfx_gpiote_in_config_t pin_config = NRFX_GPIOTE_CONFIG_IN_SENSE_LOTOHI(false);
pin_config.pull = NRF_GPIO_PIN_PULLDOWN;
if (gpiote_drv_initialized == false)
{
err_code = nrfx_gpiote_init();
check_error_code(__func__, err_code, 1);
gpiote_drv_initialized = true;
}
if (irq_enabled == true)
{
err_code = nrfx_gpiote_in_init(MOTION_IRQ_PIN, &pin_config, gpio_irq_evt_handler);
check_error_code(__func__, err_code, 2);
nrfx_gpiote_in_event_enable(MOTION_IRQ_PIN, true);
}
Once pins are set and the interrupt is triggered, interrupt handler function sets wom_interrupt_event = true
My main function while loop:
while (1)
{
if (interrupt_evt != true)
{
err_code = ble_advertising_start(&m_advertising, BLE_ADV_MODE_FAST);
check_error_code(__func__, err_code, 1);
gpio_interrupt_config(false);
interrupt_evt_processing = false;
}
check_advertising_state();
while (wom_interrupt_evt != true)
{
__SEV();
__WFE();
// Enter System ON sleep mode
__WFE();
}
interrupt_evt = false;
wom_interrupt_evt = false;
}
system_shutdown()
err_code = sd_power_system_off();
check_error_code(__func__, err_code, 1);
Though, everything works as intended in our case. The power consumption during deep sleep seems to be quite high.
Looking over into the forums, I saw a lot of suggestions regarding changing the pin_config with hi_accuracy disabled.
Some other forums suggested something to do with latches, which I could not completely understand, (link)
My questions:
- Could you please let us know if there are any changes to be made to the pin configuration above which can help us save power.
- Could you also let me know if my shutdown configuration and appropriate.
- Where/when should I call the system_shutdown() function if I want to enable the interrupt detection pin before going into deep sleep.
Please let me know in case you need any more info. Thanks in advance.
Regards,
Avi