GPIO state in deep sleep

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
StBa_721356
Level 5
Level 5
50 likes received 25 likes received 10 likes received

You state that:

GPIOs that are output enabled will remain so and drive as configured in sleep/deep sleep in Sleep Deep_Sleep Explanation and Techniques

We tested this with our BCM20736 device and it looks like it does not work. We set one GPIO as output/high. As soon as the device enters deep sleep the GPIO goes low.

We are using SDK 2.1.1 and the following code snippet taken from etc_sample.c:

gpio_configurePin(0, 3, GPIO_OUTPUT_ENABLE, GPIO_PIN_OUTPUT_HIGH);
ble_trace1("Entering deep sleep. Will wake up in %d seconds...", 10000);

gpio_configurePin(0, 0, 0x100, 0);

// Configure the low power manager to enter deep sleep.
devLpmConfig.disconnectedLowPowerMode = DEV_LPM_DISC_LOW_POWER_MODES_HID_OFF;

// Configure the wake time in mS.
devLpmConfig.wakeFromHidoffInMs = 10000;

gpio_configurePin(0, 0, 0x100, 0);

// Enter deep-sleep now. Will not return.
devlpm_enterLowPowerMode();

When the device is in deep sleep mode then GPIO P3 is low. But it should be high.

Why is this so?

1 Solution
asridharan
Employee
Employee
10 comments on KBA 5 comments on KBA First comment on KBA

Register for callbacks to the enter/abort hid-of (deep sleep) callbacks and provide an empty implementation for these:

void application_create(void)

{

    // all other init

    bleprofile_regAppEvtHandler(BLECM_APP_EVT_ENTERING_HIDOFF, (BLECM_NO_PARAM_FUNC)app_enter_hidoff);

    bleprofile_regAppEvtHandler(BLECM_APP_EVT_ABORTING_HIDOFF,(BLECM_NO_PARAM_FUNC)app_abort_hidoff);

}

void app_enter_hidoff(void)

{

    // Do nothing.

}

void app_abort_hidoff(void)

{

    // Do nothing.

}


There is a bug in the default implementation of the callback in the ROM where it is input enabling all IOs.

View solution in original post

2 Replies
asridharan
Employee
Employee
10 comments on KBA 5 comments on KBA First comment on KBA

Register for callbacks to the enter/abort hid-of (deep sleep) callbacks and provide an empty implementation for these:

void application_create(void)

{

    // all other init

    bleprofile_regAppEvtHandler(BLECM_APP_EVT_ENTERING_HIDOFF, (BLECM_NO_PARAM_FUNC)app_enter_hidoff);

    bleprofile_regAppEvtHandler(BLECM_APP_EVT_ABORTING_HIDOFF,(BLECM_NO_PARAM_FUNC)app_abort_hidoff);

}

void app_enter_hidoff(void)

{

    // Do nothing.

}

void app_abort_hidoff(void)

{

    // Do nothing.

}


There is a bug in the default implementation of the callback in the ROM where it is input enabling all IOs.

Thanks, arvinds! This indeed fixes the issue!

0 Likes