TFTP problem with Nick Gammon bootloader on mega 2560

Hi, the error message is below, the password message does not appear any more. The board was powered by another computer through the usb interface. i changed that and now it is powered from an external supply. I can ping the board but impossible to upload.
I'm using the Arduino Mega 2560 optiboot as board and Arduino OTA (Ip...) as programmer
Actually it seems to come from the com port...
Thank you

Arduino : 1.8.12 (Windows 10), Carte : "Arduino Mega 2560 (Optiboot)"

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

System wide configuration file is "C:\Users\me\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

Using Port : COM6
Using Programmer : arduino
Overriding Baud Rate : 115200
avrdude: ser_open(): can't open device "\.\COM6": Le fichier sp�cifi� est introuvable.

Problème de téléversement vers la carte. Voir http://www.arduino.cc/en/Guide/Troubleshooting#upload pour suggestions.

you don’t have a network port in Port menu?

I saw a com port during a few minutes and it disappeared during the tests, i can’t get it anymore.
I don’t know what caused this …
Do you know how i can repair that ?

upload the OTEthernet example over USB

then check if you have the network port "Arduino at "

Did it but nothing. I’m going to uninstall the boards and examples in the library and see if something change

koal01:
Did it but nothing. I’m going to uninstall the boards and examples in the library and see if something change

and did the example print an IP address?

Yes i can see a dhcp address in the monitor 192.168.4.39
But nothing in the com port

koal01:
Yes i can see a dhcp address in the monitor 192.168.4.39
But nothing in the com port

ok. this is common. for that reason I created the OTA 'programmer'. but you must change the IP address in programmers.txt.
then restart the IDE
then to upload, select the OTA 'programmer' and use "Upload using programmer" in Sketch menu.

(is your computer on the same network?)

Juraj, i can now upload through the network using the menu "upload using programmer". Thanks !
I can upload the OTethernet example and repeat uploads indefinitely.
But when i upload my program i can upload it just one time. I can ping the board but when i want to upload a second time the program can not connect to the board.
Your program is listening to the 65280 port and my application is using the port 9999.
So i changed in platform.txt the port number setting it to 9999. When i launch the upload i can see in the IDE that it connects to the board, the sketch is uploaded but an error appears saying it can't erase the flash.
Do you have an idea to solve that ?
Thank you

koal01:
Juraj, i can now upload through the network using the menu "upload using programmer". Thanks !
I can upload the OTethernet example and repeat uploads indefinitely.
But when i upload my program i can upload it just one time. I can ping the board but when i want to upload a second time the program can not connect to the board.
Your program is listening to the 65280 port and my application is using the port 9999.
So i changed in platform.txt the port number setting it to 9999. When i launch the upload i can see in the IDE that it connects to the board, the sketch is uploaded but an error appears saying it can't erase the flash.
Do you have an idea to solve that ?
Thank you

copy the upload tool messages here

The message is below Juraj, thank you

Arduino : 1.8.12 (Windows 10), Carte : "Arduino Mega 2560 (Optiboot)"

"C:\Users\me\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5/bin/avr-size" -A "C:\Users\me\AppData\Local\Temp\arduino_build_502727/OTEthernet.ino.elf"
Le croquis utilise 21382 octets (8%) de l'espace de stockage de programmes. Le maximum est de 261120 octets.
Les variables globales utilisent 1184 octets (14%) de mémoire dynamique, ce qui laisse 7008 octets pour les variables locales. Le maximum est de 8192 octets.
C:\Users\me\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0/bin/arduinoOTA -address 192.168.4.39 -port 9999 -username arduino -password password -sketch C:\Users\me\AppData\Local\Temp\arduino_build_502727/OTEthernet.ino.bin -upload /sketch -b
Connecting to board ... done
Uploading sketch ... done
Flashing sketch ... done
Error flashing the sketch
Error flashing the sketch

and is it done? the upload tool's timeout is sometimes too short.
to debug, you can add
Serial.println(status);
in
WiFiOTA.cpp in sendHttpResponse function

why did you change the port?

The Serial.println(status) is already present in the sendHttpResponse function of WIFIOTA.cpp

void WiFiOTAClass::sendHttpResponse(Client& client, int code, const char* status)
{
while (client.available()) {
client.read();
}

client.print("HTTP/1.1 ");
client.print(code);
client.print(" ");
client.println(status);
client.println("Connection: close");
client.println();
delay(500);
client.stop();
}

Juraj:
why did you change the port?

I changed it because with the default port 65280 the connexion seems impossible, the app i'm trying to upload is listening to the port 9999. When i change this in the platform.txt file, it's better since the connexion to board, the uploading sketch and flashing sketch seem to work with the status done as shown at the end of the upload message. But just after i can read the error message "Error flashing the sketch..."

Juraj:
and is it done? the upload tool's timeout is sometimes too short.

No the upload is stopped and not written in the flash
It's interesting, how can increase the value ?

Thank you for your help

I don’t see a Serial.println there.
the ArduinoOTA library server listens at 65280.

I inserted in sendHttpResponse function
Serial.println(status);
just before
client.print("HTTP/1.1 ");

but i don't see more details through usb or ethernet, where am i suppose to get information about this status ?

I'm uploading OTEthernet through the normal port 65280.
I upload my program one time with the same port and then impossible to upload it again
Sorry

Maybe there is a parameter to extend the timeout, i'm looking for it

koal01:
I inserted in sendHttpResponse function
Serial.println(status);
just before
client.print("HTTP/1.1 ");

but i don't see more details through usb or ethernet, where am i suppose to get information about this status ?

I'm uploading OTEthernet through the normal port 65280.
I upload my program one time with the same port and then impossible to upload it again
Sorry

it prints to Serial Monitor of course. it prints a simple OK on success.

The only sketch i can upload is the example OTethernet.
When i try another sketch it fails, it can not connect to the board, that make think it's a problem of port listening.
Is there a way to force OTethernet to flash the mega remotely even when another a program is running on the board ?

koal01:
The only sketch i can upload is the example OTethernet.
When i try another sketch it fails, it can not connect to the board, that make think it's a problem of port listening.
Is there a way to force OTethernet to flash the mega remotely even when another a program is running on the board ?

ArduinoOTA is a library. the OTEthernet example shows how to use it.

do you see OK in Serial Monitor with the Serial.println(status);

In the monitor after having inserted Serial.println(status) i can see the dynamic ip, nothing else.

There is no OK