Coder Social home page Coder Social logo

Comments (32)

chrise96 avatar chrise96 commented on July 28, 2024

@ivankravets

Still no luck with debugging the Arduino zero. So, I made a video to clarify the issue.

https://youtu.be/VsR1WFR9vbw

Arduino Zero (sam-ba) upload session erases bootloader

zeroUSB is working

from platform-atmelsam.

PatrikSB avatar PatrikSB commented on July 28, 2024

I have the same problem as described above.
Bootloader needs to be re-burned from arduino IDE for the board to work again.

from platform-atmelsam.

ivankravets avatar ivankravets commented on July 28, 2024

It's already fixed on my local machine. I'll deploy fix this week. We are working on the very interesting feature for Arduino Zero/M0 Pro :)

from platform-atmelsam.

PatrikSB avatar PatrikSB commented on July 28, 2024

Cool! :) Was it a big fix? Possible to describe it, so I can get the environment up and running sooner? :P

from platform-atmelsam.

ivankravets avatar ivankravets commented on July 28, 2024

Ok, will try to deploy changes today :)

from platform-atmelsam.

PatrikSB avatar PatrikSB commented on July 28, 2024

Thank you so much! :D

from platform-atmelsam.

ivankravets avatar ivankravets commented on July 28, 2024

Please re-test current development branch:

  • Uninstall existing development platform pio platform uninstall atmelsam
  • Install development version pio platform install https://github.com/platformio/platform-atmelsam.git

from platform-atmelsam.

chrise96 avatar chrise96 commented on July 28, 2024

Followed the steps you mentioned and initialized a new project. Sadly, the fix is not working. Output of the last lines uploading in verbose mode:

Error: at91samd21g18.cpu -- clearing lockup after double fault
target halted due to debug-request, current mode: Handler HardFault
xPSR: 0x61000003 pc: 0xfffffffe msp: 0xffffffd8
shutdown command invoked

So, after uploading, the bootloader will be wiped. The Arduino Zero .cc version is using the SAM-BA bootloader (for USB and UART interfaces). To use SAM-BA together with an application, we need to link the application starting at 0x2000.

Tried this in boards.txt, location SAMD package. But, no luck:

arduino_zero_edbg.bootloader.size=0x2000

from platform-atmelsam.

ivankravets avatar ivankravets commented on July 28, 2024
  1. Please note that we have 2 different configuration profiles for Arduino Zero:
    • zero - you have to use Programming/Debug port
    • zeroUSB - you have to use USB port to program a board
  2. Please share on http://pastebin.com a full output of build+upload process from Arduino IDE. You can enable it via Arduino IDE > Settings > Verbose mode for build/upload
  3. Process project with PIO in verbose mode via pio run -t upload -v and share these results on http://pastebin.com too.

We will compare both outputs and check what is wrong. Thanks!

from platform-atmelsam.

chrise96 avatar chrise96 commented on July 28, 2024

Arduino IDE:
https://pastebin.com/60cDtrtM

PlatformIO:
https://pastebin.com/5m3BnmLr

from platform-atmelsam.

ivankravets avatar ivankravets commented on July 28, 2024

Could you run PIO with --verbose flag?

If you use PIO IDE, please open src/blink.ino, then PIo IDE Terminal and run

pio run -t upload -v

from platform-atmelsam.

chrise96 avatar chrise96 commented on July 28, 2024

platformio run -e zero -t upload -v
https://pastebin.com/qtrMcJsr

from platform-atmelsam.

ivankravets avatar ivankravets commented on July 28, 2024

Could you try again to flash board using Arduino IDE and then PIO?

Take a look at 22 line here. We don't erase your bootloader now.

from platform-atmelsam.

chrise96 avatar chrise96 commented on July 28, 2024

pio run -t upload -v
https://pastebin.com/3zkv66bh

from platform-atmelsam.

chrise96 avatar chrise96 commented on July 28, 2024

I copied the complete SAMD package version 1.6.14 from Arduino in the right locations of ~/.platformio/packages/framework-arduinosam and still the same issue.

This looks different from the Arduino output.
Warn : Adding extra erase range, 00000000 to 0x00001fff

from platform-atmelsam.

perception-aweichman avatar perception-aweichman commented on July 28, 2024

Any resolution to this? I'm having this issue as well. I can support debugging if anyone is still available to help resolve this.

from platform-atmelsam.

chrise96 avatar chrise96 commented on July 28, 2024

No, I haven't fixed it with PlatformIO so used the Arduino IDE build and upload paths in Eclipse: https://www.youtube.com/watch?v=FRecvWhprhs&t=30s

http://forum.arduino.cc/index.php?topic=477415.0

from platform-atmelsam.

perception-aweichman avatar perception-aweichman commented on July 28, 2024

So after digging more, I think this is a change in the OpenOCD. I had this process working back in December of 2016, but it looks like there was a new version of openocd in January. The root cause of this seems to be that openocd is erasing the 0-0x1fff block of flash in addition to the 0x2000 and above area where the program is expecting to be placed. We may be able to solve this with a linker command to place the compiled code at address 0. I'll keep digging into how we can fix this.

from platform-atmelsam.

ivankravets avatar ivankravets commented on July 28, 2024

Could someone provide VERBOSE output of

pio run --verbose -t upload

Thanks!

from platform-atmelsam.

perception-aweichman avatar perception-aweichman commented on July 28, 2024

sure ivankravets. Do you need the whole run or just the last few lines? Here are the relevant compile and flash lines:
https://pastebin.com/mQgYFpEL

Note the following:
line 4: verify reset 0x2000; shutdown"
line 29: Warn : Adding extra erase range, 00000000 to 0x00001fff

from platform-atmelsam.

perception-aweichman avatar perception-aweichman commented on July 28, 2024

Also, I just confirmed that if I program with PIO, then reprogram the bootloader with the arduino IDE, the program works as expected.

from platform-atmelsam.

ivankravets avatar ivankravets commented on July 28, 2024
  1. Please restore bootloader with Arduino IDE
  2. Try to edit ~/.platformio/packages/framework-arduinosam/variants/arduino_zero/openocd_scripts/arduino_zero.cfg
source [find interface/cmsis-dap.cfg]

# chip name
set CHIPNAME at91samd21g18
set ENDIAN little

# choose a port here
set telnet_port 0

at91samd bootloader 8192

source [find target/at91samdXX.cfg]
  1. Upload firmware with PIO.

Does it work?

from platform-atmelsam.

perception-aweichman avatar perception-aweichman commented on July 28, 2024

openocd doesn't seem to recognize the at91samd command:

GNU ARM Eclipse 64-bits Open On-Chip Debugger 0.10.0-00114-g84195369 (2017-04-19-00:49)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
/Users/user/.platformio/packages/framework-arduinosam/variants/arduino_zero/openocd_scripts/arduino_zero.cfg:30: Error: invalid command name "at91samd"
in procedure 'script'
at file "embedded:startup.tcl", line 60
at file "/Users/user/.platformio/packages/framework-arduinosam/variants/arduino_zero/openocd_scripts/arduino_zero.cfg", line 30
*** [upload] Error 1

Also on pastebin:
https://pastebin.com/caqKB5Py

from platform-atmelsam.

valeros avatar valeros commented on July 28, 2024

Hi @perception-aweichman !
Could you please try to restore your board to the default state (with bootloader) and then upload the blink sketch with this environment:

[env:zero]
platform = atmelsam
board = zero
framework = arduino
upload_flags = -d3 --log_output log.txt

And after programming please upload log.txt to pastebin.com. Thanks!

from platform-atmelsam.

perception-aweichman avatar perception-aweichman commented on July 28, 2024

Sorry for the delay. Here is the log (I removed some PII from it before uploading).

It appears to be too large for pastebin... I'll just attach it here instead....
log.txt

from platform-atmelsam.

perception-aweichman avatar perception-aweichman commented on July 28, 2024

Also, as a side note, I have a MKRZero (which is based on the same ATMELSAM framework) that doesn't have this same issue. It flashes with PIO and runs just fine afterward. It may not have the same bootloader structure as the Zero though.

from platform-atmelsam.

perception-aweichman avatar perception-aweichman commented on July 28, 2024

Any progress on this? Anything I can do to assist the debugging?

from platform-atmelsam.

ivankravets avatar ivankravets commented on July 28, 2024

@perception-aweichman please mail [email protected] for further details

from platform-atmelsam.

ivankravets avatar ivankravets commented on July 28, 2024

Please update development platform to v2.2.0 (pio update). Does it work now?

from platform-atmelsam.

ivankravets avatar ivankravets commented on July 28, 2024

Please create a new issue if you have a problem.

from platform-atmelsam.

ivankravets avatar ivankravets commented on July 28, 2024

Finally! We have fixed all issues with Arduino Zero. Please update to 2.6.0:

from platform-atmelsam.

ivankravets avatar ivankravets commented on July 28, 2024

Guys, we have made a huge update to Atmel SAM dev/platform. Integrated popular debuggers, custom upload tools/protocols, etc.

Could you re-test the latest UPSTREAM version with Arduino Zero?

We don't have this board and see that it is very specific. We updated openOCD to 0.10.0 and maybe it will not work with Arduino Zero. Please try both ports: USB Native and Programming.

Thanks!

/cc @chrise96 @perception-aweichman @PatrikSB

from platform-atmelsam.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.