This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to make the nrf52840 in sleep-mode & wake-up after every 'n' seconds using software interrupt(from internal RTC/timer library)?

Consider, I have checked these threads: https://devzone.nordicsemi.com/f/nordic-q-a/38832/system-on-sleep-mode & https://devzone.nordicsemi.com/f/nordic-q-a/30351/how-to-control-specific-time-nrf52832-sleep-mode-system-off-mode

Trying to do auto-wake using NVIC_SystemReset() or RESET or wake-up the controller after every 15mins using internal RTC or software interrupt but didn't work out for me. Also, tried these:

 __WFI();
__SEV();
__WFE();

But no results on sleep mode as there are BLE interrupts that may interrupt __WFE()

Will sd_power_system_off() makes internal RTC OFF?

Any code snippet for System On sleep mode & wake-up?

Is it possible to wake-up the NRF52840 using Software Interrupt?

Regards

Vishal Aditya

Embedded Software Engineer

Parents
  •  __WFI();
    __SEV();
    __WFE();

    The correct sequence to put the CPU in System ON sleep(idle-mode) is:

            // Wait for an event.
            __WFE();
            // Clear the internal event register.
            __SEV();
            __WFE();

    If you are using the SoftDevice, you should use sd_app_evt_wait() instead.

    Will sd_power_system_off() makes internal RTC OFF?

    Yes. System OFF is the deepest power saving mode the system can enter. In this mode, the system’s core functionality is powered down and all ongoing tasks are terminated.

    Any code snippet for System On sleep mode & wake-up?

    Any interrupts that happens when the CPU is in System ON sleep will wake the CPU up, and the CPU will process the interrupt.

    Is it possible to wake-up the NRF52840 using Software Interrupt?

    From System ON sleep, yes. But not in System OFF sleep. When in System OFF mode, the device can be woken up through one of the following signals:

    1. The DETECT signal, optionally generated by the GPIO peripheral
    2. The ANADETECT signal, optionally generated by the LPCOMP module
    3. The SENSE signal, optionally generated by the NFC module to “wake-on-field”
    4. A reset
  • Hi  Thanks for your response!

    Further, I also tried the below sequence:
    1. Create a TIMER & tick every 15mins which gives INTERRUPT.
    2. Turn OFF all the peripherals.
    3. sd_app_evt_wait(); this holds the nrf & power consumption but BLE/softdevice handlers breaks this.
    4. if ble_stack_init(); gap_params_init();gatt_init();services_init();advertising_init();conn_params_init();advertising_start(); is not called then this sequence works properly.

    Please guide/suggest us how to turn-off/disable all the interrupt handlers of BLE+softdevice so that nrf can go to sleep/wait, any API?

Reply
  • Hi  Thanks for your response!

    Further, I also tried the below sequence:
    1. Create a TIMER & tick every 15mins which gives INTERRUPT.
    2. Turn OFF all the peripherals.
    3. sd_app_evt_wait(); this holds the nrf & power consumption but BLE/softdevice handlers breaks this.
    4. if ble_stack_init(); gap_params_init();gatt_init();services_init();advertising_init();conn_params_init();advertising_start(); is not called then this sequence works properly.

    Please guide/suggest us how to turn-off/disable all the interrupt handlers of BLE+softdevice so that nrf can go to sleep/wait, any API?

Children
  • Please note that RTC1 is used by the app_timer, so if you are not using the app_timer to generate the 15 min interrupt, but instead interfacing directly with the RTC1, then you should use RTC2 for the 15min interrupt instead.

    You don’t need to disable the SoftDevice, just make sure that you disable all active BLE links, and that you turn off any advertising or scanning that is enabled. To minimize the power consumption, you should also turn off the logging(i.e. set NRF_LOG_ENABLED to 0).

Related