# Anyone got wired ethernet working?

**URL:** <https://community.particle.io/t/anyone-got-wired-ethernet-working/65081>\
**Category:** Device OS\
**Created:** [August 4, 2023, 9:02am UTC](https://community.particle.io/t/anyone-got-wired-ethernet-working/65081 "2023-08-04T09:02:58Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![boddeke](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/boddeke/32/28034_2.png) [@boddeke](https://community.particle.io/u/boddeke)\
**Post date:** [August 4, 2023, 9:02am UTC](https://community.particle.io/t/anyone-got-wired-ethernet-working/65081/1 "2023-08-04T09:02:58Z")

</div>

hello all

got anyone wired ethernet working reliably?

we got code (willing to share) based on this [library](https://docs.particle.io/reference/device-os/libraries/e/EthernetCellularRK/). 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](https://community.particle.io/t/some-issues-dns-wifi-not-disconnecting-with-reliable-ethernet-connection-with-wifi-fall-back/65066)

thanks  
frank

basic flow connecting to the cloud per wired ethernet:

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

    waitFor(Ethernet.ready, 30000);

    if (Ethernet.ready()) {

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

```

---

<div class="post-metadata">

**Author:** ![armor](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/armor/32/18398_2.png) [@armor](https://community.particle.io/u/armor)\
**Post date:** [August 5, 2023, 5:05pm UTC](https://community.particle.io/t/anyone-got-wired-ethernet-working/65081/2 "2023-08-05T17:05:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![boddeke](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/boddeke/32/28034_2.png) [@boddeke](https://community.particle.io/u/boddeke)\
**Post date:** [August 7, 2023, 7:55am UTC](https://community.particle.io/t/anyone-got-wired-ethernet-working/65081/3 "2023-08-07T07:55:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![boddeke](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/boddeke/32/28034_2.png) [@boddeke](https://community.particle.io/u/boddeke)\
**Post date:** [August 7, 2023, 7:58am UTC](https://community.particle.io/t/anyone-got-wired-ethernet-working/65081/4 "2023-08-07T07:58:11Z")

</div>

> [@armor](#):
>
> The Ethernet LAN connection is quick and reliable

this is Ethernet.ready()?

---

<div class="post-metadata">

**Author:** ![boddeke](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/boddeke/32/28034_2.png) [@boddeke](https://community.particle.io/u/boddeke)\
**Post date:** [August 7, 2023, 9:24pm UTC](https://community.particle.io/t/anyone-got-wired-ethernet-working/65081/5 "2023-08-07T21:24:38Z")

</div>

we tried different hardware (p2 kit + ethernet feather and our own), we tried the particle library ([EthernetCellularRK](https://docs.particle.io/reference/device-os/libraries/e/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

---

<div class="post-metadata">

**Author:** ![armor](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/armor/32/18398_2.png) [@armor](https://community.particle.io/u/armor)\
**Post date:** [August 8, 2023, 11:48am UTC](https://community.particle.io/t/anyone-got-wired-ethernet-working/65081/6 "2023-08-08T11:48:27Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![rickkas7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rickkas7/32/8681_2.png) [@rickkas7](https://community.particle.io/u/rickkas7)\
**Post date:** [August 8, 2023, 11:57am UTC](https://community.particle.io/t/anyone-got-wired-ethernet-working/65081/7 "2023-08-08T11:57:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![marekparticle](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/marekparticle/32/22793_2.png) [@marekparticle](https://community.particle.io/u/marekparticle)\
**Post date:** [August 8, 2023, 11:59am UTC](https://community.particle.io/t/anyone-got-wired-ethernet-working/65081/8 "2023-08-08T11:59:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![boddeke](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/boddeke/32/28034_2.png) [@boddeke](https://community.particle.io/u/boddeke)\
**Post date:** [August 8, 2023, 12:52pm UTC](https://community.particle.io/t/anyone-got-wired-ethernet-working/65081/9 "2023-08-08T12:52:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![marekparticle](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/marekparticle/32/22793_2.png) [@marekparticle](https://community.particle.io/u/marekparticle)\
**Post date:** [August 8, 2023, 1:49pm UTC](https://community.particle.io/t/anyone-got-wired-ethernet-working/65081/10 "2023-08-08T13:49:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![boddeke](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/boddeke/32/28034_2.png) [@boddeke](https://community.particle.io/u/boddeke)\
**Post date:** [August 8, 2023, 2:23pm UTC](https://community.particle.io/t/anyone-got-wired-ethernet-working/65081/11 "2023-08-08T14:23:25Z")

</div>

@marekparticle [here](https://github.com/edge-tech-eu/p2-eth-rk) 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!

---

<div class="post-metadata">

**Author:** ![rickkas7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rickkas7/32/8681_2.png) [@rickkas7](https://community.particle.io/u/rickkas7)\
**Post date:** [August 8, 2023, 2:36pm UTC](https://community.particle.io/t/anyone-got-wired-ethernet-working/65081/12 "2023-08-08T14:36:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![boddeke](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/boddeke/32/28034_2.png) [@boddeke](https://community.particle.io/u/boddeke)\
**Post date:** [August 8, 2023, 2:48pm UTC](https://community.particle.io/t/anyone-got-wired-ethernet-working/65081/13 "2023-08-08T14:48:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rickkas7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rickkas7/32/8681_2.png) [@rickkas7](https://community.particle.io/u/rickkas7)\
**Post date:** [August 8, 2023, 2:57pm UTC](https://community.particle.io/t/anyone-got-wired-ethernet-working/65081/14 "2023-08-08T14:57:23Z")

</div>

## 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:

```auto
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:

```auto
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.

```auto
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:

```auto
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.

```auto
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.

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

```

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

```auto
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.

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

```

I can't explain this behavior.

---

<div class="post-metadata">

**Author:** ![marekparticle](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/marekparticle/32/22793_2.png) [@marekparticle](https://community.particle.io/u/marekparticle)\
**Post date:** [August 8, 2023, 3:08pm UTC](https://community.particle.io/t/anyone-got-wired-ethernet-working/65081/15 "2023-08-08T15:08:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![boddeke](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/boddeke/32/28034_2.png) [@boddeke](https://community.particle.io/u/boddeke)\
**Post date:** [August 8, 2023, 3:24pm UTC](https://community.particle.io/t/anyone-got-wired-ethernet-working/65081/16 "2023-08-08T15:24:45Z")

</div>

these two are from the same events: [wireshark](https://github.com/edge-tech-eu/p2-eth-rk/tree/main/logs/desk-switch-wireshark.pcapng) and [logging](https://github.com/edge-tech-eu/p2-eth-rk/tree/main/logs/desk-switch-wireshark.txt)

---

<div class="post-metadata">

**Author:** ![eberseth](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/eberseth/32/25386_2.png) [@eberseth](https://community.particle.io/u/eberseth)\
**Post date:** [August 8, 2023, 5:12pm UTC](https://community.particle.io/t/anyone-got-wired-ethernet-working/65081/17 "2023-08-08T17:12:01Z")

</div>

We'll take a look shortly.

---

<div class="post-metadata">

**Author:** ![boddeke](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/boddeke/32/28034_2.png) [@boddeke](https://community.particle.io/u/boddeke)\
**Post date:** [August 8, 2023, 8:45pm UTC](https://community.particle.io/t/anyone-got-wired-ethernet-working/65081/18 "2023-08-08T20:45:42Z")

</div>

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

```auto
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

```

---

<div class="post-metadata">

**Author:** ![boddeke](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/boddeke/32/28034_2.png) [@boddeke](https://community.particle.io/u/boddeke)\
**Post date:** [August 9, 2023, 7:36am UTC](https://community.particle.io/t/anyone-got-wired-ethernet-working/65081/19 "2023-08-09T07:36:56Z")

</div>

added couple more logs, same code, different hardware: particle ethernet featherwing with argon (connects immediately, both device os [3.1.0](https://github.com/edge-tech-eu/p2-eth-rk/blob/main/logs/argon-3-1-0-connect-immediately.txt) and [5.4.1](https://github.com/edge-tech-eu/p2-eth-rk/blob/main/logs/argon-5-4-1-connect-immediately.txt)) and [photon2 5.4.1](https://github.com/edge-tech-eu/p2-eth-rk/blob/main/logs/photon2-5-4-1-not-connecting.txt) (does not connect)

---

<div class="post-metadata">

**Author:** ![boddeke](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/boddeke/32/28034_2.png) [@boddeke](https://community.particle.io/u/boddeke)\
**Post date:** [August 9, 2023, 10:39am UTC](https://community.particle.io/t/anyone-got-wired-ethernet-working/65081/20 "2023-08-09T10:39:40Z")

</div>

and some more wireshark traces:

argon connecting immediately:

- [wireshark](https://github.com/edge-tech-eu/p2-eth-rk/blob/main/logs/argon-5.4.1-compare.pcapng)
- [logging](https://github.com/edge-tech-eu/p2-eth-rk/blob/main/logs/argon-5.4.1-compare.txt)

photon2 not connecting:

- [wireshark](https://github.com/edge-tech-eu/p2-eth-rk/blob/main/logs/photon2-5.4.1-compare.pcapng)
- [logging](https://github.com/edge-tech-eu/p2-eth-rk/blob/main/logs/photon2-5.4.1-compare.txt)

[Next page](https://community.particle.io/t/anyone-got-wired-ethernet-working/65081.md?page=2)
