Mega with built in ESP8266 OTA

I've followed the impressive work of Juraj Andrássy and have had mild success trying to OTA with the mega that has on board ESP8266. The board connects to my wifi, I can ping it but when I try to upload using a command line (I can't seem to add the board to my IDE via wifi) I see the following message:

Connecting to board ... done
Uploading sketch ... done
Flashing sketch ... Error flashing the sketch

It seems that as soon as the bulk of the data tries to transfer via wifi the mega or the ESP resets and all hope is lost.

Am using latest ArduinoOTA, WiFiEspOTA, MegaCore ATMega2560 and I flashed the ESP to V1.7 with ESP8266_NONOS_SDK-3.0.4 using the settings below. I'm hoping someone cleverer than me might be able to help?

https://github.com/JAndrassy/ArduinoOTA?tab=readme-ov-file#troubleshooting

Thank you for your help I have made some progress. The Arduino doesn't reset during upload but after 10 seconds it stops flashing.

I read your comment to add a "-t" instruction but I can't find out where that goes.

I apologise for my incompetence it's probably obvious to most but it would really help if you can show me where in platform.local.txt it should be.

thank you

did you turn on console verbose mode in IDE Preferences?

I can't get the arduino to appear in my IDE, have tried almost everything. I can ping it from the command line but I'm lost beyond that.

So I'm using command line to upload which could be the problem:
arduinoOTA -address 192.168.0.107 -port 65280 -username arduino -password password -sketch "C:\Users\User\AppData\Local\Temp\arduino_build_656199/OTA-TEST-FIXED.ino.with_bootloader.bin" -upload /sketch

It does try to upload, and lasts exactly 10 seconds

image

don't upliad 'with_bootloader' version of the binary.

Thank you I must be nearly there,

Connecting to board ... done
Uploading sketch ... done
Flashing sketch ... done - // - success!
Error flashing the sketch:Unauthorized - // - not so good

my sketch:
ArduinoOTA.begin(WiFi.localIP(), "Arduino", "password", InternalStorage);

My CIL:
arduinoOTA -address 192.168.0.107 -port 65280 -username "Arduino" -password "password" -sketch "C:\Users\User\AppData\Local\Temp\arduino_build_983009/OTA-TEST-FIXED.ino.bin" -upload /sketch

I will paste my platform.local.txt, this must be my syntax problem:

This configuration file supports the general ArduinoOTA library GitHub - JAndrassy/ArduinoOTA: Arduino library to upload sketch over network to Arduino board with WiFi or Ethernet libraries

Create output (bin file)

recipe.objcopy.bin.pattern="{compiler.path}{compiler.elf2hex.cmd}" -O binary {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin"

tools.avrdude.network_cmd={runtime.tools.arduinoOTA.path}/bin/arduinoOTA
tools.avrdude.upload.network_pattern="{network_cmd}" -address {ip} -port 65280 -username "arduino" -password "password" -sketch "{build.path}/{build.project_name}.bin" -upload /sketch -b

#IDE 2
upload.tool.network=arduino_ota
tools.arduino_ota.cmd={runtime.tools.arduinoOTA.path}/bin/arduinoOTA
tools.arduino_ota.upload.field.password=Password
tools.arduino_ota.upload.field.password.secret=true
tools.arduino_ota.upload.pattern="{cmd}" -address {serial.port} -port 65280 -username arduino -password "{upload.field.password}" -sketch "{build.path}/{build.project_name}.bin" -upload /sketch -b

arduinoOTA as programmer. add entries with {ip} into programmers.txt

tools.arduinoOTA.cmd={runtime.tools.arduinoOTA.path}/bin/arduinoOTA
tools.arduinoOTA.program.params.verbose=
tools.arduinoOTA.program.params.quiet=
tools.arduinoOTA.program.pattern="{cmd}" -address {ip} -port 65280 -username arduino -password password -sketch "{build.path}/{build.project_name}.bin" -upload /sketch -b

arduinoOTA104.name=Arduino OTA (192.168.0.107)
arduinoOTA104.program.tool=arduinoOTA
arduinoOTA104.program.tool.default=arduinoOTA
arduinoOTA104.ip=192.168.0.107

remove the "" from the password

I've tried all possible password and username possibilities with and without ""
Unless the passwords match with the syntax I'm using it will fail at the flashing stage.
Only when they are as I have them does the flash succeed and lead onto an authorisation failure.
Flashing sketch ... done
Error flashing the sketch:Unauthorized

Is there something clever with the optiboot flashing that I've missed? Could there be something in the sketch it doesn't like? Are there security settings on my wifi that intefere? Has anyone suceeded with OTA with this robotdyn-mega-onboard-ESP8266?

try

arduinoOTA -address 192.168.0.107 -port 65280 -username arduino -password password -sketch "C:\Users\User\AppData\Local\Temp\arduino_build_983009/OTA-TEST-FIXED.ino.bin" -upload /sketch