ArduinoOTA icon indicating copy to clipboard operation
ArduinoOTA copied to clipboard

Compatibility with Ethernet3 library?

Open modmt opened this issue 1 year ago • 7 comments

Hello,

I tried to use the OTA functionality in combination with an Atmega 1284P and the ethernet3.h library (https://github.com/sstaub/Ethernet3) but I always get the error: "ArduinoOTA' was not declared in this scope ArduinoOTA.poll();".

Do you know if the ArduinoOTA library is compatible with the Ethernet3 library? I have to use this library because of its additional features which the Standard Ethernet library cannot provide.

Thank you for your help. Matthias

modmt avatar Oct 16 '23 13:10 modmt

why do you use the Ethernet3 library? the Arduino Ethernet library works good with W5500

JAndrassy avatar Oct 16 '23 14:10 JAndrassy

I use the "Ethernet.phyMode(FULL_DUPLEX_10);" to reduce the Power consumption. As far as I know the standard Ethernet library doesn't have this function. Also choosing an custom RST and CS pin is more easy with the Eternet3 library.

modmt avatar Oct 16 '23 15:10 modmt

add #define ethernet_h before #include <ArduinoOTA.h>

JAndrassy avatar Oct 16 '23 17:10 JAndrassy

Thank you very much for your quick response!

After adding the #define ethernet_h compiling the programm works fine.

Now I have an additional problem: Connecting to the board and uploading the sketch seems to works fine (see attachment) but flashing does not work and I'm running out of ideas why. screenshot_1933

In my sketch I have in addition to my code the following code snippets:

#define ethernet_h #define NO_OTA_PORT #include <ArduinoOTA.h>

void setup() { ArduinoOTA.begin(Ethernet.localIP(), "Arduino", "password", InternalStorage); .... }

void loop() { ArduinoOTA.poll(); ... }

I added the following to my programmer.txt in the MightyCore folder (IP 192.168.188.100 for the ATmega1284P board is static and all the functions (like MQTT) using the ethernet are working)

arduinoOTA100.name=Arduino OTA (192.168.188.100) arduinoOTA100.program.tool=arduinoOTA arduinoOTA100.program.tool.default=arduinoOTA arduinoOTA100.ip=192.168.188.100

and also copied the platform.local.txt from the ArduinoOTA container to this folder. After that I found the programmer in the menu.

I also burned the Optiboot bootloader to the Atmega1284P.

Do you know what else I can do to get OTA flashing working? Did i miss anything in the procedure?

Thank you in advance. Matthias

modmt avatar Oct 17 '23 07:10 modmt

a simple example like the OTEthernet works? it could be a timeout in the upload tool for larger sketch.

JAndrassy avatar Oct 17 '23 08:10 JAndrassy

I tried it with the simple example with the same result. The only change I made is using the ethernet3 library instead of the ethernet library. The port was recongized in the arduino IDE and I have to type the password. After that uploading works, but flashing not. The same with the fake programmer.

I think it's not a timeout because I got the error after 5-8 seconds, even with small sketches to check.

I also added this, but no change: screenshot_1934

As I understood the Optiboot bootloader is already included in the MightyCore. Is it enough to chose the bootloader and after that burn bootloader like this in the MightyCore settings or do I have to flash the optiboot (8) seperately? Maybe this could be an issue I made wrong. screenshot_1936

#Edit: I also flashed the "optiboot_atmega1284p.hex" bootloader from you my-boards folder, but with same result.

modmt avatar Oct 17 '23 10:10 modmt

turn on upload verbose mode in IDE Preferences

JAndrassy avatar Oct 17 '23 11:10 JAndrassy