Burning bootloader on RobotDyn Mega 2560 ETH to get ArduinoOTA working

I have a RobotDyn Mega 2560 ETH with MicroSD card reader and POE active. The board has a W5500 and SDcard attached and the possibility to attach an ESP-01.

To get ArduinoOTA working I have to burn the bootloader because I think I have the same issue as here: Arduino Mega 2560 - OTA failed · Issue #6 · JAndrassy/ArduinoOTA · GitHub

@Juraj advices to use "my boards" custom hardware configuration to burn the special bootloader and to use the board with it. I got the "my_boards" from GitHub - JAndrassy/my_boards: My Arduino boards custom variants. You can use it as starting point for your boards specialities. and put those files in Arduino/hardware/*

I want to burn the bootloader with Arduino 1.8.13 and the mega2560 connected to my MacBook with MacOs Catalina 10.15.7

I use:
Tools > Selected boar: Mega 2560
Tools > Port: /dev/cu.SLAB_USBtoUART
Tools >Programmer: Arduino as ISP
Tools > Burn Bootloader

But I get
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00

What should I do with the hardware to prepare the board for burning bootloader? With the W5500, SDcard and ESP-01 there are already some connections soldered, see the attached picture of the back of my board. On this forum I see a lot of people using another arduino. But I just want to do it with my MacBook, that way it looks the easy way for a beginner like me.

do you have a capacitor on reset pin of the programmer Arduino to prevent its reset?
(I suspect you didn't setup an Arduino as ISP at all)
and you should select "Arduino Mega 2560 (Optiboot)" in Tools menu.

this is a picture from https://www.arduino.cc/en/Tutorial/BuiltInExamples/ArduinoISP
with the capacitor on programmer board. here the target is Uno. in your case the target will be the Robotdyn Mega ETH

Juraj, you were right.

I read the page you linked, I bought a capacitor (got it today), build the programmer/target setup and burned the optiboot.

I think the burning works because I can only upload new sketches when I select board: "Arduino Mega 2560 (Optiboot)" and when I select the old board: "Arduino Mega or Mega 2560" is cannot connect.

But the problem with ArduinoOTA still exists. I can see the board appears with an IP in Arduino IDE. But the password does not work. I have to give the password but it won't work and I get "Resetting the board
Failed to reset the board, upload failed".

What goes wrong? Do I have to check if I burned the bootloader correctly? And how do I do it?

did you change the password in the example or is it still "password"?
turn on upload verbose mode in Preferences to see the upload command

I changed it to vetvetvet

The output with verbose mode:
Sketch uses 22752 bytes (8%) of program storage space. Maximum is 261120 bytes.
Global variables use 1368 bytes (16%) of dynamic memory, leaving 6824 bytes for local variables. Maximum is 8192 bytes.
/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/arduinoOTA -address 192.168.178.89 -port {upload.network.port} -sketch /var/folders/3w/p74x5s317vjf33g5l9gz0d_w0000gn/T/arduino_build_944747/OTEthernet.ino.hex -upload {upload.network.endpoint_upload} -sync {upload.network.endpoint_sync} -reset {upload.network.endpoint_reset} -sync_exp {upload.network.sync_return}
Resetting the board
Failed to reset the board, upload failed
/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/arduinoOTA -address 192.168.178.89 -port {upload.network.port} -sketch /var/folders/3w/p74x5s317vjf33g5l9gz0d_w0000gn/T/arduino_build_944747/OTEthernet.ino.hex -upload {upload.network.endpoint_upload} -sync {upload.network.endpoint_sync} -reset {upload.network.endpoint_reset} -sync_exp {upload.network.sync_return}
Resetting the board
Failed to reset the board, upload failed

the command is not right. copy platform.local.txt from extras/avr folder in library next platform.txt of AVR boards package

Juraj:
the command is not right. copy platform.local.txt from extras/avr folder in library next platform.txt of AVR boards package

/Users/Mine/Documents/Arduino/libraries/ArduinoOTA/extras/avr/platform.local.txt
to
/Users/Mine/Documents/Arduino/hardware/my_boards/avr/platform.txt
?

It does not work. I did copy the file.

But I get:

/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/arduinoOTA -address 192.168.178.89 -port {upload.network.port} -sketch /var/folders/3w/p74x5s317vjf33g5l9gz0d_w0000gn/T/arduino_build_756318/OTEthernet.ino.hex -upload {upload.network.endpoint_upload} -sync {upload.network.endpoint_sync} -reset {upload.network.endpoint_reset} -sync_exp {upload.network.sync_return}
Resetting the board
Failed to reset the board, upload failed

not into but next to. and to official AVR boards platform.txt

Juraj:
not into but next to. and to official AVR boards platform.txt
GitHub - JAndrassy/ArduinoOTA: Arduino library to upload sketch over network to Arduino board with WiFi or Ethernet libraries

I am sorry. I do not understand your short sentences immediately.

You mean I have to copy the file from extras/avr
/Users/Mine/Documents/Arduino/libraries/ArduinoOTA/extras/avr/platform.local.txt

1.) to my_boards/avr/ directory like (in the same directory is next to??)
/Users/Mine/Documents/Arduino/hardware/my_boards/avr/platform.local.txt

and 2.) to official AVR boards as platform.txt (not .local.txt) where also preferences.txt is and for me that would be:
/Users/Mine/Library/Arduino15/platform.txt

Or do you mean the subdirectory packages folder
/Users/Mine/Library/Arduino15/packages/platform.txt

But that's not working either. And the directory Arduino15 is quite empty. I do not see AVR/Mega etc. I only see ESP8266.

So I guess I am in the wrong directory? Could you explain to me in more detail in what directory I have to put the platform.local.txt? There should also be a platform.txt located? and it must not be your My_boards directory?

To use remote upload from IDE with SDStorage or InternalStorage, copy platform.local.txt from extras/avr folder, next to platform.txt in the boards package used (Arduino-avr or MCUdude packages). You can find the location of boards packages in Arduino IDE Preferences as the location of the preferences.txt file at the bottom of the Preferences dialog. It is clickable and opens the folder. There find the boards package in packages folder.

Thanking you for your patience with me. I have read your GitHub page more than ten times. It is very informative. But I am suffering: I cannot find the the mentioned destination for platform.local.txt

To use remote upload from IDE with SDStorage or InternalStorage, copy platform.local.txt from extras/avr folder,

Yes, that is this file: /Users/Mine/Documents/Arduino/libraries/ArduinoOTA/extras/avr/platform.local.txt

next to platform.txt in the boards package used (Arduino-avr or MCUdude packages). You can find the location of boards packages in Arduino IDE Preferences as the location of the preferences.txt file at the bottom of the Preferences dialog. It is clickable and opens the folder. There find the boards package in packages folder.

I can find my preferences.txt file at /Users/Mine/Library/Arduino15/preferences.txt
But after that I do not understand where to look.

next to platform.txt

It suggest that there is platform.txt at /Users/Mine/Library/Arduino15/ but there is no platform.txt

There find the boards package in packages folder.

It suggest that it is in the package directory, so at Users/Mine/Library/Arduino15/packages. But there is no platform.txt
My packages directory contains only the directory ESP8266/
Users/Mine/Library/Arduino15/packages/ESP8266/ contains 2 subdirectories (hardware and tools). If I continue I can find
/Users/Mine/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/platform.txt

But where do I have to find the AVRArduino-avr or MCUdude packages? It is not at Users/Mine/Library/Arduino15/

Is it different on MacOS? Or I am too old for this?

it looks like you use the AVR boards package bundled with IDE. search for platform.txt in IDE installation folder

Juraj:
it looks like you use the AVR boards package bundled with IDE. search for platform.txt in IDE installation folder

:slight_smile: :slight_smile: :slight_smile:
I had to show content at /Applications/Arduino.app
Afterwards it was visible at /Applications/Arduino.app/Contents/Java/hardware/arduino/avr
Now it works. Many thanks!!!

Do you know why mDNS sometimes works and sometimes does not work with the standard OTEthernet sketch? I did not install other libraries but discovered that the name for OTA also works as name.local in the webbrowser.

MacQwerty:
:slight_smile: :slight_smile: :slight_smile:
I had to show content at /Applications/Arduino.app
Afterwards it was visible at /Applications/Arduino.app/Contents/Java/hardware/arduino/avr
Now it works. Many thanks!!!

Do you know why mDNS sometimes works and sometimes does not work with the standard OTEthernet sketch? I did not install other libraries but discovered that the name for OTA also works as name.local in the webbrowser.

the implementation of mDNS in the library is very simple (it was not coded by me. it is a code inherited from the original Arduino library for SAMD)