Special
considerations (Trace Buffer)
This section covers some special cases that are not covered by previous
description.
Accessing external memory
Instructions that are accessing data memory have different timing based
on whether the memory is internal or external. For external memory accesses,
the timing is again dependent on the number of wait states. This document
does not describe the exact timings of these instructions, but they are
fairly similar to those described above. It applies to the following instructions:
LD (various forms), LDD (various forms), ST (various forms), STD (various
forms), LDS, STS, RCALL, ICALL, CALL, RET, RETI, PUSH, POP.
Hardware call stack
For devices with hardware call stack (e.g. AT90S1200), the stack pointer
and return address will not be visible in any of the fields during the
RCALL, RET or RETI instructions.
Interrupt handling
Interrupts are asynchronus events to the regular program flow. There is
no instruction associated with the start of the processor handling an interrupt.
However, once the processor has stored the return address to the stack,
it will start to execute code from the interrupt vector address. An example
is shown below, where an interrupt occurs during the execution of the instruction
LDI
R16,0x01. When this instruction is completed (1 cycle instruction),
it can be observed that the program counter is written to the stack at
addresses 0x25F and 0x25E before it starts executing
from the interrupt vector (in this case, interrupt vector 0x00007). After
the (in this case very simple) interrupt program has completed, execution
resumes (in this case from address 0x00012).
Sleep
Even if tracing is enabled when the microcontroller enters sleep mode,
nothing will be logged into the trace buffer. This applies to all the sleep
modes. Note, however, that the Cycle Counter still counts while the microcontroller
is asleep, and this can be used to measure how long the microcontroller
has been asleep when it is woken up.
Reset
An external reset or a watchdog reset while tracing is enabled will fill
the trace memory with zeros during their start-up period. Nothing will
be logged into the trace buffer during the start-up period if the reset
button in AVR Studio is used. Fast start options are not available in the
Emulators.
See Also