-->
Page 1 of 2

Network lost after few requests (udp socket)

PostPosted: Tue Nov 08, 2016 4:25 pm
by devilmastah
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!

Re: Network lost after few requests (udp socket)

PostPosted: Tue Nov 08, 2016 10:25 pm
by mrburnette
I'm doing a UDP broadcast of a GPS $RMC sentence to multiple listeners. Been stable for 14 months.

https://www.hackster.io/rayburne/tardis-time-esp8266-ap-webserver-gps-6b5d2a


Ray

Re: Network lost after few requests (udp socket)

PostPosted: Wed Nov 09, 2016 12:14 am
by rudy
It's too late for me to try this tonight but I will see if I can try it tomorrow evening.

Re: Network lost after few requests (udp socket)

PostPosted: Fri Nov 11, 2016 6:10 pm
by devilmastah
Hi folks, the problem seems to be the actual interrupt. If i disconnect the 100hz signal it seems stable. I would assume the ESP should be powerfull enough to handle a 100hz interupt routine with a few mS wait in it, especially at 140mhz. I am at the point that i want to add a atmega368 to the pcb just to get rid of this problem, if anyone has a better idea on how to solve this i would love to hear it.