This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

[SOLVED] nRF52: sd_app_evt_wait() will not go to sleep

I'm having a strange problem, where sd_app_evt_wait() won't make the CPU sleep, after I've started a app_timer (consuming >2mA). Its working perfectly before I've started it, only dragging around ~1uA.

Im using the nRF5 11.0.0 SDK with the s132 softdevice (on NRF52832).

Any ideas what may be causing this? Or how I can make it sleep while the timer is running?

EDIT: I'm pretty sure the app_timer_start i'm using is stopping the CPU from sleeping. I thought the CPU could sleep, when using the app_timers? Im using a timer that makes a callback run every 10 seconds. It will not sleep while this timer is running...

Parents
  • The application timer uses the RTC so it should not cause the CPU to remain on.

    What are you doing in the timer callback? Are you sampling any ADCs?

    If so there is a known issue resulting in high current consumption when using nrf_drv_saadc_buffer_convert(), see this thread: devzone.nordicsemi.com/.../

    There is also a known issue with the FPU interrupts: infocenter.nordicsemi.com/index.jsp

        ** FPU **
    - When the FPU is in use, it triggers the FPU_IRQn interrupt when one of
      the six exception flags (IDC, IXC, UFC, OFC, DZC, IOC) is set.
      The FPU interrupt will always set the pending flag (even if the 
      interrupt is not enabled), irrespective of whether the user is 
      interested in the exception bit.
      The pending flag then prevents the SoftDevice from going into low 
      power mode when sd_app_evt_wait() is called.
      Therefore, always clear the exception bits and the pending interrupt 
      before calling sd_app_evt_wait(). See the code below for an example 
      implementation.
      FPU exception bit definition:
      infocenter.arm.com/.../index.jsp
      Example code:
      {
      // Set bit 7 and bits 4..0 in the mask to one (0x ...00 1001 1111)
      #define FPU_EXCEPTION_MASK 0x0000009F 
     
      ...
          /* Clear exceptions and PendingIRQ from the FPU unit */
          __set_FPSCR(__get_FPSCR()  & ~(FPU_EXCEPTION_MASK));      
          (void) __get_FPSCR();
          NVIC_ClearPendingIRQ(FPU_IRQn);
     
          /* Call SoftDevice Wait For event */
          error_code = sd_app_evt_wait();
      }
    

    Let me know if it helps.

Reply
  • The application timer uses the RTC so it should not cause the CPU to remain on.

    What are you doing in the timer callback? Are you sampling any ADCs?

    If so there is a known issue resulting in high current consumption when using nrf_drv_saadc_buffer_convert(), see this thread: devzone.nordicsemi.com/.../

    There is also a known issue with the FPU interrupts: infocenter.nordicsemi.com/index.jsp

        ** FPU **
    - When the FPU is in use, it triggers the FPU_IRQn interrupt when one of
      the six exception flags (IDC, IXC, UFC, OFC, DZC, IOC) is set.
      The FPU interrupt will always set the pending flag (even if the 
      interrupt is not enabled), irrespective of whether the user is 
      interested in the exception bit.
      The pending flag then prevents the SoftDevice from going into low 
      power mode when sd_app_evt_wait() is called.
      Therefore, always clear the exception bits and the pending interrupt 
      before calling sd_app_evt_wait(). See the code below for an example 
      implementation.
      FPU exception bit definition:
      infocenter.arm.com/.../index.jsp
      Example code:
      {
      // Set bit 7 and bits 4..0 in the mask to one (0x ...00 1001 1111)
      #define FPU_EXCEPTION_MASK 0x0000009F 
     
      ...
          /* Clear exceptions and PendingIRQ from the FPU unit */
          __set_FPSCR(__get_FPSCR()  & ~(FPU_EXCEPTION_MASK));      
          (void) __get_FPSCR();
          NVIC_ClearPendingIRQ(FPU_IRQn);
     
          /* Call SoftDevice Wait For event */
          error_code = sd_app_evt_wait();
      }
    

    Let me know if it helps.

Children
Related