Plugged/unplugged ethernet cable

#1

Hi, I’d like to know if there is a way to understand if the Ethernet cable is plugged or unplugged in w5300.
thanks

#2

I don’t think so with W5300. But depending on the socket mode you are using, you might have some answer here.

If it’s TCP then check out RTR and RCR registers. If the transmission doesn’t succeed even after the retries they’ll eventually close the socket. So when you do TCP, status register would ideally be in established state as long as everything is fine. If you unplug the cable, the time out will cause the socket to close and the status register will now be in closed state.

#3

Hi,
You can check to it using monitoring the LINKLED signal provided by W5300.

For monitoring LINKLED, You should connect LINKLED to your host GPIO pin as input.

Thank you.

#4

Ok, I’ll try the 2 solutions!!!
Thanks to midnightcow and lr15 for the answer.

#5

Dont forget the pullup, otherwise you will read garbage on this GPIO pin.
uC internal pullup on GPIO usually is sufficient.

Michael