Wake up on GPIO interrupt

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

cross mob
Anonymous
Not applicable

What are sequence of event that happens when we wake up from GPIO interrupt, where can we find access to do application stuff on waking up from sleep?

I have a customer application where the device can go to sleep after initializing and then wake up on GPIO interrupt but the device doesn't to go to sleep again. I have the GPIO pin configured for interrupt (which seems to work) & also defined register interrupt handler which just puts the device back to sleep if condition fails.  It seems like we never enter interrupt handler routine.  I am using spi_comm_master.c example as my reference.

Can we put the device to sleep in callback function?

Is there a place in application where stack will sit and spin its wheels where we can write application stuff that is independent of interrupt/timer?

-R

0 Likes
1 Solution
StBa_721356
Level 5
Level 5
50 likes received 25 likes received 10 likes received

We had the same issue with our firmware running on a 20736.

Our solution is 'simple':

1. when we want to enter deep sleep we set a flag in the NVRAM and reboot the chip

2. when we rebooted we check the that flag from the NVRAM. If it is set then we clear it in the NVRAM and enter deep sleep via bleprofile_PrepareHidOff().

You have to allow waking up from deep sleep with devlpm_enableWakeFrom(DEV_LPM_WAKE_SOURCE_GPIO) before calling bleprofile_PrepareHidOff().

Also make sure that you allow deep sleep in your code. Among other things you should check that a potential callback function registered with devlpm_registerForLowPowerQueries() returns the correct value.

View solution in original post

1 Reply