2.1.6.4.1 AVR MCU OCD Messaging Without Handshaking

The simplest form of using AVR MCU OCD messaging is writing directly to the register without any form of handshaking. This might be appropriate when, for example, execution speed is more important than data completeness. A single write to the OCD message register overwrites the previous value, even if it has not been read by the debugger yet. This could also be used for slow-changing data.

The following example shows how to output AVR MCU OCD messages without handshaking on various AVR MCU architectures.

OCD Messaging on AVR UPDI Target Device

// Example of OCD message on AVR UPDI target
// No handshaking, no guarantee
#define SYSCFG_OCDM SYSCFG.reserved_0x18
void ocd_putchar (char c)
{
    SYSCFG_OCDM = c;
}

OCD Messaging on AVR XMEGA® Target Device

Note: DGI-based OCD messaging is not yet supported on XMEGA targets. The code shown here will push OCD messages to Atmel Studio.
// Example of OCD message on AVR XMEGA target
// No handshaking, no guarantee
void ocd_putchar (char c)
{
    OCD.OCDR0 = c;
}

OCD Messaging on AVR JTAG Target Device

// Example of OCD message on AVR JTAG target
// No handshaking, no guarantee
void ocd_putchar (char c)
{
    OCDR = c;
}