Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
anklimov opened this issue May 23, 2020 · 17 comments
Open

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

anklimov opened this issue May 23, 2020 · 17 comments
Labels
help wanted Extra attention is needed

Comments

@anklimov
Copy link
Contributor

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

@JAndrassy
Copy link
Owner

JAndrassy commented May 23, 2020

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

@anklimov
Copy link
Contributor Author

anklimov commented May 24, 2020

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.

@JAndrassy
Copy link
Owner

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 JAndrassy added the help wanted Extra attention is needed label Jun 1, 2020
@gcharles81
Copy link

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

@anklimov
Copy link
Contributor Author

anklimov commented Aug 23, 2020

@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

@gcharles81
Copy link

@anklimov Thanks will use your fork

@gcharles81
Copy link

gcharles81 commented Aug 23, 2020

@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

@anklimov
Copy link
Contributor Author

@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?

@gcharles81
Copy link

@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
Copy link

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

@anklimov
Copy link
Contributor Author

@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?

@gcharles81
Copy link

@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

@StybiPL
Copy link

StybiPL commented Feb 14, 2021

@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

@nanitook
Copy link

nanitook commented May 8, 2022

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

@anklimov
Copy link
Contributor Author

anklimov commented May 8, 2022

@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

@nanitook
Copy link

nanitook commented May 8, 2022

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?

@anklimov
Copy link
Contributor Author

anklimov commented May 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants