Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 8 Replies) Arduino ZERO with Atmel ICE (upload and Debug) (Read 4031 times)
Marco (Italy)
Full Member
***
Offline


Posts: 165
Joined: Jul 12th, 2019
Arduino ZERO with Atmel ICE (upload and Debug)
Apr 11th, 2021 at 2:33pm
Print Post  
Hi!
I'm testing the Arduino zero with Atmel ICE connected to SWD connector using SWDIO and SWDCLK signals. The situation find is the following:
1. VM can see Atmel USB connection and can upload all software without any error.
2. But at the end of upload the board doesn't start!!!

so,

A) I have try to connect the native USB to visual micro and try to upload the same code but selecting: USB serial, no programming, but the code is not uploaded and VM doesn't see the native USB port.

so,

B)With this error on the board Zero I have try to connect the board to Arduino IDE, selecting on IDE menu: write bootloader via Atmel ICE, the bootloader Zero is uploaded without any problems. 

C)At this point I have reconnected the arduino board, via native USB and VM and then, now VM can see the USB connection and can upload all code without error.


Question: is there a issue during the upload via SWD interface using the Atmel ICE? 


Could be possible that the bootloard is erased during the Atmel ICE uploading phase? If yes, is possible to solve this issue adding the bootloader + user code during the same uploading sassin ? Or not deleting the bootloader stoed on ZERO during the upload phase?

thanks!
Smiley



 


  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino ZERO with Atmel ICE (upload and Debug)
Reply #1 - Apr 11th, 2021 at 7:16pm
Print Post  
It is standard that all programmer uploads destroy the bootloader. 

Did you try to burn a bootloader using Visual Micro?

You appear to have tried different things in each IDE so it is difficult to comment.

The Arduino IDE upload does not use the selected programmer unless you click the option that says "Upload using programmer"

The Arduino Zero has programmer and GDB debug built in, therefore I am not sure there is any benefit to using a programmer.
  
Back to top
WWW  
IP Logged
 
Marco (Italy)
Full Member
***
Offline


Posts: 165
Joined: Jul 12th, 2019
Re: Arduino ZERO with Atmel ICE (upload and Debug)
Reply #2 - Apr 12th, 2021 at 5:02am
Print Post  
Hi Tim!
UPDATE

I tried loading the boot with VM and it works perfectly afterwards. So I followed the following procedure

1. Loading user code via Atmel  ICE [ok].
2. Loading booloader via Atmel ICE [ok].

The program starts without problems and the debug is loaded without problems using the debug -> attach process.

If you want to remain only one point of "elegance" it would be nice to merge points 1 and 2 into one upload from Atmel - ICE. In only one upload session VM can upload user code and bootloader.

I need the programmer because I build custom hardware with SAM21G and do not have the atmel debug chip available.
Wink
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2174
Joined: Feb 13th, 2019
Re: Arduino ZERO with Atmel ICE (upload and Debug)
Reply #3 - Apr 13th, 2021 at 8:51am
Print Post  
It should be possible to use the build hooks detailed on the below page to automate the bootloader flashing process:
https://www.visualmicro.com/page/Arduino-Build-Events-and-Hooks.aspx

The command can be taken from the output, or assembled from the properties in the packages platform.txt, and the properties shown in the build output.

Enable the below options to reveal the most information:
  • vMicro > Compiler > Show Build Properties
  • vMicro > Compiler > Verbose 
  • vMicro > Uploader > Verbose

  
Back to top
 
IP Logged
 
Marco (Italy)
Full Member
***
Offline


Posts: 165
Joined: Jul 12th, 2019
Re: Arduino ZERO with Atmel ICE (upload and Debug)
Reply #4 - Apr 13th, 2021 at 2:21pm
Print Post  
Hi Tim!
in attach the output file during the phase of upload via ICE Atmel, of course, this phase doesn't arrive, to start the board because the bootloader is not loaded.

Smiley
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino ZERO with Atmel ICE (upload and Debug)
Reply #5 - Apr 13th, 2021 at 5:15pm
Print Post  
The design of the Zero board you have selected is that programmer upload is seperate to burn bootloader. You can create ea custom upload rule to force the bootloader to burn after each upload. 

Simon has given you instructions of how to add Build Event Hooks which are the custom upload rules. 

Using the verbose output you can decide the rule you want to add to burn the bootloader after upload.

  
Back to top
WWW  
IP Logged
 
RDs
Newbies
*
Offline


Posts: 6
Location: Latvia
Joined: Apr 16th, 2021
Re: Arduino ZERO with Atmel ICE (upload and Debug)
Reply #6 - Apr 19th, 2021 at 9:47am
Print Post  
Hey folks, to not make thread spam.
I made a board for a product based on MKRZERO schematic. I am doing uploading through SWD using atmel ICE. Uploading works fine, however debugging doesn't, every time upload is done debugger fails to start with following message. (See attachment).

I haven't uploaded bootloader or touched any other settings. However according to VM settings SWD debugging is supported. Any ideas? 
« Last Edit: Apr 19th, 2021 at 9:49am by RDs »  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2174
Joined: Feb 13th, 2019
Re: Arduino ZERO with Atmel ICE (upload and Debug)
Reply #7 - Apr 19th, 2021 at 11:58am
Print Post  
Can you confirm you have flashed the bootloader onto the board after the code upload?

Please enable the below options in vMicro:
  • vMicro > Compiler > Verbose
  • vMicro > Compiler > Show Build Properties
  • vMicro > Upload > Verbose


Then once the code and bootloader are flashed run the Debug > Attach to Process.

Please attach the full Output as a text file so we can investigate further.
  
Back to top
 
IP Logged
 
RDs
Newbies
*
Offline


Posts: 6
Location: Latvia
Joined: Apr 16th, 2021
Re: Arduino ZERO with Atmel ICE (upload and Debug)
Reply #8 - Apr 20th, 2021 at 10:02am
Print Post  
Still fails, steps: upload debug code > upload bootloader > attach process. Still drops error.

Output per instructions

https://pastebin.com/AnNA1Y99
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2174
Joined: Feb 13th, 2019
Re: Arduino ZERO with Atmel ICE (upload and Debug)
Reply #9 - Apr 20th, 2021 at 10:26am
Print Post  
Sorry that link is not found any longer.

Can you attach the file using the Attachment option? (when posting a reply it is below the main text box with a [Choose File] button).
  
Back to top
 
IP Logged
 
RDs
Newbies
*
Offline


Posts: 6
Location: Latvia
Joined: Apr 16th, 2021
Re: Arduino ZERO with Atmel ICE (upload and Debug)
Reply #10 - Apr 20th, 2021 at 11:06am
Print Post  
There
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2174
Joined: Feb 13th, 2019
Re: Arduino ZERO with Atmel ICE (upload and Debug)
Reply #11 - Apr 20th, 2021 at 11:20am
Print Post  
Thanks for the detail.

If you are uploading via the ICE then the bootloader will have to be burned before the debugger is attached (i.e. have to use Debug > Attach to Process, after both code and bootloader uploads are complete).

It is also worth updating to the latest forum release (21.01.06.18) as this has fixes in for this specific core and hardware debugging:
https://www.visualmicro.com/forums/YaBB.pl?board=VS_ARDUINO_EXT_RELEASES
  
Back to top
 
IP Logged
 
RDs
Newbies
*
Offline


Posts: 6
Location: Latvia
Joined: Apr 16th, 2021
Re: Arduino ZERO with Atmel ICE (upload and Debug)
Reply #12 - Apr 20th, 2021 at 12:59pm
Print Post  
Installed bugfix update and it worked as instructed. Huge thanks, saved me quite a hassle on future debug.  Grin

Also since the ordering is important I suggest adding this info to SWD instructions padge. SWD is also getting more common so it's a nice thing that it got implemented in first place.  Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint