Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Ethernet connections, e.g. via MKR ETH shield #41

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aentinger
Copy link
Contributor

@aentinger aentinger commented Aug 31, 2020

Usage:

  • Uncomment this line.
  • Instantiate Ethernet_ConnectionHandler in thing_properties.h
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
EthernetConnectionHandler ArduinoIoTPreferredConnection(mac);
  • Pass to ArduinoIoTCloud (as usual)
ArduinoCloud.begin(ArduinoIoTPreferredConnection, "mqtts-sa.iot.oniudra.cc");

This should fix #40 .
@baqwas can you please test this one?

@aentinger aentinger added the type: enhancement Proposed improvement label Aug 31, 2020
@aentinger aentinger self-assigned this Aug 31, 2020
@github-actions
Copy link

Memory usage change @ 1bff3e3

Board flash RAM for global variables
arduino:samd:mkr1000 🔺 +24 - +24 🔺 +8 - +8
arduino:samd:mkrgsm1400 🔺 +24 - +24 🔺 +8 - +8
arduino:samd:mkrnb1500 🔺 +40 - +40 🔺 +24 - +24
arduino:samd:mkrwan1300 0 - 0 0 - 0
arduino:samd:mkrwan1310 0 - 0 0 - 0
arduino:samd:mkrwifi1010 🔺 +24 - +24 🔺 +8 - +8
arduino:samd:nano_33_iot 🔺 +28 - +28 🔺 +12 - +12
esp8266:esp8266:huzzah 0 - 0 0 - 0
Click for full report table
Board examples/ConnectionHandlerDemo
flash
examples/ConnectionHandlerDemo
RAM for global variables
arduino:samd:mkr1000 24 8
arduino:samd:mkrgsm1400 24 8
arduino:samd:mkrnb1500 40 24
arduino:samd:mkrwan1300 0 0
arduino:samd:mkrwan1310 0 0
arduino:samd:mkrwifi1010 24 8
arduino:samd:nano_33_iot 28 12
esp8266:esp8266:huzzah 0 0
Click for full report CSV
Board,examples/ConnectionHandlerDemo<br>flash,examples/ConnectionHandlerDemo<br>RAM for global variables
arduino:samd:mkr1000,24,8
arduino:samd:mkrgsm1400,24,8
arduino:samd:mkrnb1500,40,24
arduino:samd:mkrwan1300,0,0
arduino:samd:mkrwan1310,0,0
arduino:samd:mkrwifi1010,24,8
arduino:samd:nano_33_iot,28,12
esp8266:esp8266:huzzah,0,0

@baqwas
Copy link

baqwas commented Sep 17, 2020

Appreciate your prompt support. Thx for closing it.

Kind regards.

Copy link
Collaborator

@ubidefeo ubidefeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to manually uncomment Arduino_ConnectionHandler:116 in order to get it to compile.
My concern is that there is no ECCx08 on, for instance, MKR Zero, which means you'd have to still use the shield on a Crypto-enabled board.
I am testing with a MKR1000 and it has successfully connected to IoT Cloud, but of course because of Arduino_ConnectionHandler:21 we still get the headers pulled in and compiled and a few defines set

#ifdef ARDUINO_SAMD_MKR1000
  #include <WiFi101.h>
  #include <WiFiUdp.h>

  #define BOARD_HAS_WIFI
  #define NETWORK_HARDWARE_ERROR WL_NO_SHIELD
  #define NETWORK_IDLE_STATUS WL_IDLE_STATUS
  #define NETWORK_CONNECTED WL_CONNECTED
  #define WIFI_FIRMWARE_VERSION_REQUIRED WIFI_FIRMWARE_REQUIRED
#endif

Is there a way to get these sorted based on which type of connection is set?
If Ethernet is chosen, all the WiFi stuff should be left behind.

@baqwas
Copy link

baqwas commented Nov 4, 2020

Hello @ubidefeo,

I would like to "second" your suggestion.

On a separate matter but perhaps related to the Ethernet library, I have another anomaly with the library that I cannot "document" properly (or rather capture precisely). My code halts after 23+ hours of operation when using the library for two different applications on MKR1000 and the humble UNO (R3) board. I have isolated the issue to the Ethernet library (perhaps WizNET hardware related?) but I will try to replicate the issue with the ETH Rev 2 shield (on order now for the UNO board) before logging it as such. (I understand the need for a completely separate thread for this purpose; I explicitly disable the SD card on the MKR ETH shield as it is necessary but it does not alleviate the issue). Thanks.

Kind regards.

@aentinger
Copy link
Contributor Author

Hi @ubidefeo 👋
It (that is sorting out all defines in such way that no WiFi/GSM/NB code is pulled in) can be done for sure. However, looking at the MKR ZERO schematic I find that it has in fact a crypto chip so I'm not sure from where your problems were coming from.

Using Ethernet shield with any connected board makes no sense to me anyway, since you'll be paying for "connectivity hardware" (GSM/UMTS modems, WiFi, LoRa chips) that you'll not be using anyway.

@baqwas As much as I appreciate your current resurfacing I'm left to wonder where you've been since I asked you to try that feature on 31/8/2020?

@ubidefeo
Copy link
Collaborator

ubidefeo commented Nov 4, 2020

@aentinger you are right, the crypto is there...
to be honest I did not try to compile for the MKR ZERO because I assumed it did not have one.
The case comes from a user's request in the forum. She has a WiFi 1010 but for one instance of her project the board has to run in a location with only wired connections, and since she had a MKR Ethernet she'd just use the shield on the WiFi1010.
Of course not using the hardware doesn't make much sense, but if that's what you have ;)
I'm gonna just get ahold of a MKR Zero and run another test :)

As much as I appreciate your current resurfacing I'm left to wonder where you've been since I asked you to try that feature on 31/8/2020?
LOL... Alex, I have missed several GH notifications over the past few months, and it could very well have happened to @baqwas 😁

@aentinger
Copy link
Contributor Author

aentinger commented Nov 4, 2020

LOL... Alex, I have missed several GH notifications over the past few months, and it could very well have happened to @baqwas 😁

Sure, but he came around requesting that feature so I assume there must have been some level of interest. Regardless, I'd support Ethernet Shield ONLY on MKR ZERO, as it simply makes no sense for the other boards.

EDIT And it's not possible on MKR ZERO because although there's a crypto on the schematic there's no crypto mounted on the sold boards.

@baqwas
Copy link

baqwas commented Nov 4, 2020

Hello @aentinger,

You had promptly attended to my request a few months ago. I remain indebted to you for that assistance since it helped me to make some progress. I no longer have that specific issue. You also explained your go-forward plan. I am perfectly fine with that.

The issue that I am experiencing needs to be documented and captured a little more professionally on MY part. Until then, I will continue to perform my workaround on a daily scheduled basis. Sorry for not making myself a little more clear (English is not my primary spoken language). Thanks again.

Kind regards.

@aentinger
Copy link
Contributor Author

Hi @baqwas 👋 ☕ Thanks for getting back. So what you are saying is that you are using Arduino IoT Cloud with a MKR ETH Ethernet shield? What board do you use?

@per1234
Copy link
Contributor

per1234 commented Nov 5, 2020

you'd have to still use the shield on a Crypto-enabled board.

What about people supplying their own crypto chip? Low priced ATECC508 modules are readily available and even working with a bare chip is very doable considering the availability in a SOIC package (and yes, I know the footprint on the MKR Zero is not SOIC, I'm talking about connecting an external module).

@aentinger
Copy link
Contributor Author

Doable. A simpler solution would be to just to solder the chip where it would be placed on the MKR ZERO board. Still I don't think we should entertain such hacky solutions, I rather prefer a clean one.

@ubidefeo
Copy link
Collaborator

ubidefeo commented Nov 5, 2020

@aentinger
I can solder such small footprint components, but most can't.
ECC508 modules are available for RPi as small breakouts, so users will just need to know.
Of course the absence of a crypto-chip triggers an error in IoT Cloud so it should be a non-issue 👍

@baqwas
Copy link

baqwas commented Nov 5, 2020

Hi @baqwas wave coffee Thanks for getting back. So what you are saying is that you are using Arduino IoT Cloud with a MKR ETH Ethernet shield? What board do you use?

Hello @aentinger,

The specific response to your question is that I am trying out the tutorial exercises with MKR1000. I have to use only ETH interfaces in my current infrastructure owing unrelated constraints at my end regarding WiFi.

My current stack consists of MKR1000, MKR ETH and MKR IoT with SD card slots for the latter two kept empty. (The MKR GPS and the "mother ship" is on back-order :))

Kind regards.

Copy link

@gannaramu gannaramu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing BOARD_HAS_ETHERNET condition on line 179

@gannaramu
Copy link

I would appreciate it if someone can look at PR #70 @per1234 @ubidefeo @aentinger

@per1234 per1234 added the topic: code Related to content of the project itself label May 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for MKR ETH Shield
5 participants