Ethernet connection lost on Argon flash

Hello internet friends :nerd_face:
Quick summery.
Particle argon + Adafruit Feathering (cut 1 trace on the PCB and wired all 3 pins as per documentation). Setup argon using ios app, selected ethernat and it connected, I claimed it and i started programming no issue at all. Prototyped for 2 weeks, no problem, 100% functional and overwhelmingly happy with the paricle web IDE + flashing process(used to serial programming Arduino pro minis :crazy_face:). Finished the prototype and installed it in a metal bin miles away from any other device via a long range line of sight network extender (Ethernet only due to the solid metal bin it is in.). while trying to change a couple last minute settings after install i added a significant delay after a particle.publish to troubleshoot a weird sensor error and this killed my ability to flash core remotely. I drove down the road and climbed into the bin to put the particle in safe mode so that i could send fresh code. But it seems to have defaulted into wifi and went to flashing blue instead of staying on breathing magenta. I opened up my app on ios and told it to go back to ethernet, and it worked. but now everytime i flash code it defaults to wifi and disconnects from the cloud. in my remote install application, this means 2 miles of driving each way to flash fresh code. AAAAAAAARRRRGGGG!!!

I have read in the argon docs a way to enable ethernet detection from code “STARTUP(System.enableFeature(FEATURE_ETHERNET_DETECTION));” but it does not state in the documentation where this needs to be placed in the code.

I am by no means an expert coder and perhaps i am missing something obvious, but i have now spent real money on gas driving back and forth :crazy_face: and I need some help.

Thanks in advance :smiley:

Cheers
Lucas

Welcome to the community!

Not explicitly for FEATURE_ETHERNET_DETECTION but for STARTUP()
https://docs.particle.io/reference/device-os/firmware/argon/#startup-

To save yourselves some trouble you may want to do a few things

  • add some WiFi credentials to prevent the device from falling into Listening Mode (blinking blue)
  • use the credentials of a WiFi AP that you will have on you when visiting the site (e.g. your mobile phone hotspot)
  • don’t use delay() as it will impact cloud responsiveness considerably
  • consider using SYSTEM_THREAD(ENABLED)
  • when you need to add some delays opt for an FSM approach or at least this
  for(uint32_t ms = millis(); millis() - ms < YOUR_DELAY_TIME; Particle.process());

(this ensures that the cloud task will be serviced at maximum speed while waiting)

Thanks @ScruffR for the reply, unfortunately I’m still not certain where to go from here. I operated this Argon for weeks without ever connecting to wifi. If i add some wifi credentials and it fils to connect to wifi will this somehow allow it to connect to ethernet? is there no way to force the device to rely on an ethernet connection as it did before I placed it in safemode? If “STARTUP(System.enableFeature(FEATURE_ETHERNET_DETECTION));” isnt doing this, what is it doing?

thanks again
Cheers
Lucas

STARTUP(System.enableFeature(FEATURE_ETHERNET_DETECTION)) only tells the device to search for an Ethernet interface and use it when found, but if it cannot - for whatever reason - it will fall back to its default radio.

Could it be that the detection line has a funky connection?

The Argon has a direct ethernet connection to a line of sight 900mb wireless extender that tests perfectly with <15ms ping to the main yard and ~40ms through ISP tested via speedtest.net. Up until I uploaded the bad code and had to enable safe mode it functioned flawlessly, it very much seems to me to be a issue with the argon. but I’m out of ideas to diagnose.

Is there any possible benefit to going through the new device setup via IOS and try to set it up as a new device. (from my reading it seems that there isn’t really a “return to default” mode, so would this do anything to help me?)

For my application, once I leave the site I will be 500km away. So onsite resets really aren’t an option for me. I need to find a way to get everything working reliably on Ethernet :expressionless:.

I currently have STARTUP(System.enableFeature(FEATURE_ETHERNET_DETECTION)) on the first line of my code before libraries and setup and as soon as I flash the argon drops off the network (offline). then I drive down there, climb into the bin and its flashing blue again. Open up the ios app, select the offline argon, select the settings icon (gear in top right) select ethernet. It connects almost instantly and it automatically enables Ethernet without me selecting anything. Then it works perfectly until i flash again.

image

Hello again @ScruffR I just reread your response and did a bit of digging. I will bring a DMM with me the next time I go down to the bin and test connectivity between the featherwing and D3-nRESET, D4-nINTERRUPT and, D5-nCHIP SELECT to be sure it’s not a wiring issue or flacky connection. I will also bring my Ethernet tester and check the ethernet cable and pins. although as ethernet functions perfectly once I open the ios app. I do doubt it is a funky wiring connection. But I will do my due diligence and report back :slight_smile:

1 Like

Hey @ScruffR Thanks so much for your response on this, I have it working now and I’d like to share my results so future “Etherneters” don’t need to experience my struggle.

Wiring and everything was fine, it definitely looks like an issue created by safe mode.

The solution.
-put the Argon in Listening mode if the LED isn’t already flashing blue (which it was in my case. After every restart or flash the system would not attempt an ethernet connection and instead go to listening mode)
-use the app to add a new device(NOTE: Do not delete the old one or unclaim it, just leave the old one and add it again, it will override the old one at the end automatically)
-scan the QR code on the particle and select Ethernet.
-finish the setup by entering a new name (the same name might work, but in my testing i chose to give it a new name to ensure I was using a new configuration)
-login to the particle IDE and flash your same old code(ensuring you’re not using excessive "delay();"s or anything else that could kill your connection to the cloud).
-now on new flashes and restarts the system will automatically connect via ethernet.

NOTE: before setting up a new device I tried to force ethernet detection via STARTUP(System.enableFeature(FEATURE_ETHERNET_DETECTION)) in my code. THIS DID NOT WORK FOR ME. I removed it before flashing my code again after setting up the new device and it worked perfectly, I have preformed many flashes and restarts since and it is working perfectly.

NOTE: This issue was originally caused by my use of excessive delays (as a form of troubleshooting as I am used to doing with serial connections on Arduino). These delays stopped me from being able to flash remotely and putting the device in safe mode started my loop into despair.

Conclusion: IF YOU NEED ETHERNET ONLY FUNCTIONALITY, I WOULD STRONGLY RECOMMEND AVOIDING THE “SAFE MODE”.

but

If you do find yourself in a situation where restarts and flashes are killing your cloud connection, just copy your code somewhere safe, set up the argon as a new Ethernet device, flash your code once more (avoiding “delay();” if possible) and have a wonderful day :smiley:

Cheers
Lucas

1 Like