will ArduinoIDE still work after flashing a TFTP Bootloader [SOLVED]

Greetings;

After three months of learning (thanks to the incredible support of the Arduino Forum!!), I'm ready to transfer the contraption into my the Pump Room for in-field testing...

I'm retired now and don't have a need for a laptop. ArduinoDroid doesn't seem to work for my Pixel 3A and I don't want to disassemble the box (8 sensors, 6 relays, power, ethernet) from the wall every time I need a firmware upgrdade.

The forum and Google repeatedly point to this bootloader as a viable option for my Arduino Mega 2560 R3

Before I go flashing stuff, will this bootloader still work the regular way on my ArduinoIDE, so I can work on a duplicate board to finetune my programs?

Any tips/tricks
Cheers.

for Mega use GitHub - JAndrassy/ArduinoOTA: Arduino library to upload sketch over network to Arduino board with WiFi or Ethernet libraries

Juraj:
for Mega use GitHub - JAndrassy/ArduinoOTA: Arduino library to upload sketch over network to Arduino board with WiFi or Ethernet libraries

Thanks Juraj;

I tried to run this on a couple of Arduino Mega2560 R3.

I uploaded the sketch OTEthernet via USB, which went ok.

I then added BLINK to the same sketch and tried to upload it via the network (it shows the IP address and the "board name").

It ask me for the password, but, I get the following error message:

Resetting the board
Failed to reset the board, upload failed
Resetting the board
Failed to reset the board, upload failed

One of your posts on Git Hub says that I need to flash the Mega with a new Bootloader, and you point to my-boards.

Before I embark on this project, I just want to make sure I'm flashing the right file:
optiboot_atmega2560.hex...

Is that correct?

I'm going to use an old Uno as the ISP, plenty of instructions on the web, but I'm stomped:

Where do I put optiboot_atmega2560.hex so It gets burned as my bootloader of choice?

Thanks

trilife:
Thanks Juraj;

I tried to run this on a couple of Arduino Mega2560 R3.

I uploaded the sketch OTEthernet via USB, which went ok.

I then added BLINK to the same sketch and tried to upload it via the network (it shows the IP address and the "board name").

It ask me for the password, but, I get the following error message:

Resetting the board

Failed to reset the board, upload failed
Resetting the board
Failed to reset the board, upload failed




One of your posts on Git Hub says that I need to flash the Mega with a new Bootloader, and you point to my-boards.

Before I embark on this project, I just want to make sure I'm flashing the right file: 
optiboot_atmega2560.hex...

Is that correct?

I'm going to use an old Uno as the ISP, plenty of instructions on the web, but I'm stomped:

Where do I put optiboot_atmega2560.hex so It gets burned as my bootloader of choice?

Thanks

if you put my_boards in your sketchbook's hardware folder, you can select "Mega2560 (Optiboot)" and then Burn Bootloader (with programmer or Arduino as ISP). then you must use this board selection for upload over USB.

you have old version of arduinoOTA tool in IDE. install newer version of Arduino AVR or SAMD boards package to get the newer version of the tool.

even without the Optiboot the OTA upload would be successful with the example. only the new binary would not be loaded.

btw before I made AVR support for ArduinoOTA I was using the ariadne bootloader for short time and I had a shell script configured in platform.txt to upload from IDE

I have ArduinoOTA 1.0.3 installed.

I looked for Arduino AVR in the Manage Libraries, but can't find anything like it.

trilife:
I have ArduinoOTA 1.0.3 installed.

I looked for Arduino AVR in the Manage Libraries, but can't find anything like it.

in Tools>Board>Boards Manager

Juraj:
if you put my_boards in your sketchbook's hardware folder, you can select "Mega2560 (Optiboot)" and then Burn Bootloader (with programmer or Arduino as ISP). then you must use this board selection for upload over USB.

you have old version of arduinoOTA tool in IDE. install newer version of Arduino AVR or SAMD boards package to get the newer version of the tool.

even without the Optiboot the OTA upload would be successful with the example. only the new binary would not be loaded.

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

btw before I made AVR support for ArduinoOTA I was using the ariadne bootloader for short time and I had a shell script configured in platform.txt to upload from IDE

OK, So, I think I was successful in burning the new bootloader onto the Mega R3. Not sure, how to verify this was successful.

I managed to upload the OTEthernet sketch on the board successfully and it assigns an IP.

I then add the BLINK to the loop, select Network as the port and hit Upload.

It asks for the password and I get the same error as in #3.

Hmmm...

trilife:
OK, So, I think I was successful in burning the new bootloader onto the Mega R3. Not sure, how to verify this was successful.

I managed to upload the OTEthernet sketch on the board successfully and it assigns an IP.

I then add the BLINK to the loop, select Network as the port and hit Upload.

It asks for the password and I get the same error as in #3.

Hmmm...

and the upload tool version?

and you can add in WiFiOTA.cpp to sendHttpResponse

Serial.print("OTA upload response: ");
Serial.println(status);

to see the response message.

Juraj:
and the upload tool version?

and you can add in WiFiOTA.cpp to sendHttpResponse

Serial.print("OTA upload response: ");
Serial.println(status);

to see the response message.

I'm sorry for the dumb questions: Where do I find the upload tool version? are you referring to the one executed when you push the -> button in the ArduinoIDE?

/*

 This example polls for sketch updates over Ethernet, sketches
 can be updated by selecting a network port from within
 the Arduino IDE: Tools -> Port -> Network Ports ...

 Circuit:
 * W5100, W5200 or W5500 Ethernet shield attached

 created 13 July 2010
 by dlf (Metodo2 srl)
 modified 31 May 2012
 by Tom Igoe
 modified 16 January 2017
 by Sandeep Mistry
 Ethernet version August 2018
 by Juraj Andrassy
 */
 
#include <SPI.h>
#include <Ethernet.h>
#include <ArduinoOTA.h>
#include <WiFiOTA.cpp>
//#define Serial SerialUSB

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xEE };

void setup() {
  //Initialize serial:
  Serial.begin(115200);

  // start the Ethernet connection:
  Serial.println("Initialize Ethernet with DHCP:");
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
  } else {
    Serial.print("  DHCP assigned IP ");
    Serial.println(Ethernet.localIP());
  }

  // start the OTEthernet library with internal (flash) based storage
  ArduinoOTA.begin(Ethernet.localIP(), "Orientes", "I5tanbul", InternalStorage);
    pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  // check for updates
  ArduinoOTA.poll();
  Serial.print("OTA upload response: ");
  Serial.println(status);
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
  // add your normal loop code below ...
}

I added #include <WiFiOTA.cpp> and the code snipped you suggested in the OTEthernet sketch.

It doesn't compile

exit status 1
'status' was not declared in this scope

.
I did make sure that platform.local.txt is saved in the hardware/arduino/avr directory, next to platform.txt. Same result. (the /Arduino15/ in my User directories doesn't exist. It used to exist in ArduinoIDE 1.8.12, but disappeared when we switched to x13, I believe, after that global crash of ArduinoIDE a few weeks ago)

I tried different Mega 2560s, same result.

Thanks for your continued assistance

yes the tool used by IDE for OTA upload (upload with network port selected). it is called arduinoOTA and is installed with IDE or boards packages. latest IDE should have the latest ArduinoOTA version.

sorry, WiFiOTA.cpp is one of the source files of the library. you can modify it to see the upload result (because the upload tool doesn't show it exactly)

Hello Juraj;

Ok, so I added the print statements into the WiFiOTA.

Problem is, when the PORT is selected to go to the network, the Serial Monitor isn't available.

I ran it anyway, in Port mode, but the same error message persists:

Resetting the board
Failed to reset the board, upload failed

BTW, is there a way to confirm which bootloader is on a board?

Cheers.

trilife:
Hello Juraj;

Ok, so I added the print statements into the WiFiOTA.

Problem is, when the PORT is selected to go to the network, the Serial Monitor isn't available.

I ran it anyway, in Port mode, but the same error message persists:

Resetting the board

Failed to reset the board, upload failed




BTW, is there a way to confirm which bootloader is on a board?

Cheers.

you can run the IDE twice. select com port in the second instance.

if you can upload to "Mega 2560 (Optiboot)" then you have Optiboot.

I'm sorry Juraj;

This is what I'm doing:

1-Select USB port
2-Compile+Upload OTEthernet (-> button)
3-close and reopen IDE, so IDE recognizes Network Port
4-Select Network Port
5-Add BLINK to OTEthernet, so I can tell that the upload actually worked
6-Compile/Upload OTEthernet BLINK

I am asked for Password and it fails.

7-Select USB Port
8-click on Serial Monitor button, top left

The board seemingly resets and the Serial Monitor shows:

14:20:07.698 -> Initialize Ethernet with DHCP:
14:20:08.390 -> DHCP assigned IP 192.168.10.101

there's no printout from WiFiOTA.

While waiting for your response, I integrated tft screen into WiFiOTA (in the sendHttpResponse, after the Serial.print) , so I can print the status on the TFT screen. It prints nothing. This would mean it never executes sendHttpResponse, I tried to turn on an LED and see, if it at least does that. still nothing.

the print from WiFiOTA is before reset

WiFiOTA prints nothing and doesn't turn on the LED. It seemingly never gets called

I think you still have the old version of the upload tool.
check %userprofile%\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA

Hi Juraj.

As I mentioned earlier - when you suggested that I have an old version - that Arduino15 branch doesn't exist on computer.

I did a complete reinstall of the IDE a few weeks ago, when .12 crashed globally. I erased everything related to Arduino from my computer at that time. I'm now on .13 and, when I checked yesterday, Arduino15 didn't exist anymore.

According to the library installer, I'm on 1.0.3 of the ArduinoOTA.

in IDE, go to Preferences. at the bottom of the Preferences window, there is a location of the preferences file. click it. it will open the Arduino15 folder.

1.0.3 is the version of the ArduinoOTA library, not the version of the arduinoOTA upload tool.

Juraj:
in IDE, go to Preferences. at the bottom of the Preferences window, there is a location of the preferences file. click it. it will open the Arduino15 folder.

Thanks Juraj;

Following your steps, it takes me Users/xx/Documents/ArduinoData.

Following it all the way to ArduinoOTA, i get to 1.3.0. the arduinoOTA file in there was modified 12 Dec 2018.

Where do I find the new one, if this is the old one?

trilife:
Thanks Juraj;

Following your steps, it takes me Users/xx/Documents/ArduinoData.

Following it all the way to ArduinoOTA, i get to 1.3.0. the arduinoOTA file in there was modified 12 Dec 2018.

Where do I find the new one, if this is the old one?

1.3.0 is latest

open the the IDE twice. use Serial Monitor in one f them to see the upload response message from the print in WiFiOTA.cpp. upload to network port from the second.