Network lost after few requests (udp socket)
Posted: Tue Nov 08, 2016 4:25 pm
Hi there,
i am new here so i hop this is the right place, if not please don't kick me
I am working on a project that involves switching and dimming 230volt ac mains using UDP data and an esp to control it (currently using the WEMOS d1 MINI board). So far, the electronic side is working fine, sending commands etc also works just fine.
The problem i am having is that after a few requests the network stack seems to die.
I tried various things:
first i was using the Arest library -> died after a while and coused WDT resets.
Then i went to pulling the data from the server -> did not like it since you are spamming the server without any reason since data is not updated every second
Now i am using UDP esnd and receive with WifiUdp.h, this seems to work fast and good, that is untill you made 15 or so requests with a short interval to it, then the whole thing dies.
Weird thing is, i dont get a watchdog reset, and in my code i have a delay(100) followed by a serial write of the micros(). This still updates. The esp itself is not pingable in this state ant it wont process any following UDP packets (same thing happend to aRest).
The question i have is what might cause this, i have been puzzeling for two days now.
Things to consider: there is a 50hz signal from the mains (zero crossing signal) coming into the esp on D5, this triggers a interupt on rising edge to perform the dimming. In this interupt is a maximum delay of 10 mS (half a full 50hz mains wave). I suspected this to cause the problems, but then, a friend of mine had the same problems with dropping without any interupts.
I uploaded my current code as attachment, feel free to use it if u like!
i am new here so i hop this is the right place, if not please don't kick me
I am working on a project that involves switching and dimming 230volt ac mains using UDP data and an esp to control it (currently using the WEMOS d1 MINI board). So far, the electronic side is working fine, sending commands etc also works just fine.
The problem i am having is that after a few requests the network stack seems to die.
I tried various things:
first i was using the Arest library -> died after a while and coused WDT resets.
Then i went to pulling the data from the server -> did not like it since you are spamming the server without any reason since data is not updated every second
Now i am using UDP esnd and receive with WifiUdp.h, this seems to work fast and good, that is untill you made 15 or so requests with a short interval to it, then the whole thing dies.
Weird thing is, i dont get a watchdog reset, and in my code i have a delay(100) followed by a serial write of the micros(). This still updates. The esp itself is not pingable in this state ant it wont process any following UDP packets (same thing happend to aRest).
The question i have is what might cause this, i have been puzzeling for two days now.
Things to consider: there is a 50hz signal from the mains (zero crossing signal) coming into the esp on D5, this triggers a interupt on rising edge to perform the dimming. In this interupt is a maximum delay of 10 mS (half a full 50hz mains wave). I suspected this to cause the problems, but then, a friend of mine had the same problems with dropping without any interupts.
I uploaded my current code as attachment, feel free to use it if u like!