Wake up from sleep on ISR

gibson12345
Posts: 58
Joined: Wed Jul 17, 2019 11:45 pm

Wake up from sleep on ISR

Postby gibson12345 » Tue Sep 03, 2019 4:39 am

Hey everyone,

I've been trying to interface with an accelerometer to use as a way to wakeup from sleep if the device is shaken and also put it to sleep on an inactivity timer. I've managed to get the device to go to sleep on the timer just fine and I thought I had correctly enabled gpio wakeup with the following

Code: Select all

	gpio_wakeup_enable(LIS3DH_INTR, IRQ_WAKEUP_LEVEL == 1 ? GPIO_INTR_LOW_LEVEL : GPIO_INTR_HIGH_LEVEL);
    	esp_sleep_enable_gpio_wakeup();
but I can't seem to get any wakeup from the GPIO.

I know for sure that I'm receiving interrupts because when it's not asleep I receive the interrupt just fine. Are there any obvious causes that I might be missing?

EDIT:

So after some testing if I shake the accelerometer while asleep when it eventually wakes up from sleep from a timer it fires the ISR and relevant task after

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Wake up from sleep on ISR

Postby WiFive » Tue Sep 03, 2019 9:20 am

Light sleep or deep sleep?

gibson12345
Posts: 58
Joined: Wed Jul 17, 2019 11:45 pm

Re: Wake up from sleep on ISR

Postby gibson12345 » Tue Sep 03, 2019 11:08 pm

Light sleep. Deep sleep required RTC Gpio correct?

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Wake up from sleep on ISR

Postby WiFive » Tue Sep 03, 2019 11:39 pm

Yes. Have you tried the console example or light sleep example? Also your code is

Code: Select all

if(IRQ_WAKEUP_LEVEL == 1)
   level = GPIO_INTR_LOW_LEVEL
Is that what you want?

gibson12345
Posts: 58
Joined: Wed Jul 17, 2019 11:45 pm

Re: Wake up from sleep on ISR

Postby gibson12345 » Wed Sep 04, 2019 12:13 am

Hey WiFive,

Correct the interrupt signal is configured to be low active so that's fine.
I have tried the example light sleep code and it works just fine, as I stated above I have to interrupt working fine when it's awake and it wakes up off an interrupt just fine from a button or such but not from my accelerometer.
Any thoughts on why this might be?

boarchuz
Posts: 610
Joined: Tue Aug 21, 2018 5:28 am

Re: Wake up from sleep on ISR

Postby boarchuz » Wed Sep 04, 2019 4:19 am

Are you sure it's not waking up? Is it possible that it's waking, but not executing the ISR? What is the duration of the interrupt signal?

gibson12345
Posts: 58
Joined: Wed Jul 17, 2019 11:45 pm

Re: Wake up from sleep on ISR

Postby gibson12345 » Wed Sep 04, 2019 5:37 am

I figured out the issue thanks everyone.

Cheers,
Gibson

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot], dzungpv, ESPBoards, MicroController, ok-home and 128 guests