W5100 with FRDM-KL46Z, UDP problem with NTP consulting


I’m new in the foro and i working on a few weeks with the W5100 module in a FRDM-KL46Z board. I’m programmer for a lot time ago, in C and C++ languages.

In this moment, the project that i working is about a Web Server for IoT device to control differents industrial process and log data.

The WebServer is all right but, when i need to log something, i need the date and time for correct data logging. So, i try to get the date and time from NTP protocols.

Ok, here is when the problems begans. I trying to make a client to connect with teh NTP servers, but when i make the data send to wait the answer from the server, the only menssage what i have is an ARP.

I make all the steps like the datsheet show and i check my code with Arduino examples or the other users make do, but i always have an ARP to the gateway. What can i do?


How are you allocating ip?
If you are using virtual ip as a static ip, you need to port forwarding.

Thanks for your answer.

I’m using a static IP, because i don’t have programed the DHCP algorithm.

How i make that? I open the socket with the local port, then i put the destination port and destination IP, and send the message for the NTP solicitation. Finally, i close the socket.

With that, in the wireshark i can see the ARP with a broadcast, but nobody responds.


How i make teh “port forwarding”??

If you use a virtual ip without dhcp, you can’t send to packet external network.
Port forwarding be configured at the router.
Please find out how to set up your router.

Ok, i understand.

That’s why I started testing the code with DHCP and was able to make it work. Thank you!

One more thing, how could you do with the W5100 to detect the cable connection?


The lastest chip of wiznet has phy register that can read phy link status.
But W5100 don’t have it.
So please ping test.