I am thinking of buying a Debugger. Should I get one?

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

What is your opinion on that?.

 

I know that debugging has its limits because the actual code on the controller differs from what you write in C. So is it still worth to get one?

 

And if, which one? Looking at the Atmel Website I can buy one for 49$ or an Atmel AR one for 599$. Apart from supporting different devices, they must have different performances. Or even a third party debugger?

 

What do you think?

 

Delcon

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

Buy the ATMEL-ICE with standard cables.

 

Note that it will probably be cheaper and faster delivery from Farnell, Mouser, ... or your local Distributor.

Check Atmel Store too.

 

Always check the full cost.   i.e.  price + tax + delivery.

 

Oh,   debugging does work with the real code running on the AVR.    

It is up to you 'how easy' the code is to understand after the Optimiser has finished with it.

This is why you select -O1 for debugging.

 

You might choose -O2 or -O3 after you have finished the initial debugging.

Do your final tests with the actual code e.g. -O2 or -Os

 

With the 'advanced' optimisations from -O2 etc,   it might rearrange your loops,   variables etc.

This is difficult to follow.     But you will learn with experience.

 

David.

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

Hi David

 

Thank you for your thoughts and suggestions. To get an idea on what to expect from a debugger, what would you say, how often are you using a debugger while developing a project? Until now I have been debugging using the UART for reporting different states of variables or loops. It works well except that you can not single step and other limitations.

 

Delcon

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

You would only need a debugger if your project is not working as you expected.

Yes,   if you have a handy UART,   you can use printf() messages.

Or a $10 Logic Analyser can show wiggles on port pins.

 

Some problems are easier to solve by using JTAG / PDI / debugWIRE.

 

So there is no universal answer.    But if you own an ATMEL-ICE,  you can use it for programming and debugging.

 

In practice,    I compile and run most projects for a UNO hardware and associated shields.    Probably with C, C++ and sometimes Arduino.

It is very convenient to use the UNO bootloader.   i.e. one USB cable does everything.

I seldom bother to use debugWIRE but I do occasionally use it with a Dragon.

 

If I am building something with an Xmega,   it is always using the Dragon for PDI/JTAG programming.    So debugging is always available.

 

David.

Last Edited: Mon. Nov 24, 2014 - 09:25 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

delcon wrote:

...how often are you using a debugger while developing a project?

 

Very rarely. I have a selection in the drawer but they don't often come out. My main debug tool is the LED and test point I put on all boards. I write all code 'bottom-up', testing each peripheral and associated driver as I go. Doing this means that I can get away with a simple debug interface. If you don't have one then a simple logic analyser would be a much better investment IMHO.

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

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

Thank's guys. This helps me make my decision.

 

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

I am not as brave as Brian.     One LED is a bit bare-bones!

 

If I use the UNO,   I have always got printf() to a PC terminal.    Sometimes,   I connect a I2C LCD.    Or I have already got a TFT LCD in the project.

 

It is always worth developing any project on an AVR with sufficient resources.    Once debugged,   you can re-compile and run it on a smaller AVR e.g. less pins, no USART, ...

 

David.

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

...how often are you using a debugger while developing a project?

I would not contemplate software engineering without one. For me developing CPU software without a debugger would be a bit like owning a car without an engine. With a lot of pushing and shoving you might just be able to get it to roll down a hill but God forbid the day when you are stuck at the bottom of an 8 in 1 and need to get to the top!!

 

I do tend to work with more complex silicon than 8bit AVRs though. At a pinch I suppose you might get by with a lot of printf()s or some flashing LEDs - but when most AVR models have debugWire / PDI / JTAG why should you be so limited? An Atmel ICE only costs $50 anyway!

 

(having said that one of the appeals of Cortex is you can often buy a board for $10..$20 and it even includes the equivalent of an Atmel-ICE for ARM on the PCB - so the overall cost of ARM development is often a lot less than lowly 8bit AVR where the debugger alone starts at $50.

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

I don't own a debugger, and often printf(is too slow), so for low level I write direct to the UDR register.

If it's faster timing, flip a unused IO, to trigger the scope.