Closed ZinnerC closed 1 year ago
I'm kind of confused with your example code.
I think you're mixing the native LWIPEthernet
stuff and the Arduino-separate Ethernet
, and this core's native ArduinoOTA vs the generic multi-board ArduinoOTA. That's never going to work, you'll need to pick one or the other set to use.
See the W5100 example and the docs for info on how to use the integrated LWIP code.
Thank you for your response.
@JAndrassy Well probably I was not precise enough. I ment the example from the RP2040 board core (see screenshot)
@earlephilhower Thanky you for the hint. I just took for "BasicOTA_Ethernet.ino" the BasicOTA from the examples from ArduinoOTA from within RP2040 board core (see screenshot).
I will check out how I can use the mentioned example as a starting point. How can I "force" to use the core's native ArduinoOTA? Does it have an other name?
Based on this information I for sure can find a solution. Sadly not in the coming week. Will keep this thread informed when I succeeded. Might help one or the other at a later point.
@earlephilhower Thanky you for the hint. I just took for "BasicOTA_Ethernet.ino" the BasicOTA from the examples from ArduinoOTA from within RP2040 board core (see screenshot).
That's the problem, you're using Ethernet
which does not actually run IP on the Pico and is incompatible with the ArduinoOTA in this core. See the example I listed before, where it includes W5100lwIP.h
and instantiates its own object in the sketch to enable the core's built-in wired Ethernet support.
Alternatively, you should be able to use the Arduino Ethernet
and the generic ArduinoOTA
, but I can't really help you there. You should open something on their repos with questions related to it.
Closing as this is just a mixing of the core LWIP wired Ethernet and the Arduino Ethernet
library.
I might need some help.
I try to implement OTA for a project of mine. The server and all the Ethernet stuff is working. But if I start to add ArduinoOTA (based on example/BasicOTA), my setup() hangs at ArduinoOTA.begin() and I don't know why.
I tried example/BasicOTA and only removed Wifi stuff and included Ethernet but I always get "IP unset".
Could somebody point me in the right direction.
The codes I use are the following:
working server with OTA added first and second code sections. With this code every thing is fine as long as ArduinoOTA.begin is commented. As soon I uncomment this line the code hangs there.
BasicOTA_rp2040.ino
```c++ /**************************************************************************************************************************** PostServer.h - Dead simple web-server for Ethernet shields EthernetWebServer is a library for the Ethernet shields to run WebServer Based on and modified from ESP8266 https://github.com/esp8266/Arduino/releases Built by Khoi Hoang https://github.com/khoih-prog/EthernetWebServer Licensed under MIT license *****************************************************************************************************************************/ /* The Arduino board communicates with the shield using the SPI bus. This is on digital pins 11, 12, and 13 on the Uno and pins 50, 51, and 52 on the Mega. On both boards, pin 10 is used as SS. On the Mega, the hardware SS pin, 53, is not used to select the Ethernet controller chip, but it must be kept as an output or the SPI interface won't work. */ #include "defines.h" #include "Wire.h" #include "jled.h" #include "ArduinoJson.h" #include "ArduinoOTA.h" #define DEBUG true #if DEBUG #define debug(x) Serial.print(x) #define debugF(x,y) Serial.print(x,y) #define debugln(x) Serial.println(x) #define debugFln(x,y) Serial.println(x,y) #else #define debug(x) #define debugF(x,y) #define debugln(x) #define debugFln(x,y) #endif #define ETHERNET_DHCP true #define PROXY 1 #define PROXY_FIRMWARE 0.25 // DONT MODIFY BELOW HERE /* CLIENT VARIABLES BELOW */ /*------------------------*/ // I2C Client Status Definitions #define STATUS_LAST_COMMAND_SUCCESS 1 #define STATUS_LAST_COMMAND_KNOWN 2 #define STATUS_COMMAND_PROCESSING 3 EthernetWebServer server(80); // time [ms] when IP leasetime last has been checked uint32_t EthernetLeaseCheck = 0; // interval [ms] for maintaining the IP leasetime static const uint16_t EthernetLeaseInterval = 1000; // time [ms] when last REST request has been handled uint32_t RequestTimeHandled = 0; // interval [ms] which is allowed between REST requests static const uint16_t RequestInterval = 500; // Ethernet DHCP state: // 0: nothing happened // 1: renew failed // 2: renew success // 3: rebind fail // 4: rebind success byte Ethernet_DHCPState = 3; uint32_t wdt_ms = 1000; // watchdog delay_ms at 1000ms const static uint8_t onBoardLedPin = 25; const static uint8_t powerLedPin = 15; const static uint8_t statusLedPin = 14; jled::JLed onBoardJLed = JLed(onBoardLedPin).Off(); jled::JLed powerJLed = JLed(powerLedPin).Off(); jled::JLed statusJLed = JLed(statusLedPin).Off(); void handleRoot(); void handleReboot(); void handleNotFound(); void setup() { SerialDebug_W5100S.begin(115200); onBoardJLed.Blink(100,100).Forever(); uint32_t serialWait = 5*1000; uint32_t setupTime = millis(); // while (!SerialDebug_W5100S) while ( !SerialDebug_W5100S && millis() < (setupTime + serialWait) ) { onBoardJLed.Update(); powerJLed.Update(); statusJLed.Update(); } delay(500); // shortly wait to allow SerialDebug_W5100S to print SerialDebug_W5100S.print("\nStarting POSTServer on "); SerialDebug_W5100S.print(BOARD_NAME); SerialDebug_W5100S.print(F(" with ")); SerialDebug_W5100S.println(SHIELD_TYPE); SerialDebug_W5100S.println(ETHERNET_WEBSERVER_VERSION); ET_LOGWARN(F("=========== USE_ETHERNET_GENERIC ===========")); ET_LOGWARN(F("Default SPI pinout:")); ET_LOGWARN1(F("MOSI:"), MOSI); ET_LOGWARN1(F("MISO:"), MISO); ET_LOGWARN1(F("SCK:"), SCK); ET_LOGWARN1(F("SS:"), SS); ET_LOGWARN(F("=========================")); pinMode(USE_THIS_SS_PIN, OUTPUT); digitalWrite(USE_THIS_SS_PIN, HIGH); ET_LOGWARN1(F("RPIPICO setCsPin:"), USE_THIS_SS_PIN); Ethernet.init(USE_THIS_SS_PIN); // start the ethernet connection and the server: // Use DHCP dynamic IP and random mac // uint16_t index = millis() % NUMBER_OF_MAC; uint16_t index = PROXY; #if ETHERNET_DHCP // Use DHCP for IP Ethernet.begin(mac[index]); #else // Use Static IP Ethernet.begin(mac[index],ip); #endif EthernetLeaseCheck = millis(); SerialDebug_W5100S.print(F("Using mac index = ")); SerialDebug_W5100S.println(index); SerialDebug_W5100S.print(F("Connected! IP address: ")); SerialDebug_W5100S.println(Ethernet.localIP()); /*------------------------------*/ /* SERVER specifications BELOW */ server.on(F("/"), handleRoot); server.on(F("/reboot"), handleReboot); server.onNotFound(handleNotFound); server.begin(); SerialDebug_W5100S.print(F("HTTP POSTServer started @ IP : ")); SerialDebug_W5100S.println(Ethernet.localIP()); /* SERVER specifications ABOVE */ /*------------------------------*/ SerialDebug_W5100S.println("ArduinoOTA.onStart()"); ArduinoOTA.onStart([]() { String type; if (ArduinoOTA.getCommand() == U_FLASH) { type = "sketch"; } else { // U_FS type = "filesystem"; } // NOTE: if updating FS this would be the place to unmount FS using FS.end() Serial.println("Start updating " + type); }); SerialDebug_W5100S.println("ArduinoOTA.onEnd()"); ArduinoOTA.onEnd([]() { Serial.println("\nEnd"); }); SerialDebug_W5100S.println("ArduinoOTA.onProgress()"); ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) { Serial.printf("Progress: %u%%\r", (progress / (total / 100))); }); SerialDebug_W5100S.println("ArduinoOTA.onError()"); ArduinoOTA.onError([](ota_error_t error) { Serial.printf("Error[%u]: ", error); if (error == OTA_AUTH_ERROR) { Serial.println("Auth Failed"); } else if (error == OTA_BEGIN_ERROR) { Serial.println("Begin Failed"); } else if (error == OTA_CONNECT_ERROR) { Serial.println("Connect Failed"); } else if (error == OTA_RECEIVE_ERROR) { Serial.println("Receive Failed"); } else if (error == OTA_END_ERROR) { Serial.println("End Failed"); } }); SerialDebug_W5100S.println("ArduinoOTA.begin()"); // ArduinoOTA.begin(Ethernet.localIP()); // ArduinoOTA.begin(); onBoardJLed.Breathe(1000).Forever(); SerialDebug_W5100S.println("SETUP END"); } void loop() { ArduinoOTA.handle(); onBoardJLed.Update(); powerJLed.Update(); statusJLed.Update(); // Triggers a lease check with the interval of EthernetLeaseInterval if( millis() > (EthernetLeaseCheck + EthernetLeaseInterval ) ) { EthernetLeaseCheck = millis(); Ethernet_DHCPState = Ethernet.maintain(); } server.handleClient(); } /*--------------------------*/ /* ENDPOINT FUNCTIONS BELOW */ void handleRoot() { String message; StaticJsonDocument<1024> docJson; onBoardJLed.Blink(100,100).Repeat(2); if (server.method() == HTTP_GET) { onBoardJLed.Blink(100,100).Repeat(2); docJson["DHCP"] = Ethernet_DHCPState; docJson["Firmware"] = serialized(String(PROXY_FIRMWARE,2)); uint32_t milliseconds = millis(); uint32_t seconds = milliseconds / 1000; uint32_t minutes = seconds / 60; uint32_t hours = minutes / 60; uint32_t days = hours / 24; milliseconds %= 1000; seconds %= 60; minutes %= 60; hours %= 24; docJson["Uptime"]["Days"] = days; docJson["Uptime"]["Hours"] = hours; docJson["Uptime"]["Minutes"] = minutes; docJson["Uptime"]["Seconds"] = seconds; docJson["Uptime"]["Milliseconds"] = milliseconds; serializeJson(docJson, message); server.send(200, F("application/json"), message); } else { onBoardJLed.Blink(100,100).Repeat(3); docJson["error"] = "Method not allowed"; serializeJson(docJson, message); server.send(405, F("application/json"), message); } } void handleReboot() { String message; StaticJsonDocument<1024> docJson; onBoardJLed.Blink(100,100).Repeat(2); if (server.method() == HTTP_POST) { onBoardJLed.Blink(100,100).Repeat(2); docJson["REBOOT"] = 1; serializeJson(docJson, message); server.send(200, F("application/json"), message); rp2040.reboot(); } else { onBoardJLed.Blink(100,100).Repeat(3); docJson["error"] = "Method not allowed"; serializeJson(docJson, message); server.send(405, F("application/json"), message); } } void handleNotFound() { server.send(404, F("text/plain"), "error_page"); } ```defines.h
```c++ /**************************************************************************************************************************** defines.h EthernetWebServer is a library for the Ethernet shields to run WebServer Based on and modified from ESP8266 https://github.com/esp8266/Arduino/releases Built by Khoi Hoang https://github.com/khoih-prog/EthernetWebServer Licensed under MIT license ***************************************************************************************************************************************/ #ifndef defines_h #define defines_h #if defined(__AVR_AVR128DA48__) #define SerialDebug_W5100S Serial1 #elif defined(__AVR_AVR128DB48__) #define SerialDebug_W5100S Serial3 #else // standard Serial #define SerialDebug_W5100S Serial #endif #define DEBUG_ETHERNET_GENERIC_PORT SerialDebug_W5100S #define DEBUG_ETHERNET_WEBSERVER_PORT SerialDebug_W5100S // Debug Level from 0 to 4 #define _ETG_LOGLEVEL_ 2 #define _ETHERNET_WEBSERVER_LOGLEVEL_ 1 #define USING_SPI2 false //true #if ( defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M4) ) #if defined(BOARD_NAME) #undef BOARD_NAME #endif #if defined(CORE_CM7) #if (_ETHERNET_WEBSERVER_LOGLEVEL_ > 3) #warning Using Portenta H7 M7 core #endif #define BOARD_NAME "PORTENTA_H7_M7" #else #if (_ETHERNET_WEBSERVER_LOGLEVEL_ > 3) #warning Using Portenta H7 M4 core #endif #define BOARD_NAME "PORTENTA_H7_M4" #endif #define ETHERNET_USE_PORTENTA_H7 true #define USE_ETHERNET_PORTENTA_H7 true #endif #if ( defined(ARDUINO_SAMD_ZERO) || defined(ARDUINO_SAMD_MKR1000) || defined(ARDUINO_SAMD_MKRWIFI1010) \ || defined(ARDUINO_SAMD_NANO_33_IOT) || defined(ARDUINO_SAMD_MKRFox1200) || defined(ARDUINO_SAMD_MKRWAN1300) || defined(ARDUINO_SAMD_MKRWAN1310) \ || defined(ARDUINO_SAMD_MKRGSM1400) || defined(ARDUINO_SAMD_MKRNB1500) || defined(ARDUINO_SAMD_MKRVIDOR4000) || defined(__SAMD21G18A__) \ || defined(ARDUINO_SAMD_CIRCUITPLAYGROUND_EXPRESS) || defined(__SAMD21E18A__) || defined(__SAMD51__) || defined(__SAMD51J20A__) || defined(__SAMD51J19A__) \ || defined(__SAMD51G19A__) || defined(__SAMD51P19A__) || defined(__SAMD21G18A__) ) #if defined(ETHERNET_USE_SAMD) #undef ETHERNET_USE_SAMD #endif #define ETHERNET_USE_SAMD true #endif #if (defined(NRF52840_FEATHER) || defined(NRF52832_FEATHER) || defined(NRF52_SERIES) || defined(ARDUINO_NRF52_ADAFRUIT) || \ defined(NRF52840_FEATHER_SENSE) || defined(NRF52840_ITSYBITSY) || defined(NRF52840_CIRCUITPLAY) || \ defined(NRF52840_CLUE) || defined(NRF52840_METRO) || defined(NRF52840_PCA10056) || defined(PARTICLE_XENON) || \ defined(NRF52840_LED_GLASSES) || defined(MDBT50Q_RX) || defined(NINA_B302_ublox) || defined(NINA_B112_ublox) || \ defined(ARDUINO_Seeed_XIAO_nRF52840) || defined(ARDUINO_Seeed_XIAO_nRF52840_Sense) || \ defined(ARDUINO_SEEED_XIAO_NRF52840) || defined(ARDUINO_SEEED_XIAO_NRF52840_SENSE) ) #if defined(ETHERNET_USE_NRF528XX) #undef ETHERNET_USE_NRF528XX #endif #define ETHERNET_USE_NRF528XX true #endif #if ( defined(ARDUINO_SAM_DUE) || defined(__SAM3X8E__) ) #if defined(ETHERNET_USE_SAM_DUE) #undef ETHERNET_USE_SAM_DUE #endif #define ETHERNET_USE_SAM_DUE true #endif #if ( defined(ARDUINO_ARCH_RP2040) || defined(ARDUINO_RASPBERRY_PI_PICO) || defined(ARDUINO_ADAFRUIT_FEATHER_RP2040) || defined(ARDUINO_GENERIC_RP2040) ) #if defined(ETHERNET_USE_RPIPICO) #undef ETHERNET_USE_RPIPICO #endif #define ETHERNET_USE_RPIPICO true #endif #if defined(ETHERNET_USE_SAMD) // For SAMD // Default pin SS/CS,if no SS pin, use pin 10 #if defined(PIN_SPI_MOSI) //#warning Using SS pin #define USE_THIS_SS_PIN 10 //SS #else #define USE_THIS_SS_PIN 10 #endif #if ( defined(ARDUINO_SAMD_ZERO) && !defined(SEEED_XIAO_M0) ) #define BOARD_TYPE "SAMD Zero" // Default to use W5100. Must change to false for W5500, W5100S, for faster SPI clock // Must use true for SAMD21, such as Zero, SAMD_FEATHER_M0_EXPRESS, etc. #define USE_W5100 true // Use this for ARDUINO_SAMD_ZERO, etc. if can't print to terminal with Serial.print #if defined(SERIAL_PORT_USBVIRTUAL) #define Serial SERIAL_PORT_USBVIRTUAL #if (_ETHERNET_WEBSERVER_LOGLEVEL_ > 3) #warning Using SAMD Zero SerialUSB #endif #endif #elif defined(ARDUINO_SAMD_MKR1000) #define BOARD_TYPE "SAMD MKR1000" #elif defined(ARDUINO_SAMD_MKRWIFI1010) #define BOARD_TYPE "SAMD MKRWIFI1010" #elif defined(ARDUINO_SAMD_NANO_33_IOT) #define BOARD_TYPE "SAMD NANO_33_IOT" #elif defined(ARDUINO_SAMD_MKRFox1200) #define BOARD_TYPE "SAMD MKRFox1200" #elif ( defined(ARDUINO_SAMD_MKRWAN1300) || defined(ARDUINO_SAMD_MKRWAN1310) ) #define BOARD_TYPE "SAMD MKRWAN13X0" #elif defined(ARDUINO_SAMD_MKRGSM1400) #define BOARD_TYPE "SAMD MKRGSM1400" #elif defined(ARDUINO_SAMD_MKRNB1500) #define BOARD_TYPE "SAMD MKRNB1500" #elif defined(ARDUINO_SAMD_MKRVIDOR4000) #define BOARD_TYPE "SAMD MKRVIDOR4000" #elif defined(ARDUINO_SAMD_CIRCUITPLAYGROUND_EXPRESS) #define BOARD_TYPE "SAMD ARDUINO_SAMD_CIRCUITPLAYGROUND_EXPRESS" #elif defined(ADAFRUIT_FEATHER_M0_EXPRESS) #define BOARD_TYPE "SAMD21 ADAFRUIT_FEATHER_M0_EXPRESS" #elif defined(ADAFRUIT_METRO_M0_EXPRESS) #define BOARD_TYPE "SAMD21 ADAFRUIT_METRO_M0_EXPRESS" #elif defined(ADAFRUIT_CIRCUITPLAYGROUND_M0) #define BOARD_TYPE "SAMD21 ADAFRUIT_CIRCUITPLAYGROUND_M0" #elif defined(ADAFRUIT_GEMMA_M0) #define BOARD_TYPE "SAMD21 ADAFRUIT_GEMMA_M0" #elif defined(ADAFRUIT_TRINKET_M0) #define BOARD_TYPE "SAMD21 ADAFRUIT_TRINKET_M0" #elif defined(ADAFRUIT_ITSYBITSY_M0) #define BOARD_TYPE "SAMD21 ADAFRUIT_ITSYBITSY_M0" #elif defined(ARDUINO_SAMD_HALLOWING_M0) #define BOARD_TYPE "SAMD21 ARDUINO_SAMD_HALLOWING_M0" #elif defined(ADAFRUIT_METRO_M4_EXPRESS) #define BOARD_TYPE "SAMD51 ADAFRUIT_METRO_M4_EXPRESS" #elif defined(ADAFRUIT_GRAND_CENTRAL_M4) #define BOARD_TYPE "SAMD51 ADAFRUIT_GRAND_CENTRAL_M4" #elif defined(ADAFRUIT_FEATHER_M4_EXPRESS) #define BOARD_TYPE "SAMD51 ADAFRUIT_FEATHER_M4_EXPRESS" #elif defined(ADAFRUIT_ITSYBITSY_M4_EXPRESS) #define BOARD_TYPE "SAMD51 ADAFRUIT_ITSYBITSY_M4_EXPRESS" #define USE_THIS_SS_PIN 10 #elif defined(ADAFRUIT_TRELLIS_M4_EXPRESS) #define BOARD_TYPE "SAMD51 ADAFRUIT_TRELLIS_M4_EXPRESS" #elif defined(ADAFRUIT_PYPORTAL) #define BOARD_TYPE "SAMD51 ADAFRUIT_PYPORTAL" #elif defined(ADAFRUIT_PYPORTAL_M4_TITANO) #define BOARD_TYPE "SAMD51 ADAFRUIT_PYPORTAL_M4_TITANO" #elif defined(ADAFRUIT_PYBADGE_M4_EXPRESS) #define BOARD_TYPE "SAMD51 ADAFRUIT_PYBADGE_M4_EXPRESS" #elif defined(ADAFRUIT_METRO_M4_AIRLIFT_LITE) #define BOARD_TYPE "SAMD51 ADAFRUIT_METRO_M4_AIRLIFT_LITE" #elif defined(ADAFRUIT_PYGAMER_M4_EXPRESS) #define BOARD_TYPE "SAMD51 ADAFRUIT_PYGAMER_M4_EXPRESS" #elif defined(ADAFRUIT_PYGAMER_ADVANCE_M4_EXPRESS) #define BOARD_TYPE "SAMD51 ADAFRUIT_PYGAMER_ADVANCE_M4_EXPRESS" #elif defined(ADAFRUIT_PYBADGE_AIRLIFT_M4) #define BOARD_TYPE "SAMD51 ADAFRUIT_PYBADGE_AIRLIFT_M4" #elif defined(ADAFRUIT_MONSTER_M4SK_EXPRESS) #define BOARD_TYPE "SAMD51 ADAFRUIT_MONSTER_M4SK_EXPRESS" #elif defined(ADAFRUIT_HALLOWING_M4_EXPRESS) #define BOARD_TYPE "SAMD51 ADAFRUIT_HALLOWING_M4_EXPRESS" #elif defined(SEEED_WIO_TERMINAL) #define BOARD_TYPE "SAMD SEEED_WIO_TERMINAL" #elif defined(SEEED_FEMTO_M0) #define BOARD_TYPE "SAMD SEEED_FEMTO_M0" #elif defined(SEEED_XIAO_M0) #define BOARD_TYPE "SAMD SEEED_XIAO_M0" #ifdef USE_THIS_SS_PIN #undef USE_THIS_SS_PIN #endif #define USE_THIS_SS_PIN A1 #if (_ETHERNET_WEBSERVER_LOGLEVEL_ > 3) #warning define SEEED_XIAO_M0 USE_THIS_SS_PIN == A1 #endif #elif defined(Wio_Lite_MG126) #define BOARD_TYPE "SAMD SEEED Wio_Lite_MG126" #elif defined(WIO_GPS_BOARD) #define BOARD_TYPE "SAMD SEEED WIO_GPS_BOARD" #elif defined(SEEEDUINO_ZERO) #define BOARD_TYPE "SAMD SEEEDUINO_ZERO" #elif defined(SEEEDUINO_LORAWAN) #define BOARD_TYPE "SAMD SEEEDUINO_LORAWAN" #elif defined(SEEED_GROVE_UI_WIRELESS) #define BOARD_TYPE "SAMD SEEED_GROVE_UI_WIRELESS" #elif defined(__SAMD21E18A__) #define BOARD_TYPE "SAMD21E18A" #elif defined(__SAMD21G18A__) #define BOARD_TYPE "SAMD21G18A" #elif defined(__SAMD51G19A__) #define BOARD_TYPE "SAMD51G19A" #elif defined(__SAMD51J19A__) #define BOARD_TYPE "SAMD51J19A" #elif defined(__SAMD51J20A__) #define BOARD_TYPE "SAMD51J20A" #elif defined(__SAM3X8E__) #define BOARD_TYPE "SAM3X8E" #elif defined(__CPU_ARC__) #define BOARD_TYPE "CPU_ARC" #elif defined(__SAMD51__) #define BOARD_TYPE "SAMD51" #else #define BOARD_TYPE "SAMD Unknown" #endif #elif (ETHERNET_USE_SAM_DUE) // Default pin 10 to SS/CS #define USE_THIS_SS_PIN 10 #define BOARD_TYPE "SAM DUE" #elif (ETHERNET_USE_NRF528XX) // For Adafruit nRF52 // Default pin SS/CS,if no SS pin, use pin 10 #if defined(PIN_SPI_MOSI) #if (_ETHERNET_WEBSERVER_LOGLEVEL_ > 3) #warning Using SS pin #endif #define USE_THIS_SS_PIN SS #else #define USE_THIS_SS_PIN 10 #endif #if defined(ARDUINO_Seeed_XIAO_nRF52840) #define BOARD_TYPE "Seeed_XIAO_nRF52840" #elif defined(ARDUINO_Seeed_XIAO_nRF52840_Sense) #define BOARD_TYPE "Seeed_XIAO_nRF52840_Sense" #elif defined(ARDUINO_SEEED_XIAO_NRF52840) #define BOARD_TYPE "SEEED_XIAO_NRF52840" #elif defined(ARDUINO_SEEED_XIAO_NRF52840_SENSE) #define BOARD_TYPE "SEEED_XIAO_NRF52840_SENSE" #elif defined(NRF52840_FEATHER) #define BOARD_TYPE "NRF52840_FEATHER" #elif defined(NRF52832_FEATHER) #define BOARD_TYPE "NRF52832_FEATHER" #elif defined(NRF52840_FEATHER_SENSE) #define BOARD_TYPE "NRF52840_FEATHER_SENSE" #elif defined(NRF52840_ITSYBITSY) #define BOARD_TYPE "NRF52840_ITSYBITSY" #define USE_THIS_SS_PIN 10 // For other boards #elif defined(NRF52840_CIRCUITPLAY) #define BOARD_TYPE "NRF52840_CIRCUITPLAY" #elif defined(NRF52840_CLUE) #define BOARD_TYPE "NRF52840_CLUE" #elif defined(NRF52840_METRO) #define BOARD_TYPE "NRF52840_METRO" #elif defined(NRF52840_PCA10056) #define BOARD_TYPE "NRF52840_PCA10056" #elif defined(NINA_B302_ublox) #define BOARD_TYPE "NINA_B302_ublox" #elif defined(NINA_B112_ublox) #define BOARD_TYPE "NINA_B112_ublox" #elif defined(PARTICLE_XENON) #define BOARD_TYPE "PARTICLE_XENON" #elif defined(ARDUINO_NRF52_ADAFRUIT) #define BOARD_TYPE "ARDUINO_NRF52_ADAFRUIT" #else #define BOARD_TYPE "nRF52 Unknown" #endif #elif ( defined(CORE_TEENSY) ) // Default pin 10 to SS/CS #define USE_THIS_SS_PIN SS //10 #if defined(__IMXRT1062__) // For Teensy 4.1/4.0 #if defined(ARDUINO_TEENSY41) #define BOARD_TYPE "TEENSY 4.1" // Use true for NativeEthernet Library, false if using other Ethernet libraries #define USE_NATIVE_ETHERNET true #elif defined(ARDUINO_TEENSY40) #define BOARD_TYPE "TEENSY 4.0" #else #define BOARD_TYPE "TEENSY 4.x" #endif #elif defined(__MK66FX1M0__) #define BOARD_TYPE "Teensy 3.6" #elif defined(__MK64FX512__) #define BOARD_TYPE "Teensy 3.5" #elif defined(__MKL26Z64__) #define BOARD_TYPE "Teensy LC" #elif defined(__MK20DX256__) #define BOARD_TYPE "Teensy 3.2" // and Teensy 3.1 (obsolete) #elif defined(__MK20DX128__) #define BOARD_TYPE "Teensy 3.0" #elif defined(__AVR_AT90USB1286__) #error Teensy 2.0++ not supported yet #elif defined(__AVR_ATmega32U4__) #error Teensy 2.0 not supported yet #else // For Other Boards #define BOARD_TYPE "Unknown Teensy Board" #endif #elif ( defined(ESP8266) ) // For ESP8266 #if (_ETHERNET_WEBSERVER_LOGLEVEL_ > 3) #warning Use ESP8266 architecture #endif #includeThe third code section is example/BasicOTA with the change to Ethernet
BasicOTA_Ethernet.ino
```c++ #include