Device does not come out of low power

We are using nRF52833 with Softdevice S113 for BLE.

in the OS_Idle function, nrf_pwr_mgmt_run is called.

But never comes out of sleep.

Is there a need to call nrf_drv_power_sleepevt_init?

Are examples available?

thanks

Geert Venken

Parents
  • Hi,

    Are you using embOS and do you know if interrupts are disabled when this function is called?

    Thanks,

    Vidar

    EDIT: Please enable SEVONPEND to see if it helps. You can do this by adding this line at the beginning of main():

    SCB->SCR |= SCB_SCR_SEVONPEND_Msk;

  • Hi Vidar,

    We are using embOS and interrupts are enabled.:

    This is the Idle funciton:

    void OS_Idle(void) { // Idle loop: No task is ready to execute
    #if USE_TICKLESS_IDLE == 1
      if (low_power_enabled) {
        OS_INT_IncDI();
        OS_TIME idleTicks = OS_TICKLESS_GetNumIdleTicks();
        if (idleTicks > RTC_WAKEUP_MIN_TIME) {
          if (idleTicks > RTC_WAKEUP_MAX_TIME) {
            idleTicks = RTC_WAKEUP_MAX_TIME;
          }
          if (idleTicks > 1000) { // more than 1 second
            rtc_suspend_interrupt();
          }
          rtc_set_wakeup(idleTicks, &WakeupCallback);
          SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
          SysTick_CTRL_ENABLE_Msk; /* Disable SysTick IRQ */
          OS_TICKLESS_Start(idleTicks, &EndTicklessMode);
        }
        OS_INT_DecRI();
      }
    #endif
    #if USE_LOAD_MEASUREMENT == 1
      while (1) { // Nothing to do ... increment counter for load measurement
        OS_INC_IDLE_CNT();
      }
    #else
      while (1) { // Nothing to do ... wait for interrupt
      if (low_power_enabled) {
        nrf_pwr_mgmt_run();
      }
    }
    #endif
    }

    Interrupts are disabled around the RTC calculations and function but not around the nrf_pwr_mgmt_run function.

    What I noticed when the WFE is called (in the debugger)

    :

    Must these be set to 1?

    thanks,

    Geert

Reply
  • Hi Vidar,

    We are using embOS and interrupts are enabled.:

    This is the Idle funciton:

    void OS_Idle(void) { // Idle loop: No task is ready to execute
    #if USE_TICKLESS_IDLE == 1
      if (low_power_enabled) {
        OS_INT_IncDI();
        OS_TIME idleTicks = OS_TICKLESS_GetNumIdleTicks();
        if (idleTicks > RTC_WAKEUP_MIN_TIME) {
          if (idleTicks > RTC_WAKEUP_MAX_TIME) {
            idleTicks = RTC_WAKEUP_MAX_TIME;
          }
          if (idleTicks > 1000) { // more than 1 second
            rtc_suspend_interrupt();
          }
          rtc_set_wakeup(idleTicks, &WakeupCallback);
          SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
          SysTick_CTRL_ENABLE_Msk; /* Disable SysTick IRQ */
          OS_TICKLESS_Start(idleTicks, &EndTicklessMode);
        }
        OS_INT_DecRI();
      }
    #endif
    #if USE_LOAD_MEASUREMENT == 1
      while (1) { // Nothing to do ... increment counter for load measurement
        OS_INC_IDLE_CNT();
      }
    #else
      while (1) { // Nothing to do ... wait for interrupt
      if (low_power_enabled) {
        nrf_pwr_mgmt_run();
      }
    }
    #endif
    }

    Interrupts are disabled around the RTC calculations and function but not around the nrf_pwr_mgmt_run function.

    What I noticed when the WFE is called (in the debugger)

    :

    Must these be set to 1?

    thanks,

    Geert

Children
Related