I have noticed that using Ethernet.isOn() with Device OS 5.3.2 and a featherwing Ethernet adaptor (with the default pin settings) no longer detects there being no ethernet cable? OS 5.3.1 supported the following simplified logic;
System.enableFeature(FEATURE_ETHERNET_DETECTION);
if (Ethernet.isOn())
{
Ethernet.connect
}
else
{
if (WiFi.hasCredentials()) {WiFi.connect}
}
If there is a LAN cable in the adaptor then it all works. If there is no LAN cable it still tries to connect to Ethernet.
I'm surprised that code ever worked. Ethernet has always been able to be on when there's no link. The EthernetCellularRK always tries to Ethernet.connect() and switches to Wi-Fi if it fails. I don't think there's an exposed method to find if there's link.
The connection time for Ethernet is typically very short so I guess if a try with Ethernet does not connect after a certain time then one can assume there is no cable plugged in. Ethernet.isOn() is just checking for the adaptor? I look into your EthernetCellular library, thanks for the link.
Yes, I've found connecting fails quickly when there's no link. There's also the trick of checking the MAC address in the library that's helpful if you're not sure whether the adapter will be there or not. It's a reliable way to tell the Ethernet FeatherWing is really present before attempting to connect.
I have had a P2 Eval Board with a ETH WIZ click board mounted on a featherwing protoboard running to test the connection to Ethernet with WiFi as backup. I'm using the EthernetCellular library you suggested modified to backup to WiFi when Ethernet is not available.
The main finding is that the Ethernet LAN never manages to connect to the Particle Cloud although calling Particle.connected once the LAN connection is made (which is very quick) returns true! The Log trace shows repeated tries and fails to get a Coap message reply.
Is this a router issue? If it is what setting is needed to avoid this problem?