Hello community
I try to send via UDP data from my ESP32 to my laptop. Sending the data in the loop()-fuction works without any problems.
Now I want to send the data using an interrupt fuction (timer based).
void IRAM_ATTR onTimer()
{
Serial.println("test");
if(connected){
//Send a packet
udp.beginPacket(udpAddress,udpPort);
udp.printf("test");
udp.endPacket();
}
}
The timer starts and the ESP32 connects to my wifi, but after 2 seconds the ESP32 resets. Then the timer starts again and the ESP32 connects again and so on.
Without sending data via udp there is no reset.
DO you have any ideas what my problem is?
Thanks for you help
Yours Lukas
ESP32 reboot when using wifi and timer iterrupt
-
- Posts: 9746
- Joined: Thu Nov 26, 2015 4:08 am
Re: ESP32 reboot when using wifi and timer iterrupt
There's a fair few things you can't do in an interrupt... and println and sending UDP data likely are not things that are allowed there. Suggest reworking your interrupt to simply set a flag or semaphore or something, and doing the actual printing and sending in a task (maybe your main loop function can do it?).
Who is online
Users browsing this forum: No registered users and 71 guests