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

Sleep mode with SoftDevice + DFU + RTC

Hi, I'm on last step of developing, but I have this critical trouble.
For the project, I started from ble_app_buttonless_dfu sample of SDK15.3. I added some peripheral (one timer, two I2C, two UART) for my custom HW and a GATT database.
My custom application works fine, and even BLE and DFU are working.
Now I need to put in sleep mode the system, awake it every 10 minutes, sample and send data, sleep for 10 minutes, awake and so on. (the device is battery powered).
I try to use the sd_app_evt_wait(), but the function exit immediatly. I tried many way (disabling softdevice, disabling IRQ ...), but I'm not be able to reach my goal (see image below)
Where I wrong? Can you help me asap?
Many many thanks
Abele -Italy

Parents
  • Hi,

    Are you calling call sd_app_evt_wait() from your main loop like the idle_state_handle() function in the ble_app_buttonless example? Note that it may have to be called multiple times to clear the internal event registers before the CPU can go to sleep. Also, what is the idle current you measure now? 

  • Hi Vidar,

    Yes, the call is inside the main loop, then the function is called multiple times.
    It seems that idle current is same as run mode (in my case about 3mA).
    A further request: the debug mode is automatically disabled when I disconnect the SWD pod?
    Or there are some action to do inside the code to disable it?

  • Hi,

    The debugger should exit debug mode when it's done programming or when you exit a debug session. The chip will not go out of debug interface mode if you just disconnect the cable.  Before you start measuring I would recommend you to do a power cycle of your board to make sure it boots into 'normal' mode.

    Another possible explanation is that the CPU does not go to sleep because of a pending FPU event ([87] CPU: Unexpected wake from System ON Idle when using FPU). Of course, this is only relevant if you actually use FP instructions in your code. The workaround is included in power management module used in our examples, see nrf_pwr_mgmt_run()->PWR_MGMT_FPU_SLEEP_PREPARE()

  • Hi Vidar,

    I add the FPU disable code, but nothing change. 
    My main loop code is:

        // Enter main loop.
        for (;;)
        {
            //idle_state_handle();
          
            #if (__FPU_USED == 1)
            _set_FPSCR(_get_FPSCR() & ~(0x0000009F)); 
              (void) __get_FPSCR();
              NVIC_ClearPendingIRQ(FPU_IRQn);
            #endif
            sd_app_evt_wait();
            periph_check();
    
        }

    the periph_check() reads some I2C data every 10 msec. 
    The current profile has a minimum sink of 3mA (in the "idle" time between I2C data reading)
    Any other suggests?

Reply
  • Hi Vidar,

    I add the FPU disable code, but nothing change. 
    My main loop code is:

        // Enter main loop.
        for (;;)
        {
            //idle_state_handle();
          
            #if (__FPU_USED == 1)
            _set_FPSCR(_get_FPSCR() & ~(0x0000009F)); 
              (void) __get_FPSCR();
              NVIC_ClearPendingIRQ(FPU_IRQn);
            #endif
            sd_app_evt_wait();
            periph_check();
    
        }

    the periph_check() reads some I2C data every 10 msec. 
    The current profile has a minimum sink of 3mA (in the "idle" time between I2C data reading)
    Any other suggests?

Children
Related