Azure / azure-iot-sdk-c

A C99 SDK for connecting devices to Microsoft Azure IoT services
https://azure.github.io/azure-iot-sdk-c
Other
587 stars 739 forks source link

Getting ESP32 talking through Ethernet on SPI rather than WiFi for all comms #2524

Closed codehampster closed 1 year ago

codehampster commented 1 year ago

This is one request that I am struggling to find much material on and it is a bit of a niche case.

I have ESP32 that connects to IoT Central via WiFi using Azure SDK for C. All that is working fine. However, I have a circumstance where there is so much RF interference that the only reliable connection is Ethernet. I have connected W5500 via SPI and have that working (DHCP,…test site request [explicitly coded commands] etc.). However, if I try to use that interface for any other comm (like with wifi…simply connect and go)…nothing goes through.

So what I am after is:

Has anyone done such scenario where ALL traffic is redirected to Ethernet and how to go about it? If not, what would be the best way to go about it/ideas/approaches/considerations? Can you point me to implementations/code/what do do here or how to code this? For reference…ESP32 Wrover-IE, PlatformIO and Arduino.

Many thanks for your time/help/suggestions/consideration!!

CIPop commented 1 year ago

using Azure SDK for C

Is this the correct repository then? The Azure SDK for Embedded C is at https://github.com/Azure/azure-sdk-for-c We don't recommend using the code within this repo for ESP32 or other constrained devices.

Has anyone done such scenario where ALL traffic is redirected to Ethernet and how to go about it?

We ethernet samples but, unfortunately, not with ESP.

  1. Using Azure RTOS ThreadX: https://github.com/azure-rtos/samples/ (using NXSecure's TLS and TCP/IP stack)
  2. Using FreeRTOS : https://github.com/Azure-Samples/iot-middleware-freertos-samples (using mBedTLS for TLS and LwIP for the TCP/IP stack)

In both cases, the NXP RT1060 or Renesas CK-RX64N use Ethernet using the NXSecure layer and drivers.

Similarly, for ESP you would need to use ESP32-IDF in conjunction with W5500 (looks like there is an example here).

It would be important to ensure the integration works with higher layer network stack components such as ESP-TLS and ESP-MQTT. If all that works as expected, you could start from one of our Arduino samples: https://github.com/Azure/azure-sdk-for-c-arduino

codehampster commented 1 year ago

Many thanks. Really appreciate your help. Great place to start