Deep sleep is only working in debugging and not without debugging

I am using nrf52811 in my PCB, and sdk version 16.00

I am encountering a challenge related to implementing deep sleep functionality, and as a beginner, I've been struggling to configure it correctly. Despite my best efforts, my device does not seem to enter sleep mode in its normal standalone operation. I've verified this by monitoring its current consumption, which remains nearly the same as in active mode.

CASE 1: STANDALONE

What happens is that the device disconnects from Bluetooth Low Energy (BLE), and I cannot reconnect it unless the device detects a low signal on GPIO pin 18.

CASE 1: DEBUGGING MODE

Additionally, when the device disconnects from BLE, I observe a fatal error in the debug terminal and receive an "ERROR 8 (0*8) GATT_CONN_TIMEOUT" message in the nrf_connect mobile app. The device remains in this state until it detects a low signal on GPIO pin 18.

I've been grappling with this issue for about 10 days now and haven't been able to pinpoint the root cause or find a solution. I've attached my code below for review, and I would appreciate it if someone could help me identify where I might be making a mistake.

  • Hello,

    Despite my best efforts, my device does not seem to enter sleep mode in its normal standalone operation. I've verified this by monitoring its current consumption, which remains nearly the same as in active mode.

    How many milliamps do you measure when the when the device is supposed to be in System OFF and with the debugger disconnected?

    CASE 1: STANDALONE

    What happens is that the device disconnects from Bluetooth Low Energy (BLE), and I cannot reconnect it unless the device detects a low signal on GPIO pin 18.

    The chip is powered down in System OFF mode ( deep sleep) and can only be woken up by external input events.

    CASE 1: DEBUGGING MODE

    You can't enter system OFF mode when you are in debug interface mode, see Emulated System OFF mode.

  • How many milliamps do you measure when the when the device is supposed to be in System OFF and with the debugger disconnected?

    14mA

    The chip is powered down in System OFF mode ( deep sleep) and can only be woken up by external input events.
    Yes you are right , but the device is not going to deep sleep as current consumption remains same, but i don't know  why BLE disconnects and device also doesn't advertise

    You can't enter system OFF mode when you are in debug interface mode, see Emulated System OFF mode.
    Yes you are right , but i just wanted to test the behavior in debugging mode and it was working fine in debugging mode
    How it can be possible

  • The chip should not draw 14 mA in active mode unless you are sourcing several milliamps from your GPIOs. As a test, please add the code below to the beginning of main to see what your System ON current is.

    void main(void)
    {
        /* Enter System ON - measure current when debugger is disconnected */
        while (1)
        {
            __WFE();
        }
        ...

    but the device is not going to deep sleep as current consumption remains same, but i don't know  why BLE disconnects and device also doesn't advertise

    The connection will be terminated when the chip powers down. 

    Yes you are right , but i just wanted to test the behavior in debugging mode and it was working fine in debugging mode

    The chip keeps running instead of powering down since you are in debug interface mode. 


  • 1)--When i include the part of code that you send in very start of code the current consumption is 0mA and nothing works like no advertising , no ble
    But when i include this part of code at the end of main loop the current consumption is 14mA and sometimes 15mA

    2)---Connection is terminating but power consumption remains same

    3)---But in debug mode after the device enters in deep sleep current consumption is 0mA,
    I have read in answers of several questions related deep sleep that in debug mode device doesn't go to deep sleep but in my case i don't know why it's opposite situation 

  • 1) The purpose of this test was to verify that the System ON current without your code running. Expecteed sleep current in System ON is around 1 uA. 

    2) Yes, so we have to figure out what is causing the current consumption to be 14 mA. Are you driving any LEDs, etc from your GPIO outputs?

    3) The current consumption can't be 0 mA if the chip is in debug interface mode.

Related