JAndrassy / ArduinoOTA

Arduino library to upload sketch over network to Arduino board with WiFi or Ethernet libraries
GNU Lesser General Public License v2.1
435 stars 89 forks source link

Success response but sketch is not replaced using Mega OTA #248

Closed mcerqueira1509 closed 3 months ago

mcerqueira1509 commented 3 months ago

Hello, I got a mega2560 with optiboot (using my_boards), and the sketch using: ArduinoOTA.begin(Ethernet.localIP(), "arduino", "password", SDStorage);

using mega 2560 with ethernet shield (with sd in the ethernet shield)

about the sd bootloader: before upload the old sketch I used USBasp as programmer choose my_boards_avr -> Arduino Mega 2560 (Optiboot) and burn bootloader then I unplugged USBasp connect the board using the usb cable and upload the old sketch (ATmega_SD.ino example) the board is connected with the ethernet cable

after that I can see the board with IP in the IDE after I select the remote target, I get: Sketch uses 28422 bytes (10%) of program storage space. Maximum is 261120 bytes. Global variables use 1822 bytes (22%) of dynamic memory, leaving 6370 bytes for local variables. Maximum is 8192 bytes. Connecting to board ... done Uploading sketch ... done Flashing sketch ... done OK Sketch uploaded successfully

but the board resets and the new sketch is not running. after manual reset board still running the old sketch.

JAndrassy commented 3 months ago

what is this?

ArduinoOTA.begin(Ethernet.localIP(), "arduino", "password", SDStorage);

if you use SDStorage , you need some SD bootloader, not Optiboot. I use zevero/avr_boot

mcerqueira1509 commented 3 months ago

Ok, thank you. So that is what I was not getting right. installing zevero/avr_boot

Question: when I burn the bootloader the sketch gets erased with the sd bootloader can I upload sketch using usb cable ?

JAndrassy commented 3 months ago

with the sd bootloader can I upload sketch using usb cable ?

no. zevero's avr_boot doesn't support USB upload. you can then only put the update on the SD card or OTA upload it

mcerqueira1509 commented 3 months ago

is there a way to work using both?

JAndrassy commented 3 months ago

no. I attempted to update it, but was not successful. I didn't try really hard because I didn't really need it. I don't have a computer near the project so if OTA fails it is simpler to take the SD card, put it into the computer and copy the update bin.

But I use Atmega1284p which has only half as flash size than Mega. Why you don't use IntenalStorage?

mcerqueira1509 commented 3 months ago

I got it working using internal storage downloading the hex file, just think is easier using the IDE... but will consider the trade offs.

JAndrassy commented 3 months ago

InternalStorage works with upload from IDE too

mcerqueira1509 commented 3 months ago

thanks for the clarifications