ArduinoOTA icon indicating copy to clipboard operation
ArduinoOTA copied to clipboard

Udp not working well in combination with this library

Open peno64 opened this issue 1 year ago • 2 comments

Hi,

Working on an Arduino Mega with ethernet shield and using Ethernet.h and EthernetUdp.h All is working fine in my sketch except for one thing. In my sketch I also get the internet time from an NTP time server via Udp. I noted that I have to call ArduinoOTA.end(); before I do Udp communication otherwise Udp totally doesn't work. If I do call it (and afterwards ArduinoOTA.begin) it works the first time to do the Udp communication to get the NTP time, sometimes it works a second time but then it doesn't work anymore. I don't receive any data anymore from the NTP server so I guess Udp is broken. In fact it's the Udp.beginPacket(address, 123) call that fails. It returns 0 instead of 1. This until a reset is done. I tried calling Udp.begin again, doesn't help. I tried defining NO_OTA_PORT before including this library, doesn't help. If I disable ArduinoOTA then there is no problem at all. I can get NTP time as many times as I want. Any idea what could be the problem? Should I add some code somewhere?

Thank you.

peno64 avatar Aug 26 '24 19:08 peno64

I added ArduinoOTA to UdpNtpClient example and it works

JAndrassy avatar Aug 27 '24 11:08 JAndrassy

Indeed it does.

Have to see why my sketch behaves differently.

Thx

peno64 avatar Aug 27 '24 11:08 peno64