I am using a W5500 chip. This works (with the default Arduino Ethernet 2 library) but if my internet is down, then Udp.endPacket(); results in a freeze/hang.
So it seems that the timeout is not working. Should I use a different library for W5500 (if yes, which one?)
Did you use the UDP example provided by arduino?
If no, the first thing to do is check out the UDP send/recv example.
Also, please add this debug message your code.
Serial.print("Udp.beginPacket is ");Serial.println(Udp.beginPacket(ntpServer, ntpPort));
Serial.print("Udp.write is ");Serial.println(Udp.write(packetBuffer, NTP_PACKET_SIZE));
Serial.print("Udp.endPacket is ");Serial.println(Udp.endPacket());
If Udp.endPacket don’t return the value, you are running out of SRAM,that would cause corrupted variables.