Main program not waking up reliably from ULP

harshbutfair
Posts: 2
Joined: Wed Jan 25, 2023 1:33 pm

Main program not waking up reliably from ULP

Postby harshbutfair » Wed Jan 25, 2023 2:02 pm

I have a battery-powered ESP32 project to read how often the lights on my electricity meter are blinking. It was working reliably until I upgraded the firmware on my wireless router. Now it runs for one iteration and then doesn't wake up.

The ULP program counts uses a photoresistor to count how often the light blinks and wakes the main program up periodically.
The main program connects to wifi and sends a UDP message, and then goes back to sleep.

I've found three things that I can change to make the main program wake up reliably, but none of these are acceptable solutions:
1. Specifying incorrect wifi details so that the wifi never connects.
2. Removing the call to vTaskDelay after sending the UDP message. This results in the message very rarely being sent.
3. Removing all the important functionality from the ULP program so that it does nothing apart from wake up the main program after a delay.

This makes me think there is some subtle timing bug or memory handling error, but I've spent days on this and got nowhere. Can anyone see the bug that might explain the problem? My source code is here:

https://bitbucket.org/harshbutfair/powe ... aster/main

harshbutfair
Posts: 2
Joined: Wed Jan 25, 2023 1:33 pm

Re: Main program not waking up reliably from ULP

Postby harshbutfair » Sat Jan 28, 2023 2:13 pm

I never worked out what was wrong with calling vTaskDelay so now I send a ping and wait for a response instead.

Who is online

Users browsing this forum: ESP_Sprite and 127 guests