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) Debugging with jtagice & DebugWire? (Read 10468 times)
Nebulous
Junior Member
**
Offline


Posts: 10
Joined: Nov 28th, 2018
Debugging with jtagice & DebugWire?
Nov 28th, 2018 at 3:41pm
Print Post  
Hi,
I am trying to use Visual Micro for debugging, but am not having any luck.

I have Atmel Studio 7 + "Arduino IDE for Atmel Studio 7" V 1811.24.0 installed.

I want to use my jtagice mk2 in DebugWire mode to debug an arduino .ino project (blinky example) on a custom board with a ATMega328PB.

I have a know good hardware setup and can debug native Atmel Studio project without a problem.

Is this supported?
There doesn't seem to be an option for it in vMicro - Uploader - Programmer:
The closest is "Atmel Studio JTAG ICE MK2 (ISP)"

I have already fused my target micro for DebugWire (thus disabling ISP) so I wasn't surprised it didn't download, but don't know how to proceed.

Any help would be appreciated.

If I try to debug, the message window shows this:

Code
Select All
Uploading 'Sketch1' to 'Atmel atmega328pb Xplained mini' using 'Atmel Studio JTAG ICE MK2 (ISP)'
[ERROR] An unexpected error occurred when executing.
Traceback (most recent call last):
  File "atmel\atprogram.py", line 48, in run
Error during upload using programmer
The uploader process failed

The uploader process failed
  File "atmel\avr\cli\commandline.py", line 54, in execute_commands
The uploader returned an error
  File "atmel\avr\cli\commandexecutor.py", line 52, in execute_commands
  File "atmel\avr\cli\resourcemanager.py", line 44, in prepare_resources
  File "atmel\avr\cli\resourcemanager.py", line 51, in _prepare_resource
  File "atmel\avr\cli\resourcecontainers.py", line 54, in allocate
  File "atmel\avr\cli\backend.py", line 134, in start
  File "subprocess.py", line 702, in __init__
  File "subprocess.py", line 823, in _get_handles
WindowsError: [Error 6] The handle is invalid
 

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


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debugging with jtagice & DebugWire?
Reply #1 - Nov 28th, 2018 at 8:07pm
Print Post  
Visual Micro is a serial debugger. 

In Atmel studio use the "Atmel device programming" programmer. This then hands over to standard atmel studio device programming for the project. (see atmel user guide)

If you want to debug using atmel debug then you need to follow the instructions on the visual micro atmel studio 7 page or use the atmel project converter.

If you want to use device programming or programmer for upload and then use the visual micro serial debugger then set the local and remote port on the vMicro>Debugger menu
  
Back to top
WWW  
IP Logged
 
stevewidg
Newbies
*
Offline


Posts: 5
Joined: Feb 18th, 2015
Re: Debugging with jtagice & DebugWire?
Reply #2 - Nov 29th, 2018 at 3:42pm
Print Post  
Hi 
I get EXACTLY same error message trying to use an Atmel Ice  using Atmel Studio ICE-ISP  under VM with'always use programmer' selected and Atmel ICE ISP selected under tools.It programs fine using TOOLS>PROGRAM etc.
Any Suggestions
PLease
Steve
  
Back to top
 
IP Logged
 
Nebulous
Junior Member
**
Offline


Posts: 10
Joined: Nov 28th, 2018
Re: Debugging with jtagice & DebugWire?
Reply #3 - Nov 29th, 2018 at 5:05pm
Print Post  
Tim@Visual Micro wrote on Nov 28th, 2018 at 8:07pm:
Visual 
If you want to debug using atmel debug then you need to follow the instructions on the visual micro atmel studio 7 page or use the atmel project converter.

Do you have any links to those instructions?
I found this page but it doesn't explain anything.

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


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debugging with jtagice & DebugWire?
Reply #4 - Nov 29th, 2018 at 5:58pm
Print Post  
The visual studio extension link in the page you posted is what you want.

It is also in the links at the top of the visual micro home page
  
Back to top
WWW  
IP Logged
 
Nebulous
Junior Member
**
Offline


Posts: 10
Joined: Nov 28th, 2018
Re: Debugging with jtagice & DebugWire?
Reply #5 - Nov 30th, 2018 at 3:11pm
Print Post  
Thanks VM. I have read through that page and I still can't get it to work.
When I try to debug (the green play button), it invokes the "Device programming" dialog as if it is set for ISP. When I do that in a native AS7 project I don't see that and it automatically downloads via DebugWire where I can then run, step etc.

Setup:
  • My project has an empty "Sketch1.ino" file.
  • A "Sketch1.cpp" file containing the arduino blink sketch plus #include <arduino.h> as the first line.
  • In project Properties>Tool I set the programmer to JTAGICE mkII and interface to debugWIRE.
  • vMicro>Uploader>Programmer is set to "Atmel Studio Device Programming" and "Always use programmer for upload" is ticked.
  • vMicro>Debugger>Atmel Studio Debugger is ticked.

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


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debugging with jtagice & DebugWire?
Reply #6 - Dec 1st, 2018 at 1:00am
Print Post  
If I recall you can "right click > project name > project properties" then set the Tool.

Are you using avr or sam or samd?
  
Back to top
WWW  
IP Logged
 
Nebulous
Junior Member
**
Offline


Posts: 10
Joined: Nov 28th, 2018
Re: Debugging with jtagice & DebugWire?
Reply #7 - Dec 1st, 2018 at 10:45am
Print Post  
Tim@Visual Micro wrote on Dec 1st, 2018 at 1:00am:
If I recall you can "right click > project name > project properties" then set the Tool.
Yes, that's what i did.

Tim@Visual Micro wrote on Dec 1st, 2018 at 1:00am:

Are you using avr or sam or samd?
Avr.

The problem I have is that when I hit the "Start Debugging" button, instead of seeing in the bottom left corner of the IDE "Writing %", followed by "Running" like a native project would, the "Device Programming" dialog pops up, from which there is no way to activate debugging.
It is as if the "Start Debugging" button is being overridden by an incorrect command somewhere. Or maybe the vMicro>Debugger>Atmel Studio Debugger selection is being ignored.  Sad
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debugging with jtagice & DebugWire?
Reply #8 - Dec 1st, 2018 at 2:46pm
Print Post  
Is "vmicro>debugger>use atmel studio debugging" enabled?
  
Back to top
WWW  
IP Logged
 
Nebulous
Junior Member
**
Offline


Posts: 10
Joined: Nov 28th, 2018
Re: Debugging with jtagice & DebugWire?
Reply #9 - Dec 1st, 2018 at 3:32pm
Print Post  
Yes, that is ticked.

edit:
although the word "use" is not there.
« Last Edit: Dec 1st, 2018 at 3:37pm by Nebulous »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debugging with jtagice & DebugWire?
Reply #10 - Dec 1st, 2018 at 3:37pm
Print Post  
pls zip and attach your .cppproj file

Thanks
  
Back to top
WWW  
IP Logged
 
Nebulous
Junior Member
**
Offline


Posts: 10
Joined: Nov 28th, 2018
Re: Debugging with jtagice & DebugWire?
Reply #11 - Dec 1st, 2018 at 3:43pm
Print Post  
zip file attached. Thanks.
  

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


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debugging with jtagice & DebugWire?
Reply #12 - Dec 2nd, 2018 at 12:08pm
Print Post  
Sadly, once you are in native atmel mode there is little I can do to help via Visual Micro.

Your project looks okay to me. The ccp proj files are just text/xml you can look in them and change them if required.

I used "File>New>Arduino Project" to create a Test project and used Atmel to create a GCC executable. Then compared the two projects and they look the same.

What do you see different?



note: You will see that I have used a standard arduino project for comparison. The .ino/cpp file naming configuration is not relevant to this discussion of "tools".

  

Please Register or Login to the Forum to see File Attachments
Back to top
WWW  
IP Logged
 
Nebulous
Junior Member
**
Offline


Posts: 10
Joined: Nov 28th, 2018
Re: Debugging with jtagice & DebugWire?
Reply #13 - Dec 3rd, 2018 at 1:00pm
Print Post  
Tim@Visual Micro wrote on Dec 2nd, 2018 at 12:08pm:
I used "File>New>Arduino Project" to create a Test project and used Atmel to create a GCC executable. Then compared the two projects and they look the same.

What do you see different?


I have done the same and see the same as your screenshots. (or did you mean to compare the .cppproj file?)

« Last Edit: Dec 3rd, 2018 at 1:02pm by Nebulous »  

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


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debugging with jtagice & DebugWire?
Reply #14 - Dec 3rd, 2018 at 1:09pm
Print Post  
Maybe something has changed in as7, it's can be difficult at times.

We might have to compare the two ccpproj project files to see what might be missing.

The problem is that Visual Micro doesn't have to do anything when you switch to atmel mode. So we just need to ensure the correct project properties are set.
« Last Edit: Dec 3rd, 2018 at 1:09pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Nebulous
Junior Member
**
Offline


Posts: 10
Joined: Nov 28th, 2018
Re: Debugging with jtagice & DebugWire?
Reply #15 - Dec 15th, 2018 at 2:50pm
Print Post  
Hi,
I have spent more time on this and although I haven't fully solved my problems I have narrowed it down to an exact sequence of events:

Code
Select All
 1. Starting with an Arduino Mega clone that works when I upload Blink sketch to via Arduino IDE and USB port.
 2. Soldered a JTAG socket to board onto relevant JTAG pins on the ATMEGA2650 .
 3. In VS7 File>New>Project>Arduino Sketch.  Name it VM_Blink. Ok
 4. Visual Micro pops up a message about removing main.cpp.  I select Yes.
 5. Project is created with a VM_Blink.ino containing an empty setup and loop function.
 6. I replace the contents of VM_Blink.ino with the code from the Arduino Blink sketch example.
 7. In Project>VM_Blink Properties... I Check I have the correct microprocessor device in "Device".
 8. In "Tool" I set the debugger/programmer to JTAGICE mkII and interface to JTAG.
 9. I Click Build VM_Blink and it compiles successfully in the output window plus tells me about how debugging doesn't work well with .ino file. I ignore that for the time being.
10. In vMicro I check I have the correct Com Port for the USB port on the Mega.
11. Now I click vMicro>Build & Upload.  Code uploads via the USB and works.
12. So far so good. I now have the equivalent environment as the Arduino IDE.
13. Now to do debugging via JTAG.
14. Select vMicro>Debugger>Atmel Studio Debugger.
15. I DO NOT Select vMicro>Uploader>Always Use Programmer For Upload.
16. Go into Tools>Device Programming and select JTAGICE mkII / ISP then Apply.
17. I connect my JTAG, via an adapter to the 6-pin ISP on the Mega.
18. Read the fuses, then select the JTAGEN fuse and then program the fuses, accepting the warning message. Fuses are now FD 98 FF
19. Now I connect the JTAG to the JTAG socket I added to the Mega board.
20. Click Debug>Start Debugging And Break.
21. Code uploads and runs, but the initial break was somewhere in wiring.h. That's fine, I assume this is due to the reason in the warning in point number 9.
22. I Click Debug->Stop Debugging.
23. Click Debug>Start Debugging And Break for a second time, but it fails to upload.
24. I notice that since the first successful debug run the fuses have changed from FD 98 FF to FD 90 FF. The change is the EESAVE fuse which I don't believe is causing this problem.
25. I reset / repower the hardware but it will no longer enter debugging via JTAG.
26. I go back to Arduino IDE and, using a USBAsp programmer, select Tools>Burn Bootloader
27. I now re-enable the JTAG fuse again as in 18.
28. I can now debug again, but only once as before. 


So does anyone know why I only get one go at debugging, then have to re-burn the bootloader again in Arduino IDE to get it to work again in AS7?

Thanks.

Edit: I forgot to say, since my original post I have switched to using more standard hardware and full JTAG instead of DebugWire in case that was causing a problem.
« Last Edit: Dec 15th, 2018 at 2:53pm by Nebulous »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debugging with jtagice & DebugWire?
Reply #16 - Dec 15th, 2018 at 2:56pm
Print Post  
What atmel studio is doing is killing the bootloader. You must reverse your thinking of point 15 and have visual micro use the "atmel device programmer" and "always use programmer"


  
Back to top
WWW  
IP Logged
 
Nebulous
Junior Member
**
Offline


Posts: 10
Joined: Nov 28th, 2018
Re: Debugging with jtagice & DebugWire?
Reply #17 - Dec 15th, 2018 at 3:45pm
Print Post  
Thanks VM, I selected that and it is working now. Cheesy

The reason I had that turned off is because it calls up the Device Programming dialog, which previously I would click Close and then it failed, which seemed as if it was not the correct way, but now when I click close it works. ? 
I don't know it it's related, but since I started this thread I've wiped my old Windows 7 system with years of old versions installed, and did a clean install of Windows 10 with only the latest Versions installed (didn't do that because of this problem, just coincidence).

Any way of not getting it to bring up the Device Programming dialog or is that asking too much  Smiley
  
Back to top
 
IP Logged
 
Nebulous
Junior Member
**
Offline


Posts: 10
Joined: Nov 28th, 2018
Re: Debugging with jtagice & DebugWire?
Reply #18 - Dec 20th, 2018 at 2:58pm
Print Post  
Thanks very much for all your help. I now have it working perfectly with my custom board and atmega328pb device. Cheesy
I went ahead a purchased a licensed copy.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debugging with jtagice & DebugWire?
Reply #19 - Dec 20th, 2018 at 7:44pm
Print Post  
Thank you
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint