Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
JTAG debugging error (Read 1486 times)
Rotunnoz
Junior Member
**
Offline



Posts: 13
JTAG debugging error
Dec 27th, 2017 at 11:06pm
 
I've been searching for ways to use my Atmel-ICE debugger to do step-by-step debugging on my Arduino Due using JTAG.

When attempting to start debug (Start Debugging and Break, Alt F5), the project compiles and seems to upload to the board, but I get an error message saying:

"Failed to launch program.
Error: No device detected. Error 4109"

The board also seems to be detected by the ICE, if I disconnect board and ICE, the error code changes to 0.

I made sure to check vMicro -> Debugger -> Atmel Studio Debugger and the ICE debugger is selected under the "Tool" tab, under project properties, JTAG interface.

I'm using AS7 and Due library v1.6.4.

I'd appreciate any ideas and will be happy to provide additional information.
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 8856
United Kingdom
Re: JTAG debugging error
Reply #1 - Dec 28th, 2017 at 11:00pm
 
You should right click the project and click Properties to set the device for the project

Back to top
« Last Edit: Dec 28th, 2017 at 11:01pm by Visual Micro »  
WWW  
IP Logged
 
Rotunnoz
Junior Member
**
Offline



Posts: 13
Re: JTAG debugging error
Reply #2 - Jan 2nd, 2018 at 10:25pm
 
Hello and thank you for your response. Also my apologies for taking so long to reply.

Doing so displays the same "Tool" tab I was seeing before by clicking the "tool" toolbar (see attachment).

I'm able to select the ICE debugger in that screen, but I still get that error message.
Back to top
 

Tool_menu.PNG (75 KB | 32 )
Tool_menu.PNG
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 8856
United Kingdom
Re: JTAG debugging error
Reply #3 - Jan 5th, 2018 at 9:42pm
 
1)
Is "atmel device programming" selected on the "vMicro>Upload>Programmers" menu and is "always use programmer for upload" checked?

2)
In Release mode, switch on vmicro>uploader verbose then upload. So we can see if we are using programmer or serial bootloader for upload.

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



Posts: 13
Re: JTAG debugging error
Reply #4 - Jan 8th, 2018 at 3:20pm
 
Thank you for your help. Please find answers below:

1.
Visual Micro wrote on Jan 5th, 2018 at 9:42pm:
Is "atmel device programming" selected

Yes.

Visual Micro wrote on Jan 5th, 2018 at 9:42pm:
is "always use programmer for upload" checked?

No. I checked that option and I now see some errors in the Micro Build output window. Please see below:

Uploading 'PQV_Firmware' to 'Arduino Due (Native USB Port)' using 'Atmel Studio ATMEL-ICE (ISP)'
[ERROR] An unexpected error occurred when executing.
Traceback (most recent call last):
  File "atmel\atprogram.py", line 48, in run
  File "atmel\avr\cli\commandline.py", line 54, in execute_commands
Error during upload using programmer
The uploader process failed

The uploader process failed
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 55, 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

2.
Visual Micro wrote on Jan 5th, 2018 at 9:42pm:
switch on vmicro>uploader verbose then upload.

Same issues apparently. Judging by that command line, it seems to be trying to use the hardware debugger. Please find output below, also please note lines 4 and 5 below are actually one line only. I think the site editor split them.

Uploading 'PQV_Firmware' to 'Arduino Due (Native USB Port)' using 'Atmel Studio ATMEL-ICE (ISP)'
Uploader started for board Arduino Due (Native USB Port)
Uploader will use programmer name: atprogram_atmelice_isp
C:\Program Files (x86)\Atmel\Studio\7.0\atbackend\atprogram -d cortex-m3 -v -t atmelice -i ISP program -c -f "C:\Users\nelson\AppData\Local\Temp\VMBuilds\PQV_Firmware\arduino_due_x\Release\
PQV_Firmware.ino.hex"
[DEBUG] Starting execution of "program"
[DEBUG] Starting process 'C:\Program Files (x86)\Atmel\Studio\7.0\atbackend\atbackend.exe'
[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

  File "atmel\avr\cli\commandline.py", line 54, in execute_commands
The uploader process failed
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 55, 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
 
Visual Micro
Administrator
*****
Offline



Posts: 8856
United Kingdom
Re: JTAG debugging error
Reply #5 - Jan 8th, 2018 at 11:30pm
 
Please re-confirm you have a check mark again "Atmel Device Programming" and not "Atmel Studio ATMEL-ICE (ISP)"
Back to top
 
WWW  
IP Logged
 
Rotunnoz
Junior Member
**
Offline



Posts: 13
Re: JTAG debugging error
Reply #6 - Jan 9th, 2018 at 4:18pm
 
Thank you for your response.

You're absolutely right, that's what I had selected. The first time you asked, I was thinking of the option vMicro->Debugger->Atmel Studio Debugger. Duh! I apologize.

Moving forward, when I click "Start Debugging and Break" now I have a "Device Programming" screen pop up (see image attached).

This screen will allow me to set the device and interface, even read voltage. However, I get a detailed error message similar to the one in the beginning of this thread (see image attached) if I click GPNVM, Lock or Security Bit sub-menus (left hand side), or read Device Signature (top). Closing the screen will also give me this error code, with less details.

I have double checked the connection from the hardware debugger to the board (10 pin JTAG) and tried with 3 different boards. I also noticed when this connection is not present, the error code changes to 0 as previously, all other fields being the same.

The LEDs on my debugger read (from left to right) green, red and not lit. The green LED goes off when I disconnect the JTAG connector, leading me to believe the hardware is OK.
Back to top
 

Error_008.PNG (39 KB | 28 )
Error_008.PNG
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 8856
United Kingdom
Re: JTAG debugging error
Reply #7 - Jan 10th, 2018 at 4:39pm
 
Hi,

As soon as you see atmel dialogs you are out of visual micro and into native atmel functionality.

I provide two options

1) Normal serial upload then debug using atmel (no atmel device programming)
2) Upload via atmel device programming and debug via atmel hardware debug.

The options I have explained show how to configure both 1) and 2). You should note that if you successfully follow atmel guides and make an upload using atmel device programming it will wipe the arduino serial upload facility on the chip called a bootloader. If in the future you want to resume normal arduino serial upload you need to use the "burn bootlloader" option in the arduino ide or in visual micro.

Sorry I can't be more help except to suggest you learn how the atmel tools work using a standard atmel project so you can see the line between visual micro and atmel.
Back to top
 
WWW  
IP Logged
 
Rotunnoz
Junior Member
**
Offline



Posts: 13
Re: JTAG debugging error
Reply #8 - Jan 11th, 2018 at 2:56pm
 
Hello,

Thanks for the heads up.

No worries, I will look into Atmel documentation in that case. Sorry I didn't realize I was going out of scope here.

I know you're a busy fellow and I much appreciate all the time and effort you put into assisting me.
Back to top
 
 
IP Logged
 
Rotunnoz
Junior Member
**
Offline



Posts: 13
Re: JTAG debugging error
Reply #9 - Apr 6th, 2018 at 4:23pm
 
I decided to look into this again yesterday and fixed my problem, just posting to share.

It turns out my JTAG connector was not plugged in the correct orientation on the Arduino.

What was throwing me off here is I observed the following things while the board was incorrectly connected:

- The middle LED would turn on (green) on the Atmel ICE
- The error code changed from 4109 to 0 when the board was disconnected from Atmel ICE
- There was a voltage reading on the device programming screen

Also I had been scared by the fact that all LEDs would turn off immediately after connecting the JTAG in the correct orientation on the board, I thought something was short circuiting in there.

Edit to fix typo.
Back to top
« Last Edit: Apr 6th, 2018 at 4:24pm by Rotunnoz »  
 
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print