Debugging in Atmel Studio 7

Go To Last Post
16 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

1) In AS7, through which the programmer should I connect the Arduino for using AVR simulator debugging features like  Cycle Counter and Stopwatch , real-time change of bits in I/O, Start without debugging, and breakpoints. I have connected my Arduino with Arduino cable for the serial port.

2) if I connect my Arduino using a normal Arduino cable or USBasp programmer, will it be detected as an internal tool or they are it an external tool.

3) I want to use debugging features provided by atmel studio and its data visualisation toolchains, so which tools should i use. and will USBasp programmer and arduino cable will not work for using  only debugging features

 

 

Kunal Gupta

github.com/gkunalupta

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

USBASP will program but not debug.

You need a SNAP, PicKit4, ATMEL-ICE, ... for JTAG debugging an ATmega2560.

 

The Simulator will debug but not program the physical chip.

 

So options like "Start without Debugging" means just program and run e.g. use USBASP.

And "Debug" means start debugging e.g. use Simulator (or SNAP, PK4, ...)

 

David.

Last Edited: Sun. Oct 11, 2020 - 01:17 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kunalgupta wrote:
2) if I connect my Arduino using a normal Arduino cable or USBasp programmer, will it be detected as an internal tool or they are it an external tool.
Not detected, external

Kunalgupta wrote:
3) I want to use debugging features provided by atmel studio and its data visualisation toolchains, so which tools should i use.
DGI :

  • Atmel-ICE (SPI, USART)
  • Power Debugger (complete)
  • EDBG and subsequent (Microchip boards' on-board debugger)

 


Arduino to Atmel Studio 7 external programmers, ISP and serial programming | AVR Freaks

Connecting to Data Gateway Interface | Atmel-ICE

Data Gateway Interface | Power Debugger

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Will STK500 work for these purpose

Kunal Gupta

github.com/gkunalupta

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kunalgupta wrote:

Will STK500 work for these purpose

The STK500 is a legacy programmer. Not debugger

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you are using Arduino I'd just stick to Serial.println() for "debugging"

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jgmdesign wrote:

The STK500 is a legacy programmer. Not debugger Jim

 

Can u please tell difference between programmer and debugger , like i am really confused what all are these stk500, Atmel ice, jtag, etc.

all these fancy terms Power Debugger, DGI, how are they different from programmer.

 

Kunal Gupta

github.com/gkunalupta

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A programmer only puts code into an AVR.

 

A debugger first puts code into an AVR then it "latches onto it" as it runs allowing you to stop it at any moment and take a look at what's going on inside.

 

Debugging Arduino interferes with normal Arduino operation (to the point where you have to make a small circuit modification) so, like I say, probably best to just stick to added Serial.println() to get clues about what's going on "inside"

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:

If you are using Arduino I'd just stick to Serial.println() for "debugging"

 well i am doing low level programming so i need tools to debug my code . Thats why thinking of these things

Kunal Gupta

github.com/gkunalupta

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can create you own equivalent to println(). Just fill a buffer with the characters you want to send out the serial port (probably as a null-terminated string - that is as good a way as any). Then call a function that outputs the character, increments a buffer "index", waits for the USART to become empty and repeats (until a null character is detected in the buffer). Its not such a big deal! Works fine in asm. Its a little more complex if you want non-blocking operation but that will get you started.

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ka7ehk wrote:

You can create you own equivalent to println(). Just fill a buffer with the characters you want to send out the serial port (probably as a null-terminated string - that is as good a way as any). Then call a function that outputs the character, increments a buffer "index", waits for the USART to become empty and repeats (until a null character is detected in the buffer). Its not such a big deal! Works fine in asm. Its a little more complex if you want non-blocking operation but that will get you started.

 

Jim

 I have done that and use to use that function only till now , but now i want to have some experience Debugging technique for fast work

Kunal Gupta

github.com/gkunalupta

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Do you actually have any bugs?  How is your program misbehaving?  Put some real thought into it.  I might have used an avr debugger once or twice in 15 years.   Use the scope and spit out a few values in serial is usually what it takes.

Now using PICs, I have used debuggers somewhat more....go figure!

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Data Visualizer extension to Atmel Studio displays what's on the Data Gateway Interface (DGI)

Outside of Atmel Studio, a logic analyzer can decode the stream.

 

Terminal Example Code | Data Visualizer Software User's Guide

MSG_CONF_STREAM | Data Visualizer Software User's Guide

[mid-page]

Table 1. STREAM_DATA_TYPE

...

STRING

...

Protocol decoder:uart - sigrok

Protocol decoder HOWTO - sigrok

Troubleshooting real-time software issues using a logic analyzer - Embedded.com

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kunalgupta wrote:
 well i am doing low level programming so i need tools to debug my code .
If you mean you are simply using an Arduino board because it is a well designed board and you don't intend to use Arduino features (IDE, library, bootloader etc) then get one of Atmel's AVR debug interfaces (cheapest of which is Snap), make the well documented mod to Arduino so that debugWire is free to opeate then wire up the Snap (etc) to it and you can use "proper debugging" in AS7.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Re: avrcandies - I use the debugger a LOT. very useful. It hangs and you "break all" to see where it is and what the various variable values are. Or,  single step with real hardware (which the simulator cannot do). LOTS of very useful tools. 

 

Yes, Arduino print statements can help. In simple programs, they may tell you enough to figure things out. BUT, for more complex situations, I don't know how the Arduino people do without a real functioning debugger.

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ka7ehk wrote:
I don't know how the Arduino people do without a real functioning debugger.
I have been doing something pretty complex with Arduino just recently and have got by just fine with Serial debugging though it's true that the CPU has UARTs coming out of its ears so I don't clash with the actual use of the UART for the debug channel.