Anyone got wired ethernet working?

hello all

got anyone wired ethernet working reliably?

we got code (willing to share) based on this library. it sort of works but not on all networks (link goes up, connected to the lan, but will not connect to the cloud). i can use wireshark to investigate but am not sure what to look for. see basic idea below. what am i missing?

also see this post

thanks
frank

basic flow connecting to the cloud per wired ethernet:

    WiFi.disconnect();
    Ethernet.connect();

    waitFor(Ethernet.ready, 30000);

    if (Ethernet.ready()) {

       Particle.keepAlive(25s);
       Particle.connect();
       waitFor(Particle.connected, 300000);
    }
1 Like

Frank

Yup, exactly the same experience (with P2/Photon2) and any Ethernet shield. I have a rig with software that is an adaptation of Rick's cellular backup connection library. It prefers Ethernet if an ethernet adaptor is present but if it can't connect to the cloud with Ethernet will swap to WiFi. It will retry the Ethernet every 5 minutes when on WiFi. I have seen it connect to the cloud once with Ethernet. The Ethernet LAN connection is quick and reliable however the COAP setup fails and hence the cloud connection. If you try enabling Serial Log handler for the trace you can see the repeated tries and fails to connect.

I have asked for ideas as to why this is the case. Rick's answer some while back was that this is a problem with my router/ethernet hub settings.

I would certainly be interested in making progress with this as will soon be moving to P2/Photon2.

hi armor

yes, wired etherent connecting seems weird. one day it works and the next day it will not. i need to debug this but am not sure how. would be nice if particle engineers could take a look at the methods/logging/tarces

we follow the same as you but we are not trying to go back to ethernet if wifi is connected - if connected stay connected...

cheers
frank

this is Ethernet.ready()?

we tried different hardware (p2 kit + ethernet feather and our own), we tried the particle library (EthernetCellularRK) and our own code. all with the same result: some wired connections work most of the time and some do not work most of the time

really need help debugging this

@rickkas7 @marekparticle Could you please help with this Ethernet issue?
I believe it is something to do with the Device OS since I didn't experience this problem with Argon and Device OS 2.X.

Could you provide the trace log of the failure? Also, is the device stuck at fast blinking green, blinking cyan. or fast blinking cyan?

If you have the ability to get a Wireshark trace on the Ethernet LAN of packets going and from the Particle device that would be very helpful.

^ agreed, we need some low-level logs from SerialLogHandler with LOG_LEVEL_ALL. I'll follow this post closely.

@rickkas7 @marekparticle can i send logging directly to you? or what is the best way to share?

you can DM or post sanitized logs here? preference is for the latter

@marekparticle here is a link to github. basically @rickkas7's lib with small ino. only change in lib is force wifi

logs in logs folder. two setups: -1- connected to switch on my lab desk and -2- connected to my mac with internet-sharing turned on (wifi to usb-ethernet) and mac connected to the same network but wireless

this is our hw with eth on alternate pins. but same results with p2 eval board and feather eth. device-os 5.4.1

thanks for your help, greatly appreciated!

Thank you for the logs.

I took a quick look and there are some thing that are a little strange but I think someone who knows more about how the Ethernet stack works may be needed because I don't know what would cause the behavior in the logs.

let me know if you need more logs or more logging
i can also capture wireshark traces

desk-switch-lan-connect-instable.txt

This is interesting because it's mostly normal at first. The connection was established and the first keep-alive ping worked:

0000046506 [comm.coap] TRACE: Sending CoAP message
0000046507 [comm.coap] TRACE: CON 0.00  size=4 token= id=51
0000047082 [app] INFO: Ethernet: ready, WiFi: not ready, Cloud: connected
0000048084 [app] INFO: Ethernet: ready, WiFi: not ready, Cloud: connected
0000049082 [app] INFO: Ethernet: ready, WiFi: not ready, Cloud: connected
0000049956 [comm.coap] TRACE: Received CoAP message
0000049957 [comm.coap] TRACE: ACK 0.00  size=4 token= id=51
...

The next one, 25-ish seconds later, required 1 retry but eventually worked:

000075153 [comm.coap] TRACE: Sending CoAP message
0000075182 [comm.coap] TRACE: CON 0.00  size=4 token= id=52
...
0000079443 [comm.coap] TRACE: Retransmitting CoAP message; ID: 52; attempt 1 of 3
0000079513 [comm.coap] TRACE: Sending CoAP message
0000079517 [comm.coap] TRACE: CON 0.00  size=4 token= id=52
...
0000087356 [comm.coap] TRACE: Received CoAP message
0000087358 [comm.coap] TRACE: ACK 0.00  size=4 token= id=52

At 220 seconds in, things get worse and required 2 retries, but then recovered and worked normally.

0000220702 [comm.coap] TRACE: Retransmitting CoAP message; ID: 56; attempt 2 of 3
0000220704 [comm.coap] TRACE: Sending CoAP message

At 299 seconds, this message never got a response after 3 retries and the connection was reset:

0000299704 [comm.coap] TRACE: Sending CoAP message
0000299728 [comm.coap] TRACE: CON 0.00  size=4 token= id=59

If the problem was your router deleting the port forwarding, which would stop packets from being received, resetting the connection should have created a new socket and created a new port forwarding, so this behavior is not expected.

Interestingly, on reconnect, no packets were received either. At 360 seconds the firmware gave up on Ethernet and tried switching to cellular. This is in the firmware, not Device OS.

0000360057 [app.ethcell] INFO: Took too long to connect to the cloud by Ethernet, switching to cellular

That also failed, and switch back to Ethernet at 660 seconds from the firmware.

0000660144 [app.ethcell] INFO: Trying to connect by Ethernet

It's still unable to receive packets and switches again at 690 seconds.

0000690375 [app.ethcell] INFO: Took too long to connect to the cloud by Ethernet, switching to cellular

Eventually, at 1330 seconds, it attempts to connect by Ethernet and this time packets can be received and the cloud connection works. Some CoAP messages are still lots, but retry successfully until the end of the log at 1921 seconds.

0001330653 [app.ethcell] INFO: Cloud connected over Ethernet keepAlive=25

I can't explain this behavior.

@rickkas7 - would you mind working with @no1089 to document this issue internally so we can bring it to @eberseth for Triage next week?

1 Like

these two are from the same events: wireshark and logging

We'll take a look shortly.

1 Like

sometimes the p2 hangs trying to connect. see logging below. the led is solid cyan. nothing after the "T"...

0011089092 [app] INFO: Ethernet: not ready, WiFi: not ready, Cloud: not connected
0011090092 [app] INFO: Ethernet: not ready, WiFi: not ready, Cloud: not connected
0011091092 [app] INFO: Ethernet: not ready, WiFi: not ready, Cloud: not connected
0011092092 [app] INFO: Ethernet: not ready, WiFi: not ready, Cloud: not connected
0011093092 [app] INFO: Ethernet: not ready, WiFi: not ready, Cloud: not connected
0011094092 [app] INFO: Ethernet: not ready, WiFi: not ready, Cloud: not connected
0011095092 [app] INFO: Ethernet: not ready, WiFi: not ready, Cloud: not connected
0011096092 [app] INFO: Ethernet: not ready, WiFi: not ready, Cloud: not connected
0011097092 [app] INFO: Ethernet: not ready, WiFi: not ready, Cloud: not connected
0011098092 [app] INFO: Ethernet: not ready, WiFi: not ready, Cloud: not connected
0011099092 [app] INFO: Ethernet: not ready, WiFi: not ready, Cloud: not connected
0011099137 [app.ethcell] INFO: Trying to connect by Ethernet
0011099241 [system.nm] INFO: State changed: IFACE_UP -> IFACE_REQUEST_DOWN
0011099243 [system.nm] INFO: State changed: IFACE_REQUEST_DOWN -> IFACE_DOWN
0011099256 [system.nm] INFO: State changed: IFACE_DOWN -> IFACE_REQUEST_UP
0011099262 [net.ifapi] INFO: Netif en2 state UP
0011099433 [net.en] TRACE: Closed MACRAW socket
0011099465 [net.en] TRACE: Opened MACRAW socket, err = 0
0011099466 [system.nm] INFO: State changed: IFACE_REQUEST_UP -> IFACE_UP
0011099477 [net.en] INFO: Link up
0011099478 [net.ifapi] INFO: Netif en2 link UP, profile=NONE
0011099481 [system.nm] INFO: State changed: IFACE_UP -> IFACE_LINK_UP
0011100094 [app] INFO: Ethernet: not ready, WiFi: not ready, Cloud: not connected
0011101092 [app] INFO: Ethernet: not ready, WiFi: not ready, Cloud: not connected
0011102095 [app] INFO: Ethernet: not ready, WiFi: not ready, Cloud: not connected
0011102227 [hal] INFO: DNS server list changed
0011102229 [net.ifapi] TRACE: Netif en2 ipv4 configuration changed
0011102235 [system.nm] INFO: State changed: IFACE_LINK_UP -> IP_CONFIGURED
0011102443 [system] INFO: Cloud: connecting
0011102479 [system] INFO: Read Server Address = type:1,domain:$id.udp.particle.io
0011102481 [system] INFO: Loaded cloud server address and port from session data
0011102487 [system] TRACE: Address type: 1
001TRACE: Cloud socket=0, family=2, type=2, protocol=17
0011102497 [system] INFO: Cloud socket=0, connecting to 18.214.1
0011102505 [system] T

added couple more logs, same code, different hardware: particle ethernet featherwing with argon (connects immediately, both device os 3.1.0 and 5.4.1) and photon2 5.4.1 (does not connect)

and some more wireshark traces:

argon connecting immediately:

photon2 not connecting: