Can the built in particle classes be used to establish an ethernet connection on a muon board? I've seen conflicting evidence (at least to me) in different places. I’m using wiznet w5500 and the library NCD_Ethernet_Overlay. I was trying to port over code from my electron board to the muon but there is now a ton of naming collisions with the spark ethernet library, even prefixing them with their namespace didn’t fix the fact that it wouldn’t compile. A little lost in all of this. If there is a easy base implementation for ethernet connections using the built in OS somewhere that would be great for a start on how to tackle this. I also looked on the particle library search for another possible library but it looked to me that all of them did not support msom.
Don't try to use that library with any Gen 3 device that has built-in Ethernet support. There's built-in Ethernet support using the Ethernet class and things like UDP, TCPServer, and TCPClient will use Ethernet if that's your primary connection.
It's also possible to use the Ethernet for local access with cloud using cellular; that's a little harder to set up but also possible.
Got the ethernet connection working, the device will run and be able to commuincate over ethernet for a bit. After some time it switches to spewing this forever until i restart it again
0002170035 [comm] INFO: Forcing a cloud ping
0002170522 [net.en] INFO: Link up
0002170523 [net.ifapi] INFO: Netif en2 link UP, profile=NONE
0002171083 [net.ifapi] INFO: Netif en2 link DOWN, profile=NONE
0002171085 [hal] INFO: DNS server list changed
0002171087 [hal] INFO: DNS server list changed
0002171093 [net.en] INFO: Link up
0002171094 [net.ifapi] INFO: Netif en2 link UP, profile=NONE
0002171290 [net.ifapi] INFO: Netif en2 link DOWN, profile=NONE
0002171291 [hal] INFO: DNS server list changed
0002171293 [hal] INFO: DNS server list changed
0002171797 [net.en] INFO: Link up
0002171798 [net.ifapi] INFO: Netif en2 link UP, profile=NONE
0002172007 [net.ifapi] INFO: Netif en2 link DOWN, profile=NONE
0002172008 [hal] INFO: DNS server list changed
0002172009 [hal] INFO: DNS server list changed
0002172515 [net.en] INFO: Link up
0002172516 [net.ifapi] INFO: Netif en2 link UP, profile=NONE
0002172708 [net.ifapi] INFO: Netif en2 link DOWN, profile=NONE
0002172710 [hal] INFO: DNS server list changed
0002172711 [hal] INFO: DNS server list changed
Here is the message upon boot up if it helps diagnose
[mux] INFO: Opening mux channel 0
0000003035 [mux] INFO: GSM07.10 muxer thread started
0000003045 [mux] INFO: Opening mux channel 1
0000003100 [mux] INFO: Mux channel 1 already opened
0000003128 [mux] INFO: Opening mux channel 2
0000003296 [hal] INFO: WiFi off
0000003297 [ncp.rltk.client] INFO: rltkOff done
0000003308 [hal] INFO: rltk_wlan_set_netif_info: 0, 94:94:4a:07:15:58
0000003440 [hal] INFO: WiFi on
0000004080 [net.en] INFO: Link up
0000004081 [net.ifapi] INFO: Netif en2 link UP, profile=NONE
0000004085 [system.nm] INFO: State changed: IFACE_UP -> IFACE_LINK_UP
0000004303 [net.ifapi] INFO: Netif pp3 link UP, profile=NONE
0000004307 [hal] INFO: DNS server list changed
0000004308 [system.nm] INFO: State changed: IFACE_LINK_UP -> IP_CONFIGURED
0000004309 [hal] INFO: DNS server list changed
0000004397 [system] INFO: Cloud: connecting
0000004419 [system] INFO: Read Server Address = type:1,domain:$``id.udp.particle.io
0000004459 [system] WARN: Failed to load session data from persistent storage
0000004504 [system] INFO: Discarding session data
0000005315 [system] INFO: Cloud socket=0, connecting to 18.214.12.187#5684 using if 3
0000005362 [system] INFO: Bound cloud socket to lwip if 3 ("en2")
0000005392 [system] INFO: Cloud socket connected
0000005414 [system] INFO: Starting handshake: presense_announce=0
0000005443 [comm.protocol.handshake] INFO: Establish secure connection
0000005476 [comm.dtls] INFO: (CMPL,RENEG,NO_SESS,ERR) restoreStatus=2
0000007250 [ncp.rltk.client] INFO: Try to connect to ssid: CechItOut (06:ec:da:fb:a0:78)
0000011876 [net.ifapi] INFO: Netif wl4 link UP, profile=CechItOut
0000011902 [hal] INFO: DNS server list changed
0000011905 [hal] INFO: DNS server list changed
0000049731 [comm.dtls] ERROR: handshake failed -6800
0000049773 [comm.dtls] ERROR: Invalid handshake state
0000049796 [comm.protocol.handshake] ERROR: Handshake failed: 17
0000055533 [system.cm] INFO: Ethernet: 0/10 packets (0 tx errors) 0/2619 bytes received, avg rtt: 0, mask=0000, score=4294967295
0000055591 [system.cm] INFO: WiFi: 10/10 packets (0 tx errors) 2656/2786 bytes received, avg rtt: 74, mask=03ff, score=74
0000055648 [system.cm] INFO: Cellular: 8/10 packets (0 tx errors) 2091/2718 bytes received, avg rtt: 239, mask=00ff, score=418
0000055703 [system] WARN: Internet available, cloud not reachable
0000055735 [system] WARN: Cloud handshake failed, code=-220
0000056009 [system] INFO: Cloud: disconnecting
0000056030 [system] INFO: Cloud: disconnected
0000056052 [system] INFO: Cloud: connecting
0000056073 [system] INFO: Read Server Address = type:1,domain:$``id.udp.particle.io
0000056108 [system] WARN: Failed to load session data from persistent storage
0000056142 [system] INFO: Discarding session data
0000056702 [system] INFO: Cloud socket=0, connecting to 18.214.12.187#5684 using if 5
0000056741 [system] INFO: Bound cloud socket to lwip if 5 ("wl4")
0000056773 [system] INFO: Cloud socket connected
0000056798 [system] INFO: Starting handshake: presense_announce=0
0000056829 [comm.protocol.handshake] INFO: Establish secure connection
0000056869 [comm.dtls] INFO: (CMPL,RENEG,NO_SESS,ERR) restoreStatus=2
0000059597 [comm.protocol.handshake] INFO: Sending HELLO message
0000059696 [comm.protocol.handshake] INFO: Handshake completed
0000059727 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 4
0000059757 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 3
0000060850 [comm] INFO: Sending TIME request
0000060873 [system] INFO: Send spark/device/last_reset event
0000060913 [system] INFO: Sending application DESCRIBE
0000060942 [system] INFO: Sending subscriptions
0000060965 [comm.protocol] INFO: Sending subscriptions
0000060996 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 4
0000062110 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 3
0000062143 [comm.protocol] INFO: Received TIME response: 1758309050
0000062181 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 4
0000062210 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 3
0000062242 [system] INFO: All handshake messages have been processed
0000062273 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 4
0000062302 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 3
0000062332 [comm.protocol] INFO: Received DESCRIBE request; flags: 0x04
0000062399 [system] INFO: Cloud connected
0000062430 [comm] INFO: Sending TIME request
0000062483 [comm.protocol] INFO: Received TIME response: 1758309051
That's typically caused by your router deleting the UDP packet forwarding for the device so packets can no longer be sent from the cloud to the device.
The first step is to try Particle.keepAlive(30); to see if that works. You can call that once in setup() so the device will send a packet to the cloud every 30 seconds so the packet forwarding is not deleted. You may be able to set the limit higher. You should avoid doing this when on cellular, because it will use a lot of cellular data.
We have cellular on the chip, maybe i have this confused. Am I telling the device to default to ethernet signal for connectivity with these lines of code?
System.enableFeature(FEATURE_ETHERNET_DETECTION)
if(Ethernet.isOff())
{
Ethernet.on();
}
I have this in my setup function. All i want to do is use ethernet to communicate with an outside monitoring device. Do i just need tcpclient for that? Am i making it use ethernet communication instead? and if so what did I do that made it do that. I might have extra bits in my ethernet comm class that are changing it to this
Oh, that's a different scenario. You need to configure the Ethernet port as an isolated LAN and use TCPClient to connect to the devices on that LAN. The Particle device will use cellular for the cloud connection.
Alright i think i have it solely using cellular to make its connections. Will update again if that doesn’t fix the issue. The start up logs looks more familiar to what I remember seeing on the electron so hoping that was it
My main issue was not using the 0,0,0,0 ip in my IP config for the gate way
Ethernet.setConfig(NetworkInterfaceConfig()
.source(NetworkInterfaceConfigSource::STATIC)
.address(sharedLocalIP, subnet)
.gateway(IPAddress(0, 0, 0, 0))); // 0s make it be local LAN
this seems to have fixed my issue
Thanks for the help @rickkas7
I thought that solved it but it still seems to get stuck in an unconnected state sometimes after a long time. Not sure what could be the case now, following the information at the link above I think I've verified that the cloud connection is using cellular. So im not sure what else would cause it to get stuck like this, restarting always makes it work again for a period of time till it gets stuck again