OTA on the Mega +WiFi R3 ATmega2560+ESP8266 (32Mb memory)

hi guys

Yet another "Mega +WiFi R3 ATmega2560+ESP8266 (32Mb memory)" thread
Sorry! - I have been reading up and down in many many threads - I just never seem to find a thread with a happy ending and a solution.

I bought this board on Aliexpress

I just can't get wifi-link working (no web panel)

I burned bootloader from Juraj "my_board" through a genuine UNO onto the Mega2560
I put on the ESP8266 the "ESP8266 NonOS AT Bin V1.7.1" to the addresses from the readme.md

When I compile the wifi-link, everything uploads fine - I can then connect the AP fine, there's just no web-panel when entering 192.168.240.1

from what I read, the two best options for OTA on mega2560 is WIFI-LINK or ESP-LINK.

So in another test I wanted to try ESP-LINK.

I managed to get ESP-LINK working with a simple NTP test on mega2560 module.
I can't get OTA to the mega2560 to work through ESP-LINK, which is important to me

I put on a wire from GPIO12 on ESP to RST on Mega, and the Mega is rebooting fine from web interface, when I click "reset uc" but on web page an error occurs after few settings "Error resetting uC"

it seems this "reset error" also hunts me when I try to OTA with megascript, with ip-address port, with "ESPLINK3" in programmer

I just seem stuck in this OTA process..

do you guys have any hints on how to OTA ?

esp-link has two OTA ways. one is a built in stk500 coded in the firmware. it is only for ATmega 328p with Optiboot.
the other way is a transparent connection for avrdude. it should work for Mega. I never tested that, but there is some discussion in issues on GitHub.

The WiFiLink firmware has build in OTA only for ATmega328p too. But with WiFiLink you can use for Mega the ArduinoOTA library for which the bootloader you burned is created. And for this, the WiFiLink doesn't need the built in OTA support.

btw: the AT firmware doesn't help you at all because you replaced it right away with the esp-link firmware.

Thanks Juraj

I think the WiFi-Link with ArduinoOTA is my way to go

I just need to get it to work..
I used your files from github and downloade all required libaries

I uploaded At firmware.

It compiles and uploads fine for ESP
And the Gateway from the AP is 192.168.240.1

There's just no webpage on the IP address

I had it up and running on an Uno+esp8266

I just can't get it to work on this 'combo' Board

TroelsDK:
There's just no webpage on the IP address

did you upload SPIFFS? with the right flash size selected in Tools menu (and same as for sketch upload)?
but you can use the firmware without the WebPanel.
try the examples of the library. do you use the Serial3 connection dip switch selection? then do not forget to set Serial3 to WiFi.init

Thank you Juraj for taking time to respond!

my board is 32Mb, so in ‚Äėtools\flash size:‚Äô I choose 4M+1M SPIFFS
then I run the plugin ‚Äėtools\ESP8266 Sketch Data Upload‚Äô

Here’s a picture of my settings in IDE

this is output from uploading:

[SPIFFS] data    : C:\Users\Development\Desktop\Sketches\arduino-firmware-wifilink-master\ArduinoFirmwareEsp\data
[SPIFFS] size    : 1004
[SPIFFS] page    : 256
[SPIFFS] block   : 8192
/img/favicon.ico
/img/icons.png
/img/logo.ico
/img/logo.png
/img/logoOtto.ico
/img/logoOtto.png
/img/logoPrimo.ico
/img/logoPrimo.png
/img/logoUnoWiFi.ico
/img/logoUnoWiFi.png
/index.html
/pure.css
/style.css
/ui.js
/wifi.html
/wifi.js
[SPIFFS] upload  : C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_528389/ArduinoFirmwareEsp.spiffs.bin
[SPIFFS] address  : 0x300000
[SPIFFS] reset    : ck
[SPIFFS] port     : COM10
[SPIFFS] speed    : 115200
[SPIFFS] python   : C:\Data\arduino-1.8.9-windows\portable\packages\esp8266\tools\python\3.7.2-post1\python.exe
[SPIFFS] uploader : C:\Data\arduino-1.8.9-windows\portable\packages\esp8266\hardware\esp8266\2.5.2\tools\upload.py
esptool.py v2.6
Serial port COM10
Connecting....
Chip is ESP8266EX
Features: WiFi
MAC: ec:fa:bc:39:85:17
Uploading stub...
Running stub..
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 1028096 bytes to 91019...
Writing at 0x00300000... (16 %)
Writing at 0x00304000... (33 %)
Writing at 0x00308000... (50 %)
Writing at 0x0030c000... (66 %)
Writing at 0x00310000... (83 %)
Writing at 0x00314000... (100 %)
Wrote 1028096 bytes (91019 compressed) at 0x00300000 in 9.3 seconds (effective 880.2 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...

Today I tried using an example from WifiLink
I chose ‚ÄėConnectWithWPA‚Äô and the DIP to Serial3

it did the trick!

so now I have a ESP on wifi with WifiLink and I just need to crack the OTA nut
I have remembered to uncomment the ‚ÄúMCU_OTA define‚ÄĚ in WifiLink.

I connected "ESP GPIO12 " to ‚ÄúRST‚ÄĚ on mega board and I tried to insert ArduinoOTA into the chosen example

but when I choose the web port in IDE, it says

Sketch uses 13558 bytes (5%) of program storage space. Maximum is 261120 bytes.
Global variables use 1144 bytes (13%) of dynamic memory, leaving 7048 bytes for local variables. Maximum is 8192 bytes.
Resetting the board
Failed to reset the board, upload failed
An error occurred while uploading the sketch

my sketch is :

#include <WiFiLink.h>
#if !defined(ESP_CH_SPI) && !defined(HAVE_HWSERIAL3)
#endif


#include <ArduinoOTA.h>

char ssid[] = "xxxx";     //  your network SSID (name)
char pass[] = "xxxx";  // your network password
int status = WL_IDLE_STATUS;     // the Wifi radio's status

void setup() {
  //Initialize serial and wait for port to open:
  Serial.begin(115200);

  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }
  Serial.print("Hello world 1-2-3");
#if !defined(ESP_CH_SPI)
  Serial3.begin(9600); // speed must match with BAUDRATE_COMMUNICATION setting in firmware config.h
  WiFi.init(&Serial3);
#endif
  if (WiFi.checkFirmwareVersion("1.1.0")) {
    WiFi.resetESP(); // to clear 'sockets' after sketch upload
    delay(500); // let firmware initialize
  }

  //Check if communication with the wifi module has been established
  if (WiFi.status() == WL_NO_WIFI_MODULE_COMM) {
    Serial.println("Communication with WiFi module not established.");
    while (true);// don't continue:
  }

  // attempt to connect to Wifi network:
  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to WPA SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network:
    status = WiFi.begin(ssid, pass);

    // wait 10 seconds for connection:
    delay(10000);
  }

  // you're connected now, so print out the data:
  Serial.print("You're connected to the network");
  ArduinoOTA.begin(WiFi.localIP(), "Arduino", "password", InternalStorage);
}

void loop() {

  // check for WiFi OTA updates

  ArduinoOTA.poll();
  delay(5000);
}

as I wrote before the built-in OTA support of WiFiLink is not for Mega, so you don’t need it including the reset pin connection.

select ‚Äúmy_boards‚ÄĚ ‚ÄúMega 2560 (Optiboot)‚ÄĚ board in Tools menu for upload.

I am not sure, but it is possible that you will need to copy platform.local.txt from extras/avr folder, next to platform.txt in the boards package.

ok, I'll outcomment the MCU_OTA again..

I dont have platform.local.txt in %userprofiles%/appdata/local/arduino15/extras/avr

but after searching on google, I can see that somebody creates it when missing

I just dont know what line to put in the file

can you share what you wrote in your platform.local.txt ?

read GitHub - jandrassy/ArduinoOTA: Arduino library to upload sketch over network to Arduino board with WiFi or Ethernet libraries

thank you!
I thought to look in %userprofiles%/appdata/local/arduino15/extras/avr

I have now copied into \hardware\my_boards\avr next to platform.txt

I have restarted IDE 1.8.9 and tried to update through web port for 'MEGA 2560 (optiboot)'
it seems like the platform.local.txt doesn't kick in

Sketch uses 6146 bytes (2%) of program storage space. Maximum is 261120 bytes.
Global variables use 565 bytes (6%) of dynamic memory, leaving 7627 bytes for local variables. Maximum is 8192 bytes.
C:\Data\arduino-1.8.9-windows\hardware\tools\avr/bin/arduinoOTA -address 172.20.23.100 -port {upload.network.port} -sketch C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_298605/mega_ota_test.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
An error occurred while uploading the sketch

I have tried to run the arduinoOTA.exe manually in CMD with the commands from platform.local.txt

C:\Data\arduino-1.8.9-windows\hardware\tools\avr\bin>arduinoOTA -address 172.20.23.100 -port 65280 -username Arduino -password password -sketch "C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_298605\mega_ota_test.ino.bin" -upload /sketch -b
Connecting to board ... failed!
Error flashing the sketch

now I also copied platform.local.txt into "\hardware\arduino\avr"

so the correct cmd is used from IDE now..

Sketch uses 6174 bytes (2%) of program storage space. Maximum is 261120 bytes.
Global variables use 575 bytes (7%) of dynamic memory, leaving 7617 bytes for local variables. Maximum is 8192 bytes.
C:\Data\arduino-1.8.9-windows\hardware\tools\avr/bin/arduinoOTA -address 172.20.23.100 -port 65280 -username arduino -password -sketch C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_277364/mega_ota_test.ino.bin -upload /sketch -b

and IDE writes "Done uploading." - but the sketch is not updated (I have a simple serial.print("Hello world"; that I change to "goodbye world" to check the sketch changes

there should be 3 more lines after the arduinoOTA command

USB upload works for "Mega 2560 (Optiboot)"?

Yes USB works fine

If I run the OTA commands in regular commandline, it just completes instant

If I change fx. The password in the commmand to something 'gdhsb' then it returns that it fails to connect to Board

Is it correct that I dont need to add arduinoOTA in the sketch for mega?

  • it seems like all arduinoOTA is handled by WifiLink

TroelsDK:
Yes USB works fine

If I run the OTA commands in regular commandline, it just completes instant

If I change fx. The password in the commmand to something 'gdhsb' then it returns that it fails to connect to Board

Is it correct that I dont need to add arduinoOTA in the sketch for mega?

  • it seems like all arduinoOTA is handled by WifiLink

remove the delay(5000)

and turn on console verbose mode in Preferences in IDE

ok, I have removed delay(5000)

my sketch is on MEGA:

#include <WiFiLink.h>
#if !defined(ESP_CH_SPI) && !defined(HAVE_HWSERIAL3)
#endif


#include <ArduinoOTA.h>

char ssid[] = "censur";     //  your network SSID (name)
char pass[] = "censur";  // your network password
int status = WL_IDLE_STATUS;     // the Wifi radio's status

void setup() {
  //Initialize serial and wait for port to open:
  Serial.begin(115200);

  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }
  
  Serial.print("Hello world 3-2-3");
  
#if !defined(ESP_CH_SPI)
  Serial3.begin(9600); // speed must match with BAUDRATE_COMMUNICATION setting in firmware config.h
  WiFi.init(&Serial3);
#endif
  if (WiFi.checkFirmwareVersion("1.1.0")) {
    WiFi.resetESP(); // to clear 'sockets' after sketch upload
    delay(500); // let firmware initialize
  }

  //Check if communication with the wifi module has been established
  if (WiFi.status() == WL_NO_WIFI_MODULE_COMM) {
    Serial.println("Communication with WiFi module not established.");
    while (true);// don't continue:
  }

  // attempt to connect to Wifi network:
  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to WPA SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network:
    status = WiFi.begin(ssid, pass);

    // wait 10 seconds for connection:
    delay(10000);
  }

  // you're connected now, so print out the data:
  Serial.print("You're connected to the network");
  ArduinoOTA.begin(WiFi.localIP(), "Arduino", "password", InternalStorage);
}

void loop() {
  // check for WiFi OTA updates
  ArduinoOTA.poll();
}

when it uploads, it takes 1 sek and then 'done uploading'

my console is larger than allowed 9000 characters post, so I'll split in two..

first part of console:
console:

C:\Data\arduino-1.8.9-windows\arduino-builder -dump-prefs -logger=machine -hardware C:\Data\arduino-1.8.9-windows\hardware -hardware C:\Data\arduino-1.8.9-windows\portable\packages -tools C:\Data\arduino-1.8.9-windows\tools-builder -tools C:\Data\arduino-1.8.9-windows\hardware\tools\avr -tools C:\Data\arduino-1.8.9-windows\portable\packages -built-in-libraries C:\Data\arduino-1.8.9-windows\libraries -libraries C:\Data\Arduino - projekt Spa\libraries -fqbn=my_boards:avr:mega -ide-version=10809 -build-path C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_958660 -warnings=none -build-cache C:\Users\DEVELO~1\AppData\Local\Temp\arduino_cache_760605 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=C:\Data\arduino-1.8.9-windows\hardware\tools\avr -prefs=runtime.tools.avr-gcc-5.4.0-atmel3.6.1-arduino2.path=C:\Data\arduino-1.8.9-windows\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\Data\arduino-1.8.9-windows\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.2.1.path=C:\Data\arduino-1.8.9-windows\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Data\arduino-1.8.9-windows\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino14.path=C:\Data\arduino-1.8.9-windows\hardware\tools\avr -verbose C:\Users\Development\Desktop\Sketches\mega_ota_test\mega_ota_test.ino
C:\Data\arduino-1.8.9-windows\arduino-builder -compile -logger=machine -hardware C:\Data\arduino-1.8.9-windows\hardware -hardware C:\Data\arduino-1.8.9-windows\portable\packages -tools C:\Data\arduino-1.8.9-windows\tools-builder -tools C:\Data\arduino-1.8.9-windows\hardware\tools\avr -tools C:\Data\arduino-1.8.9-windows\portable\packages -built-in-libraries C:\Data\arduino-1.8.9-windows\libraries -libraries C:\Data\Arduino - projekt Spa\libraries -fqbn=my_boards:avr:mega -ide-version=10809 -build-path C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_958660 -warnings=none -build-cache C:\Users\DEVELO~1\AppData\Local\Temp\arduino_cache_760605 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=C:\Data\arduino-1.8.9-windows\hardware\tools\avr -prefs=runtime.tools.avr-gcc-5.4.0-atmel3.6.1-arduino2.path=C:\Data\arduino-1.8.9-windows\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\Data\arduino-1.8.9-windows\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.2.1.path=C:\Data\arduino-1.8.9-windows\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Data\arduino-1.8.9-windows\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino14.path=C:\Data\arduino-1.8.9-windows\hardware\tools\avr -verbose C:\Users\Development\Desktop\Sketches\mega_ota_test\mega_ota_test.ino
Using board 'mega' from platform in folder: C:\Data\arduino-1.8.9-windows\hardware\my_boards\avr
Using core 'arduino' from platform in folder: C:\Data\arduino-1.8.9-windows\hardware\arduino\avr
Detecting libraries used...
"C:\\Data\\arduino-1.8.9-windows\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10809 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Data\\arduino-1.8.9-windows\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Data\\arduino-1.8.9-windows\\hardware\\arduino\\avr\\variants\\mega" "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660\\sketch\\mega_ota_test.ino.cpp" -o nul
"C:\\Data\\arduino-1.8.9-windows\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10809 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Data\\arduino-1.8.9-windows\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Data\\arduino-1.8.9-windows\\hardware\\arduino\\avr\\variants\\mega" "-IC:\\Data\\Arduino - projekt Spa\\libraries\\arduino-library-wifilink-master\\src" "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660\\sketch\\mega_ota_test.ino.cpp" -o nul
"C:\\Data\\arduino-1.8.9-windows\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10809 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Data\\arduino-1.8.9-windows\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Data\\arduino-1.8.9-windows\\hardware\\arduino\\avr\\variants\\mega" "-IC:\\Data\\Arduino - projekt Spa\\libraries\\arduino-library-wifilink-master\\src" "-IC:\\Data\\Arduino - projekt Spa\\libraries\\ArduinoOTA\\src" "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660\\sketch\\mega_ota_test.ino.cpp" -o nul
Using cached library dependencies for file: C:\Data\Arduino - projekt Spa\libraries\arduino-library-wifilink-master\src\WiFiClient.cpp
Using cached library dependencies for file: C:\Data\Arduino - projekt Spa\libraries\arduino-library-wifilink-master\src\WiFiLink.cpp
Using cached library dependencies for file: C:\Data\Arduino - projekt Spa\libraries\arduino-library-wifilink-master\src\WiFiServer.cpp
Using cached library dependencies for file: C:\Data\Arduino - projekt Spa\libraries\arduino-library-wifilink-master\src\WiFiUdp.cpp
Using cached library dependencies for file: C:\Data\Arduino - projekt Spa\libraries\arduino-library-wifilink-master\src\utility\comm.cpp
Using cached library dependencies for file: C:\Data\Arduino - projekt Spa\libraries\arduino-library-wifilink-master\src\utility\server_drv.cpp
Using cached library dependencies for file: C:\Data\Arduino - projekt Spa\libraries\arduino-library-wifilink-master\src\utility\spi\spi_drv.cpp
Using cached library dependencies for file: C:\Data\Arduino - projekt Spa\libraries\arduino-library-wifilink-master\src\utility\uart\serial.cpp
Using cached library dependencies for file: C:\Data\Arduino - projekt Spa\libraries\arduino-library-wifilink-master\src\utility\uart\uart_drv.cpp
Using cached library dependencies for file: C:\Data\Arduino - projekt Spa\libraries\arduino-library-wifilink-master\src\utility\wifi_drv.cpp
Using cached library dependencies for file: C:\Data\Arduino - projekt Spa\libraries\ArduinoOTA\src\InternalStorage.cpp
Using cached library dependencies for file: C:\Data\Arduino - projekt Spa\libraries\ArduinoOTA\src\InternalStorageAVR.cpp
Using cached library dependencies for file: C:\Data\Arduino - projekt Spa\libraries\ArduinoOTA\src\InternalStorageESP.cpp
Using cached library dependencies for file: C:\Data\Arduino - projekt Spa\libraries\ArduinoOTA\src\OTAStorage.cpp
Using cached library dependencies for file: C:\Data\Arduino - projekt Spa\libraries\ArduinoOTA\src\WiFiOTA.cpp
Generating function prototypes...
"C:\\Data\\arduino-1.8.9-windows\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10809 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Data\\arduino-1.8.9-windows\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Data\\arduino-1.8.9-windows\\hardware\\arduino\\avr\\variants\\mega" "-IC:\\Data\\Arduino - projekt Spa\\libraries\\arduino-library-wifilink-master\\src" "-IC:\\Data\\Arduino - projekt Spa\\libraries\\ArduinoOTA\\src" "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660\\sketch\\mega_ota_test.ino.cpp" -o "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660\\preproc\\ctags_target_for_gcc_minus_e.cpp"
"C:\\Data\\arduino-1.8.9-windows\\tools-builder\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...

second part of console:
console:

"C:\\Data\\arduino-1.8.9-windows\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10809 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Data\\arduino-1.8.9-windows\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Data\\arduino-1.8.9-windows\\hardware\\arduino\\avr\\variants\\mega" "-IC:\\Data\\Arduino - projekt Spa\\libraries\\arduino-library-wifilink-master\\src" "-IC:\\Data\\Arduino - projekt Spa\\libraries\\ArduinoOTA\\src" "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660\\sketch\\mega_ota_test.ino.cpp" -o "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660\\sketch\\mega_ota_test.ino.cpp.o"
Compiling libraries...
Compiling library "arduino-library-wifilink-master"
Using previously compiled file: C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_958660\libraries\arduino-library-wifilink-master\WiFiClient.cpp.o
Using previously compiled file: C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_958660\libraries\arduino-library-wifilink-master\WiFiServer.cpp.o
Using previously compiled file: C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_958660\libraries\arduino-library-wifilink-master\WiFiLink.cpp.o
Using previously compiled file: C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_958660\libraries\arduino-library-wifilink-master\WiFiUdp.cpp.o
Using previously compiled file: C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_958660\libraries\arduino-library-wifilink-master\utility\comm.cpp.o
Using previously compiled file: C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_958660\libraries\arduino-library-wifilink-master\utility\server_drv.cpp.o
Using previously compiled file: C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_958660\libraries\arduino-library-wifilink-master\utility\wifi_drv.cpp.o
Using previously compiled file: C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_958660\libraries\arduino-library-wifilink-master\utility\spi\spi_drv.cpp.o
Using previously compiled file: C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_958660\libraries\arduino-library-wifilink-master\utility\uart\serial.cpp.o
Using previously compiled file: C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_958660\libraries\arduino-library-wifilink-master\utility\uart\uart_drv.cpp.o
Compiling library "ArduinoOTA"
Using previously compiled file: C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_958660\libraries\ArduinoOTA\InternalStorageESP.cpp.o
Using previously compiled file: C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_958660\libraries\ArduinoOTA\OTAStorage.cpp.o
Using previously compiled file: C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_958660\libraries\ArduinoOTA\WiFiOTA.cpp.o
Using previously compiled file: C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_958660\libraries\ArduinoOTA\InternalStorage.cpp.o
Using previously compiled file: C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_958660\libraries\ArduinoOTA\InternalStorageAVR.cpp.o
Compiling core...
Using precompiled core: C:\Users\DEVELO~1\AppData\Local\Temp\arduino_cache_760605\core\core_my_boards_avr_mega_9923bc213abe6799f546a753821898c4.a
Linking everything together...
"C:\\Data\\arduino-1.8.9-windows\\hardware\\tools\\avr/bin/avr-gcc" -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections,--relax -mmcu=atmega2560 -o "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660/mega_ota_test.ino.elf" "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660\\sketch\\mega_ota_test.ino.cpp.o" "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660\\libraries\\arduino-library-wifilink-master\\WiFiClient.cpp.o" "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660\\libraries\\arduino-library-wifilink-master\\WiFiLink.cpp.o" "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660\\libraries\\arduino-library-wifilink-master\\WiFiServer.cpp.o" "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660\\libraries\\arduino-library-wifilink-master\\WiFiUdp.cpp.o" "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660\\libraries\\arduino-library-wifilink-master\\utility\\comm.cpp.o" "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660\\libraries\\arduino-library-wifilink-master\\utility\\server_drv.cpp.o" "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660\\libraries\\arduino-library-wifilink-master\\utility\\spi\\spi_drv.cpp.o" "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660\\libraries\\arduino-library-wifilink-master\\utility\\uart\\serial.cpp.o" "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660\\libraries\\arduino-library-wifilink-master\\utility\\uart\\uart_drv.cpp.o" "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660\\libraries\\arduino-library-wifilink-master\\utility\\wifi_drv.cpp.o" "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660\\libraries\\ArduinoOTA\\InternalStorage.cpp.o" "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660\\libraries\\ArduinoOTA\\InternalStorageAVR.cpp.o" "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660\\libraries\\ArduinoOTA\\InternalStorageESP.cpp.o" "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660\\libraries\\ArduinoOTA\\OTAStorage.cpp.o" "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660\\libraries\\ArduinoOTA\\WiFiOTA.cpp.o" "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660/..\\arduino_cache_760605\\core\\core_my_boards_avr_mega_9923bc213abe6799f546a753821898c4.a" "-LC:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660" -lm
"C:\\Data\\arduino-1.8.9-windows\\hardware\\tools\\avr/bin/avr-objcopy" -O binary "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660/mega_ota_test.ino.elf" "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660/mega_ota_test.ino.bin"
"C:\\Data\\arduino-1.8.9-windows\\hardware\\tools\\avr/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660/mega_ota_test.ino.elf" "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660/mega_ota_test.ino.eep"
"C:\\Data\\arduino-1.8.9-windows\\hardware\\tools\\avr/bin/avr-objcopy" -O ihex -R .eeprom "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660/mega_ota_test.ino.elf" "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660/mega_ota_test.ino.hex"
Multiple libraries were found for "WiFiLink.h"
 Used: C:\Data\Arduino - projekt Spa\libraries\arduino-library-wifilink-master
 Not used: C:\Data\arduino-1.8.9-windows\libraries\arduino-library-wifilink-master
Using library arduino-library-wifilink-master at version 1.1.0 in folder: C:\Data\Arduino - projekt Spa\libraries\arduino-library-wifilink-master 
Using library ArduinoOTA at version 1.0.1 in folder: C:\Data\Arduino - projekt Spa\libraries\ArduinoOTA 
"C:\\Data\\arduino-1.8.9-windows\\hardware\\tools\\avr/bin/avr-size" -A "C:\\Users\\DEVELO~1\\AppData\\Local\\Temp\\arduino_build_958660/mega_ota_test.ino.elf"
Sketch uses 13048 bytes (4%) of program storage space. Maximum is 261120 bytes.
Global variables use 1112 bytes (13%) of dynamic memory, leaving 7080 bytes for local variables. Maximum is 8192 bytes.
C:\Data\arduino-1.8.9-windows\hardware\tools\avr/bin/arduinoOTA -address 172.20.23.100 -port 65280 -username arduino -password -sketch C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_958660/mega_ota_test.ino.bin -upload /sketch -b

something is wrong. there should be 3 more lines.
Connecting ... done
Upload... done
Flashing... done

but the tool ends without error and does nothing

it could be Windows Firewall blocking the outgoing port. try to temporally disable the Windows Firewall

Juraj! I have progress

So the commandline from IDE says

Build options changed, rebuilding all
Sketch uses 13048 bytes (4%) of program storage space. Maximum is 261120 bytes.
Global variables use 1112 bytes (13%) of dynamic memory, leaving 7080 bytes for local variables. Maximum is 8192 bytes.
C:\Data\arduino-1.8.9-windows\hardware\tools\avr/bin/arduinoOTA -address 172.20.23.100 -port 65280 -username arduino -password -sketch C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_958660/mega_ota_test.ino.bin -upload /sketch -b

I saw that the "-password" doesn't contain the actual word 'password'

if I add 'password' after the switch, I get the three lines you mention.
So here's my commands from a regular cmd.exe

C:\Users\Development>C:\Data\arduino-1.8.9-windows\hardware\tools\avr/bin/arduinoOTA -address 172.20.23.100 -port 65280 -username Arduino -password "password" -sketch C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_958660/mega_ota_test.ino.bin -upload /sketch -b
Connecting to board ...  done
Uploading sketch ...  done
Flashing sketch ... Error flashing the sketch

it halts on the 'Flashing sketch' for about 5-10 seconds and then goes to the error

Can you upload over USB as ‚ÄúMega 2560 (Optiboot)‚ÄĚ or as ‚ÄúArduino/Genuino Mega or Mega 2560‚ÄĚ? This gives a clue about the bootloader

my consol when uploading through USB to 'Arduino Mega 2560 (Optiboot)'

Sketch uses 13050 bytes (4%) of program storage space. Maximum is 261120 bytes.
Global variables use 1114 bytes (13%) of dynamic memory, leaving 7078 bytes for local variables. Maximum is 8192 bytes.
C:\Data\arduino-1.8.9-windows\hardware\tools\avr/bin/avrdude -CC:\Data\arduino-1.8.9-windows\hardware\tools\avr/etc/avrdude.conf -v -patmega2560 -carduino -PCOM9 -b115200 -D -Uflash:w:C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_958660/mega_ota_test.ino.hex:i 

avrdude: Version 6.3-20171130
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Data\arduino-1.8.9-windows\hardware\tools\avr/etc/avrdude.conf"

         Using Port                    : COM9
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
         AVR Part                      : ATmega2560
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    10     8    0 no       4096    8      0  9000  9000 0x00 0x00
           flash         65    10   256    0 yes    262144  256   1024  4500  4500 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : Arduino
         Description     : Arduino
         Hardware Version: 3
         Firmware Version: 8.0
         Vtarget         : 0.3 V
         Varef           : 0.3 V
         Oscillator      : 28.800 kHz
         SCK period      : 3.3 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: reading input file "C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_958660/mega_ota_test.ino.hex"
avrdude: writing flash (13050 bytes):

Writing | ################################################## | 100% 1.84s

avrdude: 13050 bytes of flash written
avrdude: verifying flash memory against C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_958660/mega_ota_test.ino.hex:
avrdude: load data flash data from input file C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_958660/mega_ota_test.ino.hex:
avrdude: input file C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_958660/mega_ota_test.ino.hex contains 13050 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 1.36s

avrdude: verifying ...
avrdude: 13050 bytes of flash verified

avrdude done.  Thank you.