VS Arduino
Visual Micro >> Microchip Studio (Atmel Studio 7) >> JTAG debugging error
https://www.visualmicro.com/forums/YaBB.pl?num=1514415982

Message started by Rotunnoz on Dec 27th, 2017 at 11:06pm

Title: JTAG debugging error
Post by Rotunnoz on 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.

Title: Re: JTAG debugging error
Post by Visual Micro on Dec 28th, 2017 at 11:00pm
You should right click the project and click Properties to set the device for the project


Title: Re: JTAG debugging error
Post by Rotunnoz on 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.
Tool_menu.PNG ( 75 KB | 22 Downloads )

Title: Re: JTAG debugging error
Post by Visual Micro on 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

Title: Re: JTAG debugging error
Post by Rotunnoz on Jan 8th, 2018 at 3:20pm
Thank you for your help. Please find answers below:

1.

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

Yes.


Tim@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.

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

Title: Re: JTAG debugging error
Post by Visual Micro on 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)"

Title: Re: JTAG debugging error
Post by Rotunnoz on 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.

Device_Programming.PNG ( 62 KB | 2 Downloads )
Error_008.PNG ( 39 KB | 1 Download )

Title: Re: JTAG debugging error
Post by Visual Micro on 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.

Title: Re: JTAG debugging error
Post by Rotunnoz on 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.

Title: Re: JTAG debugging error
Post by Rotunnoz on Apr 6th, 2018 at 3: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.

VS Arduino » Powered by YaBB 2.6.12!
YaBB Forum Software © 2000-2024. All Rights Reserved.