The Atmel® Data Gateway Interface is a USB interface for handling the lowlevel transport of data to and from a target MCU. DGI is available on a
selection of tools and on-board debuggers, such as the Power Debugger
and the EDBG, as found on Xplained Pro.
DGI provides several interfaces utilizing the same API for configuration and
communication. Each interface implements an abstraction to a physical
communication interface, such as SPI and UART, or represents a service not
directly tied to a physical communication interface, such as the timestamp
interface.
The DGI USB device consists of two endpoints; one OUT Bulk endpoint for sending commands from the
PC, and one IN Bulk endpoint for receiving responses. The endpoint size of both the IN and OUT
endpoint must be taken into account when communicating with the device. A completed packet is
recognized by the transfer having a length of less than the endpoint size. If a packet has a length which is
a multiple of the endpoint size, the last transfer must be a zero length transfer to complete the packet.
All communication is initiated by the host computer sending a command packet over the OUT endpoint.
All commands are given a response over the IN endpoint. Unrecognized commands will receive an error
response.
Commands can have a maximum length of 256 bytes. Responses to most commands are only a few
bytes. However, responses can be several thousand bytes when polling incoming data from the DGI
buffer.
The USB device is a custom implementation, not following any predefined USB classes, and will therefore
require the installation of a driver on most systems.
All values in the protocol are big endian. Command packets consists of a command byte, a 2-byte length
and command-specific parameters. The length field only counts the bytes in parameters, and will be 0 for
commands without parameters.
Table 2-1. Command Packet
FieldSizeDescription
Command1 ByteThe identifier of the command to be executed.
Length2 BytesAmount of trailing data in parameters (n).
Parametersn BytesCommand-specific parameters.
All received packets are parsed, executed, and responded to by a response code. The response packet
consists of the received command byte, a status code, and parameters, depending on the command and
status code. Unknown commands will receive an error response.
Table 2-2. Response Packet
FieldSizeDescription
Command1 ByteThe identifier of the command that was executed.
Status Code 1 ByteResponse indicating the status of the executed command.
Parameters n Bytes Some status codes have parameters. The parsing of the parameters are
command-specific.
Below is a list of the supported commands and possible response codes. Refer to the following subsections for details.
Table 2-3. List of Commands
NameValue Description
DGI_CMD_SIGN_ON0x00Initializes DGI and returns a verification string. Must
be the first command called.
DGI_CMD_SIGN_OFF0x01Disconnects and stops all interfaces.
DGI_CMD_GET_VERSION0x02Returns the version of the DGI implementation.
DGI_CMD_SET_MODE0x0A Sets the operating mode of DGI.
DGI_CMD_INTERFACES_LIST0x08Lists all available interface identifiers.
DGI_CMD_INTERFACES_ENABLE0x10Used to enable/disable interfaces.
DGI_CMD_INTERFACES_STATUS0x11Fetches the status for the interfaces.
DGI_CMD_INTERFACES_SET_CONFIG 0x12Sets the configuration for the specified interface.
DGI_CMD_INTERFACES_GET_CONFIG 0x13 Gets the configuration for the specified interface.
DGI_CMD_INTERFACES_SEND_DATA0x14 Sends data for transmission over specified interface.
DGI_CMD_INTERFACES_POLL_DATA0x15Returns the data buffer for the specified interface.
DGI_CMD_TARGET_RESET0x20Controls the state of the reset line of the target
DGI_RESP_OK0x80Verifies that the command was executed correctly.
DGI_RESP_FAIL0x99An error occurred during execution of the command. Usually caused
DGI_RESP_DATA0xA0 The command was executed correctly and returned data. The data is
DGI_RESP_UNKNOWN 0xFF The received command identifier is unknown.
2.1. DGI_CMD_SIGN_ON
The sign on command is always the very first command to be called. It will initialize all states, buffers, and
interfaces to a known starting point. A tool-specific string is returned as an acknowledgment of the sign
on.
Table 2-5. Command Packet
FieldSizeDescription
DGI_CMD_SIGN_ON (0x00)1 ByteCommand ID.
by wrong usage of the protocol.
command-specific and must be parsed accordingly.
Length (0)2 BytesNo parameters.
Table 2-6. Response Packet
FieldSizeDescription
DGI_CMD_SIGN_ON (0x00) 1 ByteCommand ID.
DGI_RESP_DATA (0xA0)1 ByteResponse code.
Length2 Bytes Length, n, of the acknowledgment string.
Stringn Bytes Acknowledgment string.
2.2. DGI_CMD_SIGN_OFF
The sign off command is the last command to be called. It will de-initialize all states, buffers, and
interfaces.
This command gets the version number of the DGI implementation. The latest version at the time of
writing is 3.1.
Table 2-9. Command Packet
FieldSizeDescription
DGI_CMD_GET_VERSION (0x02)1 ByteCommand ID.
Length (0)2 BytesNo parameters.
Table 2-10. Response Packet
FieldSizeDescription
DGI_CMD_GET_VERSION (0x02)1 Byte Command ID.
DGI_RESP_DATA (0xA0)1 Byte Response code.
Major version1 Byte Incremented only for big breaking changes.
Minor version1 Byte Incremented for each change relevant to the protocol.
2.4. DGI_CMD_SET_MODE
This command changes the operating mode of certain aspects of the DGI mechanisms and protocol.
Affected commands will have details in the command specific sections.
Table 2-11. Command Packet
FieldSizeDescription
DGI_CMD_SET_MODE (0x0A) 1 ByteCommand ID.
Length (1)2 Bytes
Mode1 ByteEach bit corresponds to a specific setting. Default value is 0.
•Bit 2
0: Use 2 byte length for poll response.
1: Use 4 byte length for poll response.
•Bit 0
0: Poll response does not include overflow indicator.
1: Add buffer overflow indicator to poll response.