High power consumption when using FPU

Hi everyone,

the same code below works fine on nrf51, but it trigged FPU exception on nrf52.

uint32 a;
a = (uint32_t)1.35;

since the FPU exception trigged, nrf52 cannot enter low power mode anymore, what should i do, any help will be really appreciated.

Best Reagards,

Eugene

  • SDK release notes:

    ** 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();
      }