ArduinoOTA icon indicating copy to clipboard operation
ArduinoOTA copied to clipboard

Support for Arduino DUE (Atmel SAM3X8E ARM Cortex-M3)

Open anklimov opened this issue 5 years ago • 17 comments

Hi! Is it possible to extend OTA support for Atmel SAM3X8E ARM Cortex-M3 ? The architecture is quite similar with already supported platforms and from the first look, it should be possible to do, but lays behind my skills I will appreciated for any kind help or advises

anklimov avatar May 23 '20 16:05 anklimov

best example of flash operations is for any MCU architecture the eeprom emulation library. https://github.com/PhiJu5/DueFlashStorage

details are in the datasheet of the MCU. https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-11057-32-bit-Cortex-M3-Microcontroller-SAM3X-SAM3A_Datasheet.pdf

InternalStorage.cpp should be enhanced for ARM MCUs

JAndrassy avatar May 23 '20 17:05 JAndrassy

Thank you for direction for investigations I've just added SAM3X8E to Internal storage Currently it was compiled successfully.

UPDATE: Now i'm trying to test it

I've find arduinoOTA tool in Arduino IDE distribution, it becomes at least, starting and connecting to lib after update to recent IDE release

(Other OTA flashing tools ether "ESP oriented" (espota) or didn't understand OTA: the usual DUE flasher "bossac" )

So Arduino IDE itself, even not trying to start arduinoOTA, starting bossac instead.

Have you idea to integrate ArduinoOTA to PlatformIO framework? This might be optimal way to use it across all supported platforms.

anklimov avatar May 24 '20 18:05 anklimov

for Arduino IDE setup arduinoOTA in platform.local.txt similar to this https://github.com/jandrassy/ArduinoOTA/blob/master/extras/avr/platform.local.txt

JAndrassy avatar May 24 '20 19:05 JAndrassy

Hello I would like to know id @anklimov managed to get it working on Arduino DUE Thanks

gcharles81 avatar Aug 23 '20 08:08 gcharles81

@gcharles81 - yes, it working pretty well. PR is not merged here (some cleanup needed, but I still out of time to manage it), but you can try my fork of ArduinoOTA... Also will be good if smbdy find some time to clean & merge DUE OTA to upstream

anklimov avatar Aug 23 '20 10:08 anklimov

@anklimov Thanks will use your fork

gcharles81 avatar Aug 23 '20 15:08 gcharles81

@anklimov

Hello I am testing your fork and managed to get it working with Arduino IDE & Command line I encountered an issue only with .bin file that has a size of 165kb while it is working fine with a .bin file of 30kb

below is serial output for one successful and one fail upload

Successful Erase flash

Received bytes:30000 Flashing bytes:30000 From:C0000 To:80000 PageSize:256


Failed

Erase flash

Received bytes:130855

gcharles81 avatar Aug 23 '20 20:08 gcharles81

@gcharles81 - thanks for testing, but result is little bit unexpected. In my case, lib working against 139680 bytes binary The maximum firmware size is 50% of flash. Did you use SAM3X8E with 512K flash?

anklimov avatar Aug 23 '20 20:08 anklimov

@anklimov Thanks its also strange to me Yes I use SAM3X8E

Today I try ti did a bit deeper and modified in WiFiOTA.cpp the sendHttpResponse function and I add there a Serial.println(status) ; So I get a better understanding what is failing

The message I get on the Serial monitor after the fail is Payload size wrong , I have to google a bit maybe I find something

Open flash for write

Erase flash

Received bytes:126759 Payload size wrong

gcharles81 avatar Aug 24 '20 18:08 gcharles81

Solved Issue by using Baud rate of 250000 instead of 115200 , now I can upload sucsessfully

gcharles81 avatar Aug 24 '20 19:08 gcharles81

@gcharles81 - as far as firmware upload going through LAN connection, not thought serial, that is not looks like root cause of failures. May you share more details?

anklimov avatar Aug 30 '20 13:08 anklimov

@anklimov - In my case I am using ESP-01 connected via serial to my Arduino DUE and using WiFiEspAT library that is why was failing with 115200 Baud.

Why it was failing I do not know maybe some sort of timeout. Thanks Charles

gcharles81 avatar Aug 30 '20 17:08 gcharles81

@anklimov Your fork works perfectly on Ethernet Shield V1

If you want to upload sketches directly from Arduino IDE place my platform.local.txt to PREFERENCES_FOLDER\packages\arduino\hardware\sam\1.6.12

# This configuration file supports the general ArduinoOTA library https://github.com/jandrassy/ArduinoOTA

## arduinoOTA as programmer. add entries with {ip} into programmers.txt
tools.bossac.network_cmd={runtime.tools.arduinoOTA.path}/bin/arduinoOTA
tools.bossac.upload.network_pattern="{network_cmd}" -address {serial.port} -port 65280 -username arduino -password password -sketch "{build.path}/{build.project_name}.bin" -upload /sketch -b

StybiPL avatar Feb 14 '21 15:02 StybiPL

Any updates on this? Is @anklimov 's fork working for OTA updates from http servers?

nanitook avatar May 08 '22 18:05 nanitook

@nanitook - my fork have basic logic, derived from @JAndrassy ' s project - sketch act as http server, not client (you need POST firmware to controller using external routine) Only differences of my fork:

  • Working with DUE
  • Possible to re-use http server for extend OTA API
  • Some abstractions added to GET/POST files/another persistent data sharing same OTA API

anklimov avatar May 08 '22 19:05 anklimov

sketch act as http server, not client (you need POST firmware to controller using external routine)

I'm talking about something like this. Downloading the new sketch from a remote http server and make the upgrade. If that's not possible, the only way to upgrade using OTA is using the arduino IDE?

nanitook avatar May 08 '22 19:05 nanitook

Hello The provided example is quite relevant. It should be possible to use InternalStorage to upgrade FW, retrieved from any source. NB - the example using ESP http(s) libs. If you will migrate this on another platform - some effort required here and not every platform is supported https.

Andrey Klimov

8 мая 2022 г., в 22:59, nanitook @.***> написал(а):

 sketch act as http server, not client (you need POST firmware to controller using external routine)

I'm talking about something like this. Downloading the new sketch from a remote http server and make the upgrade. If that's not possible, the only way to upgrade using OTA is using the arduino IDE?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.

anklimov avatar May 11 '22 09:05 anklimov