Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have read in a few places about Atmel's support of program traces on their high-end debugger/MCUs. It seems to be that some of the AVR32 processors can be 'traced' by the AVROne! programmer/debugger. See here or this pdf for mentions of the feature.

Initially I thought this was an atmel specific feature, but after reading more it seems that their nanotrace implementation is atmel specific while the concept of a trace is common to many high-end microcontrollers.

Could somebody explain to me what this is, why it it would be more useful than traditional debugging techniques like logging debug over UART or instruction level stepping, and provide some resources on how to use such a feature? I don't care so much if the resources are for the atmel chips I mentioned as I don't plan on actually using the feature in the near future, I just want to be educated and aware of what it can do.

share|improve this question
lauterbach.com – starblue May 16 '13 at 16:47
up vote 4 down vote accepted

When you trace a program the debugger records jumps and branches while the program is running. This means that when you stop the program or it hits a breakpoint you can figure out how the program got to this point. Some debuggers can also trace data, which means that you can look at the historical contents of variables, not just the current value. So with "ordinary" debugging you can see that the program crashed because of a "divide by zero" bug in line 432, but with tracing you can see that line 432 was executed because the test in line 411 was true and the branch in 422 was not taken and that the variable n was 12 and 13 before it was finally set to zero.

share|improve this answer
Thanks, this is exactly what I was looking for. – NickHalden Aug 14 '13 at 13:10

The NanoTrace is like a regular trace that dumps to on-chip memory instead of the AUX port so that you can read it off with a low cost (slow) debugger. While this allows you to spend less (~$550) on the debugger it slows down the operation of the target microcontroller . This will only really become a problem if you're trying debug a time critical operation. For most hobbyists this is never a problem.

However, this would be faster than logging debug over UART and instruction level stepping doesn't really enter in to the comparison (though it is usually done through the JTAG interface as well).

Basically, it's a common feature of microcontrollers with a fancy name.

share|improve this answer
So my question wasn't about nanotrace specifically. I want to know what a "regular trace" can do exactly and when you would use it. What kind of information can you "dump" to the AUX port during a trace that would be helpful for debugging? – NickHalden May 16 '13 at 15:00
A trace is like a communication channel with the microcontroller. It can be used for making printf statements in microcontroller code that will be received by the IDE while debugging. It works the other way too, you can change the values of some registers through the debug interface. Basically, it makes the debug process less of a "ok, it's done, how did it go?" and more of a "how are things going this instant?". There is a bit more information here - electronicdesign.com/embedded/… – Samuel May 20 '13 at 0:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.