Data Visualizer Softer User`s Guide

Description

Software

Data Visualizer

DRAFT USER GUIDE

The Atmel

®

Data Visualizer is a program to process and visualise data. The

Data Visualizer is capable of receiving data from various sources such as the Embedded Debugger Data Gateway Interface (DGI) and COM ports.

[DRAFT]

Atmel-B-Data-Visualizer_User Guide-09/2016

Table of Contents

Description.......................................................................................................................1

1. Overview....................................................................................................................3

1.1.

Getting Help..................................................................................................................................5

1.2.

Key Concepts............................................................................................................................... 5

1.3.

Launching Atmel Data Visualizer..................................................................................................8

2. External Connection.................................................................................................. 9

2.1.

Data Gateway Interface (DGI)......................................................................................................9

2.2.

Serial Port...................................................................................................................................25

3. Visualization.............................................................................................................28

3.1.

Terminal......................................................................................................................................28

3.2.

Graph..........................................................................................................................................31

3.3.

Oscilloscope............................................................................................................................... 46

3.4.

Power Debugging.......................................................................................................................56

3.5.

Custom Dashboard.....................................................................................................................68

4. Utilities..................................................................................................................... 86

4.1.

Samplerate Counter................................................................................................................... 86

4.2.

File Logger..................................................................................................................................86

5. Protocols..................................................................................................................87

5.1.

Data Stream............................................................................................................................... 87

5.2.

Atmel Data Protocol....................................................................................................................88

6. Example Code Snippets........................................................................................ 147

6.1.

Code Profiling Example Code.................................................................................................. 147

6.2.

Terminal Example Code........................................................................................................... 150

6.3.

Graph Example Code...............................................................................................................153

6.4.

Oscilloscope Example Code.....................................................................................................160

6.5.

Dashboard Example Code....................................................................................................... 164

7. Document Revision History................................................................................... 169

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

2

1. Overview

This chapter gives an overview of the main modules/features of the Atmel Data Visualizer. Each module is described in separate chapters with technical details of the module and usually including an example or use case showing how to use the module. As each chapter is rather self-contained it is possible to identify the module that covers your needs and jump straight to the chapter covering this module.

Data Gateway Interface (DGI)

Data Gateway Interface (DGI)

enables bi-directional communication over SPI, I

2

C, and USART, in addition to GPIO monitoring, power measurement, and code profiling.

Serial Port

Serial Port

communicates with any serial port on the system.

Terminal

Terminal

display and send simple text or numeric values.

Graph

Graph

can be used to plot data source values vs. time.

Cursors (time axis) to measure application timing, e.g. PWM frequency

Horizontal cursor (data values) to control an application's set point or threshold

Band highlights time periods above customizable thresholds

String markers can be used to add descriptive text to graphed events

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

3

Oscilloscope

Oscilloscope

Edge or threshold triggers on rising or falling edges

Run-stop control for single shot or continuous triggering

Cursors (time axis) to measure application timing, e.g. PWM frequency

Power Debugging

Power Debugging

• Correlation of code execution and power consumption

• Displays current and voltage measured using Power Debugger (Embedded debugger on Low

Power kits*)

Custom Dashboard

Custom Dashboard

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

4

• Build a custom user interface to visualize and control your application, using: Graph, Segment display, binary signals, labels, buttons, linear gauge: Value within defined range. Pie Chart, e.g. for packets lost vs transmitted in wireless application.

Utilities

Samplerate Counter

to validate MCU frequencies, e.g. rate of transmitted ADC samples

File Logger

module logs all incoming data to a file of selectable format

1.1. Getting Help

Help can be opened at any time by clicking F1. By selecting a module in the configuration window and clicking F1, help will be opened at the relevant chapter automatically.

1.2. Key Concepts

This section describes the key concepts to understand, when working with the Data Visualizer.

1.2.1. Workspace

Data Visualizer is made up of several elements, such as graphs, interfaces, and controls. All these elements form the workspace.

The elements are called modules, and you can add any of them to the workspace.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

5

Figure 1-1. Data Visualizer Workspace

1 2 3

4

5

1. Expand/Collapse Configuration pane button. 2. Configuration and Messages pane. 3. Active modules. 4. Minimize module button. 5. Remove module button. 

1.2.2. Connection Overview

The Data Visualizer communicates with the firmware running in the MCU of the embedded system.

Variables in the firmware can be transferred in both directions. In the following example, the temperature value is sent to the visualizer and plotted in a graph. The filter strength value is set by dragging the slider in the visualizer, and is then sent to the MCU.

Figure 1-2. Data Visualizer Connection Overview

Embedded system PC

MCU int temperature; int filter_strength;

USB or serial cable

Temperature

Filter

Strength

The communication can take place over a serial cable or over USB if the embedded system contains an

Embedded Debugger. (The Xplained Pro MCU boards contain Embedded Debuggers.)

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

6

1.2.3. Embedded Debugger's Data Gateway Interface

The Xplained Pro family of boards contain an Embedded Debugger chip. It has a Data Gateway Interface

(DGI) that lets the MCU easily communicate with the Data Visualizer through either its SPI or TWI interface, or by GPIO pins.

Figure 1-3. The Data Gateway Interface

Xplained Pro series board

MCU

Embedded

Debugger

SPI

TWI

GPIO

In the Data Visualizer, the DGI Control Panel is the module that communicates with the Embedded

Debugger's Data Gateway Interface. When the board is connected to the computer with the USB cable, it can be selected in the control panel. A list of available interfaces will appear. Enable one or more of them by checking the boxes. In the figure above, the SPI interface is enabled. Now, the MCU can communicate with the Data Visualizer on its SPI port.

1.2.4. Simple Transfer

Sending a single value from the MCU to the Data Visualizer is quite simple. In the figure below, the MCU sends the temperature variable over its SPI interface. In the visualizer, the SPI interface on the

Embedded Debugger has been enabled. The Embedded Debugger will transmit the SPI data to the visualizer through the DGI Control Panel.

Figure 1-4. A Simple DGI Transfer

To visualize the temperature data, a Graph has been added. The SPI data is routed to the plot by dragging the plug icon from the SPI interface the DGI Control Panel, and dropping it in the plot area.

This will add a new plot to the Graph module.

1.2.5. Endpoints

Data in the Data Visualizer originates from and ends in an endpoint. The endpoints are referred to as

sinks and sources. A data source sends data to one or more connected sink.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

7

In the workspace, the endpoints are represented by the graphical symbols shown below.

Figure 1-5. Data Source

Figure 1-6. Unconnected Data Sink

Figure 1-7. Connected Data Sink

1.3. Launching Atmel Data Visualizer

Atmel Data Visualizer is included as part of the Atmel Studio installer, and can be run either as a Studio extension or in standalone mode.

To run Atmel Data Visualizer as an extension inside Atmel Studio, select it in the Tools menu:

Kits supporting Data Visualizer functionality include a shortcut to the extension on their start page in

Atmel Studio.

If the standalone version of Atmel Data Visualizer has been installed, look for the shortcut in Windows

® start menu. The standalone version is available for download from gallery.atmel.com

.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

8

2. External Connection

All communication to the outside world is handled by modules found under the external connection section.

The DGI Control Panel communicates with any tool that has the Data Gateway Interface. It is capable of bi-directional communication over SPI, I

2

C, and USART, in addition to GPIO monitoring, power measurement and code profiling. The feature set varies by tool.

The Serial Port Control Panel communicates with any serial port on the system.

2.1. Data Gateway Interface (DGI)

The Data Gateway Interface is available on most kits with an Atmel Embedded Debugger. The DGI control panel can communicate with a DGI device. The figure below shows the DGI control panel module.

Figure 2-1. Data Gateway Interface Control Panel

All detected DGI devices are listed in the drop-down list with kit name and serial number. Using the

Connect button will connect to the selected DGI device and query for available interfaces. The available interfaces will be listed under Interfaces. To enable an interface, check the box next to the name. When an interface is enabled, the sources and sinks can be connected to other endpoints. The gear button is used to configure the interface. See the interface specific sections for an explanation of the configuration fields.

To start polling data from the interfaces, click the Start button. The Reset MCU check box will cause the

MCU to be held in reset during start.

The Autodetect ADP check box is used to attempt auto-detection of the Atmel Data Protocol on any interface. When pressing Connect with auto detection enabled, all interfaces will be enabled for 3 seconds while it looks for the ADP handshake message. The USART interface will test various common baud rate settings; 9.6kbps, 19.2kbps, 38.4kbps, 57.6kbps, 115.2kbps, 230.4kbps, 500kbps, 1Mbps,

2Mbps, and synchronous mode. If an ADP handshake packet is detected, the ADP module will automatically be added and connected to the correct interface.

For more information on ADP see Atmel Data Protocol .

2.1.1. SPI Interface

The SPI interface source contains the raw values received on the SPI interface. The sink sends values received back out on the SPI bus. For further details on the physical part of the SPI interface, see the user guide of the debugging tool to be used to sample the SPI data.

Important:  If the SPI sink is connected to a source with a multi-byte type, byte order may be unpredictable.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

9

Important:  The SPI hardware module uses an active low chip select (CS) signal. Any data sent when the CS pin is high will be ignored.

The SPI Configuration dialog is opened from the SPI interface in the DGI control panel.

Table 2-1. Configuration

Field name

Transfer Mode

Values

• SCK normally low, Read data on rising edge

• SCK normally low, Read data on falling edge

• SCK normally high, Read data on falling edge

• SCK normally high, Read data on rising edge

Force synchronization on CS

ON or OFF

Enable timestamping ON or OFF

Usage

SPI mode, controlling clock phase and sampling.

The SPI interface is only enabled after the chip select line has toggled twice.

Data is timestamped through the

DGI time stamp interface (yields a slower transfer rate).

Related Links

Sink Data Conversion on page 24

2.1.2. USART Interface

The USART interface source contains the raw values received on the USART interface. The sink sends values received back out on the USART interface. For further details on the physical part of the USART interface, see the user guide of the debugging tool to be used to sample the USART data.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

10

Important:  If the USART sink is connected to a source with a multi-byte type, byte order may be unpredictable.

The USART Configuration dialog is opened from the USART interface in the DGI Control Panel.

Table 2-2. Configuration

Field name

Baud rate

Char length

Parity type

Stop bits

Synchronous mode

Values

0-2000000

5, 6, 7, or 8 bits

None, Even, Odd, Mark, or

Space

1, 1.5, or 2 bits

ON or OFF

Enable time stamping ON or OFF

Usage

Baud rate for UART interface in asynchronous mode

Number of bits in each transfer

Parity type used for communication

Number of stop bits

Selecting synchronous or asynchronous mode

Data is timestamped through the DGI time stamp interface (yields a slower transfer rate)

Related Links

Sink Data Conversion on page 24

2.1.3. TWI Interface

The TWI interface source contains the raw values received on the TWI interface. The sink sends values received back out on the TWI interface. For further details on the physical part of the TWI interface, see the user guide of the debugging tool to be used to sample the TWI data.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

11

Important:  If the TWI sink is connected to a source with a multi-byte type, byte order may be unpredictable.

The TWI Configuration dialog is opened from the TWI interface in the DGI control panel.

Table 2-3. Configuration

Field name

Address

Values

0-127

Usage

TWI slave address

Speed 100000, 400000 Speed setting for TWI slave. Used for timing.

Enable time stamping ON, OFF Data is timestamped through the DGI time stamp interface

(yields a slower transfer rate)

Related Links

Sink Data Conversion on page 24

2.1.4. GPIO Interface

The GPIO interface source is of type uint8, and contains the bit values of the enabled GPIO pins. A packet is transmitted every time a pin toggles. The sink sends values received back out to the GPIO pins.

For further details on the physical part of the GPIO interface, see the user guide of the debugging tool to be used to sample the GPIO data.

The GPIO Configuration dialog is opened from the GPIO interface in the DGI control panel.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

12

Table 2-4. Configuration

Field name Values

GPIO 0 Monitor ON, OFF

GPIO 1 Monitor ON, OFF

GPIO 2 Monitor ON, OFF

GPIO 3 Monitor ON, OFF

Usage

Monitor GPIO pin 0

Monitor GPIO pin 1

Monitor GPIO pin 2

Monitor GPIO pin 3

GPIO 0 Output ON, OFF

GPIO 1 Output ON, OFF

GPIO 2 Output ON, OFF

GPIO 3 Output ON, OFF

Mode

Enable GPIO pin 0 output

Enable GPIO pin 1 output

Enable GPIO pin 2 output

Enable GPIO pin 3 output

Pin, Bus, Latched Bus GPIO pins as separate pins, a 4-bit bus, or a 3-bit bus that is latched on rising edge of GPIO3

Related Links

Sink Data Conversion on page 24

2.1.5. Power Interface

The Power interface measures the power consumption of the connected circuitry. For more information on the hardware part of the power interface, see the user guide of the debugging tool to be used for the power measurements.

The Power Configuration window is opened from the Power interface in the DGI control panel.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

13

The content of the Power Configuration window will vary depending on the capabilities of the connected debugging tool.

Table 2-5. Power Configuration Options

Field name

Enable B

Channel

Trigger calibration

Values Usage

ON, OFF Enables the second power measurement channel. The A channel is always enabled.

ON, OFF Triggers the calibration procedure of the current measurement circuitry.

For further details, see Power Measurement Calibration

.

Enable Range

Source

ON, OFF Provides a range source, indicating which range is in use for the primary power measurement channel. The physical hardware used to measure power consumption will have different configurations depending on the instantaneous current measured. Each configuration is referred to as a range.

Lock ChA to High

Range

ON, OFF On the Power Debugger you can lock the A channel to the high range to avoid automatic switching to the low range. This allows you to detect short spikes in current consumption without critical samples being lost when switching between the ranges.

Voltage Output 0 - 5500mV The Power Debugger features an adjustable target supply that can be used to power the target application. This setting controls the output voltage of this supply. Any values below 1600mV results in the supply being switched off.

Tip:  The channel A range lock will not force the debugger to return to the high current range if already running in the low range. Either wait for a current high enough to force it to change, or simply Stop and Start the debugger

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

14

Important:  The Power interface can only be used with the Power module. Neither the

Oscilloscope module nor the Graph module can be used with the Power interface.

2.1.6. Code Profiling

The Code Profiling interface uses the SWD interface of Atmel Cortex

®

-M0+ devices to access the internal program counter and memory locations. It provides timestamped samples of the program counter address, allowing an insight in the program execution of the device. The user can also select arbitrary memory addresses to poll and control data variables at those location.

2.1.6.1. Code Profiling Interface

The Code Profiling interface uses the SWD interface of Atmel Cortex

®

-M0+ devices to access the internal program counter and memory locations. It provides timestamped samples of the program counter address, allowing an insight in the program execution of the device. The user can also select arbitrary memory addresses to poll and control data variables at those location.

For an example on how to configure and use the Code Profiling interface, see Code Profiling

Configuration Example

.

Important:  Data polling is only available when Data Visualizer is run as an extension within

Atmel Studio. This is because it needs to access the debug system on the device through the

Atmel Studio debugger backend.

The Code Profiling Configuration window can be opened after enabling the Code Profiling interface in the DGI Control Panel.

The Code Profiling Configuration window options are explained in the table below.

Table 2-6. Configuration

Field name Values Usage

Enable Code

Location

Add Memory Location

ON, OFF Controls the state of the program counter sampling.

Adds a new entry of memory location to poll and control. A text-box for entering the address (hexadecimal), selecting data type and a delete button will appear.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

15

Important:  Declaring variables you are interested in polling as volatile will ensure that they are placed in SRAM and that their values will not be cached in registers by the compiler. Registers cannot be polled, only SRAM locations.

Tip:  Data polling operates on absolute SRAM locations. It's advised to use global variables for this purpose so that they're always available at the same location in SRAM. Polling locations in the stack can yield unpredictable results based on the stack context at the time of polling.

2.1.6.2. Code Profiling Configuration Example

An example on how to use program counter sampling for power consumption analysis can be found in

Program Counter Polling . The same Mass Storage Class example used in this section is also suited as

an example on how to use the data polling and control of data variables features. A SAM L21 Xplained

Pro board is connected to a host computer both trough Target USB and Debug USB connectors on the kit. The ATSAML21 target device is running the USB Device MSC Example from ASF for SAM L21

Xplained Pro.

For more information on the hardware setup and target application code used in this example, see Code

Profiling Example Code

.

Although this example makes use of the Graph and Dashboard modules the principles are the same for using the Code Profiling interface with the other modules in the Data Visualizer.

First a graph will be set up to monitor variables in the target application.

To do: 

• Enable the Code Profiling interface by ticking off the check box for the Code Profiling interface in the DGI Control Panel

To do: 

• Open the Code Profiling Configuration window by pushing the gear button

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

16

To do: 

• Push Add Memory Location button for each memory location to be added

• Fill in the address and format of each location

To do: 

• Open the Configuration panel in Data Visualizer

• Add a graph by double clicking the Graph module

A new Graph element will open with one y axis configured. However, we have two unrelated variables to monitor, so we need two axes.

To do: 

• Click the Add axis button to add an additional axis

• For each of the axes, click the Add Plot button

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

17

We now have the sources (variables) and sinks (axes), so its just to connect them together.

To do:  Drag each of the source plugs on the Code Profiling interface into the Input (sink) jack of the plot.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

18

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

19

To do:  In Atmel Studio click Continue (F5) to resume execution.

Tip:  A USB device in the HALT state no longer responds to Windows events, and may be disconnected from the bus if held in this state for too long. To remedy this simply reset execution in Atmel Studio.

Look at the output in the graph in Data Visualizer. Format the disk and watch how the write cycles counter increments. Both values are plotted on independent axes, so they can be scaled accordingly. The output should look something like this:

The following part of this example shows how to use a dashboard to interact with the target application.

For more information on the required code changes in the target application, see Application Interaction using Dashboard Controls .

To do: 

• Open Data Visualizer

• Connect

• Add the location of the frame_comparator in the Code Profiling Configuration window

A Data Visualizer dashboard can now be made with controls which manipulate the value of this variable.

To do: 

• Open the configuration panel

• Add a new I/O Dashboard component by double clicking the I/O Dashboard module

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

20

We can now add a slider control to the dashboard.

To do: 

• Check the Edit checkbox

• Open the Elements tab

• Drag a Slider element onto the dashboard

A slider control needs to have some configuration parameters.

To do:  Select the slider element and set its properties:

• Maximum = 500

• Minimum = 100

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

21

We can now add a segment display control to the dashboard.

To do: 

• Check the Edit checkbox

• Open the Elements tab

• Drag a Segment Display element onto the dashboard

A segment display control needs to have some configuration parameters.

To do:  Select the segment display element and set its properties:

• Segment Count = 3

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

22

The slider control can now be used as a source which can be connected to any relevant sink in Data

Visualizer. The segment display can similarly be used as a sink to connect any relevant source to.

The Code Profiling data polling interface provides both a source of data and a sink of data. We can now connect the slider to the sink and the segment display to the source.

To do: 

• Uncheck the Edit checkbox

• Check the Show Endpoints checkbox

• Connect sources to sinks by dragging each source plug and drop it on a sink

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

23

Now that the connections have been made in Data Visualizer, we can put the system into a running state and interact with the variable through the GUI.

To do: 

• Uncheck the Show Endpoints checkbox

• Start Data Visualizer

• Resume execution in Atmel Studio (F5)

The slider is now in control of the frame_comparator variable in the application code. Drag the slider, and notice that the LED blink frequency changes. Any change in the slider position will be sent to the target device through the debug interface, and a new value stored to the variable. At the same time the value is also read back from the target, and displayed on the segment display.

2.1.7. Sink Data Conversion

Since DGI only can handle 8-bit values natively, all values received by DGI are remapped according to the rules in the following table.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

24

Table 2-7. Data Conversion

Data type

Int8

Uint8

Int16

Uint16

Int32

Uint32

Float

Double

XY8

XYu8

XY16

XYu16

XY32

XYu32

Conversion

Cast to uint8. 2's complement value is retained.

2's complement value is retained. Split into two uint8 values. Big-endian.

Split into two uint8 values. Big-endian.

2's complement value is retained. Split into four uint8 values. Big-endian.

Split into four uint8 values. Big-endian.

Cast to Int32

Cast to Int32

X-value sent first, then Y-value

X-value sent first, then Y-value

X-value sent first, then Y-value

X-value sent first, then Y-value

X-value sent first, then Y-value

X-value sent first, then Y-value

XYFloat

XYDouble

X-value sent first, then Y-value

X-value sent first, then Y-value

String The ASCII values of each character is sent. A null-termination is added.

StringFloat Sent as a Int32 with the string following

Boolean False is sent as 0, true as 1

2.1.8. Data Polling

The communication with the Data Gateway Interface (DGI) is done through a separate C++ DLL. When a session is started it will poll the DGI device for data each 2ms. However, because the CPU could be busy with other tasks, the polling might happen with a longer interval.

Since the DGI device has a limited buffer, the DLL needs to poll the device regularly to avoid an overflow.

Therefore, it is important to keep the CPU usage low during polling sessions. In case of overflow problems, either decrease the transfer rate on the DGI interfaces or decrease the CPU load by shutting down applications.

2.2. Serial Port

The Data Visualizer can be connected to a standard PC serial port. The Serial Port Control Panel is found under External Connection in the Modules section of the Configuration tab in the Data

Visualizer.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

25

Baud rate, stop bits, and parity must be set to match the required settings for the communication partner.

A sink and a source endpoint is present to represent the outgoing and incoming data for the serial port.

The endpoints of the serial port control panel is of uint8 data type, and follows the same conversion rules as the DGI control panel. The Open Terminal check box will cause a terminal module to automatically open and connect the endpoints. When disconnecting from a serial port, the created terminal module will be closed.

Figure 2-2. Serial Port Control Panel

Table 2-8. Configuration

Field name

Baud rate

Parity

Stop bits

DTR

RTS

[DRAFT]

Values

0-115200

None, Even, Odd, Mark, or

Space

1, 1.5, or 2 bits

ON or OFF

ON or OFF

Usage

Baud rate of serial interface

Parity type used for communication

Number of stop bits

Data Terminal Ready control signal of RS232 serial communication

Request To Send control signal of RS232 serial communication

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

26

Field name

Open Terminal

Autodetect ADP

Values

ON or OFF

ON or OFF

Usage

Opens a terminal upon connection with the source and

sink connections automatically connected between the Serial

Port Control Panel serial port and the terminal

Auto-detection of the Atmel Data

Protocol on any interface. For more information on the protocol see

Atmel Data Protocol

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

27

3. Visualization

Incoming data can be visualized using the modules contained under this section.

The Terminal displays data as text, either as raw values or ASCII encoded characters. It is also capable of sending text based data.

The Graph module visualizes incoming data over time as plots, bands, and string flags. Cursor helps analyze the data, and can provide output values for setting thresholds.

The Oscilloscope module is helpful for analyzing time repeating patterns in a data stream.

The Power Analysis module is made specifically for analyzing power consumption over time. It can also be used with code profiling to visualize program counter samples to get an overview of the program execution versus power consumption.

The Custom Dashboard module is a customizable canvas to create user interfaces matching the application. It features the most common user inputs such as buttons, sliders, and check-boxes, in addition to graphing etc.

3.1. Terminal

The Terminal module is a raw terminal for displaying and sending simple text or numeric values.

3.1.1. Terminal Module

The Terminal module is used to display and send simple text or numeric values. For an example on how to configure a terminal, see

Terminal Configuration Example

.

Figure 3-1. Terminal

1

2

3

4

5

6

7

8

9

1. Input text box. 2. Output text box. 3. Output source. 4. Input sink. 5. Clear button. 

6. Automatic line feed checkbox. 7. Hexadecimal mode checkbox. 8. Display timestamp checkbox. 9. Autoscroll checkbox. 

3.1.1.1. Connecting the Terminal and Displaying Data

Data streams are connected to the terminal through the sink and source endpoints. Drop an external

source onto the terminal sink, or drag and drop the terminal source onto an external sink. Data coming into the terminal's sink endpoint will be presented in the input text box.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

28

3.1.1.2. Sending Data

When the source of the terminal has been connected to a sink endpoint, data can be sent by typing data in the input text box and pressing enter. Whatever was typed in the text box will be cleared after transmission. The text box supports the use of break characters (e.g. \x55, which will result in the raw value 0x55 being transmitted).

3.1.1.3. Setting Hexadecimal Mode

Data is normally assumed to be an ASCII encoded stream of data. To display the hexadecimal value of the data, check the Hexadecimal mode checkbox.

3.1.1.4. Resizing the Input Text Box

The input text box is re-sizable by clicking and dragging the lower part of the box.

3.1.2. Terminal Configuration Example

The following example shows how to connect the SPI interface to a terminal. However, the procedure is the same for any of the other available data sources. The target code used in this example can be found

in Terminal Example Code .

To do:  Select correct tool in the DGI Control Panel.

To do:  Click Connect to make a connection to the DGI on the selected tool.

To do: 

• Check the SPI checkbox

• Open the SPI Configuration dialog by pushing the gear button next to the SPI checkbox

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

29

To do: 

• Set Transfer Mode to SCK normally low, Read data on rising edge

• Enable the Force startup synchronization on CS option

To do: 

• Open the configuration panel

• Add a Terminal view to the Visualizer

• Drag the source connector from the interface in the DGI Control Panel into the sink for the Terminal to make a connection

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

30

To do: 

• Start the session

• Press the button (SW0) on the Xplained Pro board

On each button push the LED0 on the board should toggle and a message appear on the terminal.

Sometimes more than one message appears for each button press. This is an indication that some debouncing algorithm is needed in the button sample routine. It is a lot easier to spot this problem by looking at the terminal output than to watch the LED toggling.

3.2. Graph

The Graph module is a versatile graph plotting tool.

3.2.1. Graph Module

The Graph module is a versatile graph plotting tool. The large plot area has one time axis, and one or more value axes (Y axes). The value axes are stacked on top of each other. For an example on how to configure a graph, see

Graph Configuration Example .

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

31

Figure 3-2. Graph with a Plot, Band, String Marker, and Cursor

7

8

9

1. Plot area. 2. String marker. 3. Horizontal cursor. 4. Plot. 5. Band. 6. Time axis. 7. Y axis. 

8. Plot cursors. 9. Configuration panel. 

There are four types of elements that can be added to an Y axis:

• Plot

• Band

• String marker

• Horizontal cursor

Each of these elements are described in the following sections.

3.2.1.1. Graph Configuration Panel

Through its Configuration panel, the Graph module is connected to the rest of the system. Here you can add more axes, plots, and other graph elements. Here you will also connect the graph elements by connecting sources and sinks.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

32

3

4

5

6

2

1

Figure 3-3. Graph Controls

1 2 3

1. Add axis button. 2. Auto-scroll checkbox. 3. Automatically fit Y checkbox. 

Add Axes

Figure 3-4. Graph with Two Y Axes

Press the Add axis button to add an Y axis to the graph. It will show up in the plot area, and its controls will be added to the bottom of the Configuration panel.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

33

Delete Axes

1.

If the configuration section for the axis you want to delete is hidden, first expand it by clicking the arrow icon.

2.

Delete the axis by pressing its Delete Axis button.

Enabling and Disabling Auto-scrolling

Auto-scrolling locks the plot area to include the latest arriving samples. If auto-scrolling is disabled, you can manually scroll the plot by dragging the time axis with the mouse or with the scroll wheel.

Auto-scrolling is enabled by checking the Auto-scroll check box.

Auto-sizing the Y Axis

When the Automatically Fit Y check box is checked, the Y axis will automatically zoom in or out in order to fit the whole sample range of the plots in that axis.

3.2.1.2. Plot

A plot is a curve describing a changing value. The curve is drawn between the data samples it receives from the data source. The samples can arrive sporadically, or at a fixed interval. If the data source is known to be sampling at a fixed rate the plot can be set to this sample rate. This way, the curve will be shown correctly even if there are some elasticity in the transmission of the samples. If the samples come at an irregular rate, set the sample rate to 0. This will make the graph position the samples along the time axis according to the sample's time stamp. If there is more than one plot in the graph, each plot will update when new data arrives for that plot.

When adding a plot to an axis, the new plot's Plot control panel will be placed under that axis in the

Graph configuration panel.

Figure 3-5. Plot Controls

1 2 3 4 5 6

7

8

9

10

1. Plot label. 2. Enable check box. 3. Line color indicator. 4. Data sink. 5. Sample rate edit box. 

6. Sample rate set button. 7. Delete plot button. 8. Plot status. 9. Show Cursors option. 

10. Cursor data. 

Connecting the Plot

To connect a plot to a data source, drag the data source plug symbol and drop it on the plot's data sink connector symbol.

Disable a Plot

To stop showing a plot in the graph's plot area, uncheck the plot's Enable check box.

Change the Plot Color

The plot line's color can be changed:

1.

Click on the plot's line color indicator.

2.

In the dialog box that opens, adjust the color by dragging the Red, Green, and Blue sliders. Press

OK.

3.

The plot line and the line color indicator has now changed to the new color.

Plot Data at a Fixed Sample Rate

If the data source sends data to the plot at a fixed rate, you can set the plot's sample rate. Enter the number in the Sample rate text box and press the Set button.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

34

Plot Time-stamped Data

If the data arrives at irregular intervals, the graph will present a more accurate view if the samples are placed using the sample's time-stamp.

To plot using time-stamps, enter 0 into the Sample rate text box and press the Set button.

Remove a Plot

To remove a plot from an axis, press the Delete button in the plot's control panel.

Cursors

If the Show Cursors option is enabled two vertical cursors will show up in the plot area. The cursors can be moved by the mouse and the Plot Controls panel shows data related to the cursors.

3.2.1.3. Band

A band is a vertical marking in the plot area that highlights the plot background with the band color. If you, for example, have a plot of a temperature reading, you can then add a band that highlights portions of the plot where the temperature is above a certain value.

Figure 3-6. Graph Module Showing a Plot and a Band

A band has a minimum and a maximum limit. The band will be active, on, if the input to the band is between these two values.

Figure 3-7. Band Controls

Connecting the Band

To connect a band to a data source, drag the data source plug and drop it on the band's data sink connector.

Setting the Band Color

Click the band color indicator. A dialog box will open. Change the RGB values, and press OK.

Note: 

When changing the band color, the change will not affect band regions already in the graph. Only new band regions will have the new color.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

35

Setting Inverted Band Limits

Figure 3-8. Band with Inverted Behavior

Min limit

Max limit

If the maximum limit is set to a value less than the minimum value, the band will behave in an inverted manner. Now, the band will be active when input value is less than the maximum limit, or if the input value is greater than the minimum limit.

• Enter the minimum and maximum values, and make sure the maximum value is less than the minimum value. Press the Set button.

Setting the Band Color

Click the band color indicator. A dialog box will open. Change the RGB values, and press OK.

Note: 

When changing the band color, the change will not affect band regions already in the graph. Only new band regions will have the new color.

Remove a Band

To remove a band, press the Delete button in the band's control panel.

3.2.1.4. String Markers

When the source sends a string, the string marker will attach these short messages to the graph. These markers will be placed according to the timestamp of the sample.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

36

Figure 3-9. Graph with Plot and Two String Markers

Connecting the String Marker

To connect a string marker to a data source, drag the data source plug and drop it on the string marker's data sink connector.

Setting the String Marker Color

Click on the string color indicator in the String control panel. Change the RGB values, and press OK.

Note: 

When changing the string marker color, the change will not affect string markers already in the graph.

Only new string markers will have the new color.

Expanding and Collapsing String Markers

When large strings are sent to a string marker, the marker will collapse into a small box to reduce the space it occupies in the plot area.

Figure 3-10. Expanded and Collapsed String Marker

To see the text, it must be expanded.

• Expand and collapse a string marker by double clicking the marker

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

37

Remove a String Marker

To remove a string marker, press the Delete button in the string's control panel.

3.2.1.5. Horizontal Cursor

The Horizontal cursor is a horizontal line in the graph that when dragged up or down outputs a value that can be used as a source.

Tip:  Use the Horizontal cursor to control an application's set point or threshold.

Figure 3-11. Graph Plot and Cursor

Connecting the Cursor

To connect a cursor to a data sink, drag the cursor's data source plug and drop it on the target's data

sink connector.

Changing the Cursor Value

To change the cursor value, position the mouse over the cursor line. The mouse cursor will change into a handle. Click and drag the cursor to its new position.

Setting the Cursor Color

Click the Cursor color indicator in the Cursor control panel. A dialog box will open. Change the RGB values, and press OK.

Remove a Cursor

To remove a cursor, press the Delete button in the cursor control panel.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

38

3.2.1.6. Zooming and Panning

When the Auto-scroll and Automatically fit Y check boxes are checked, the last samples will be shown and the Y axis will be zoomed such that all values will be visible.

If you would like to manually zoom in or out or inspect a region in more detail, you can disable these options and zoom and pan using the mouse.

Zooming the X Axis

The X axis can be zoomed in two different ways:

• Using the mouse scroll wheel

1.1.

1.2.

1.3.

Click somewhere inside the plot area.

Press and hold the SHIFT key on the keyboard.

Scroll the mouse wheel in either directions.

The X axis will zoom in or out (depending on which way you turned the mouse wheel), centered around the mouse cursor.

• Dragging the X axis resize markers

2.1.

2.2.

Position the mouse cursor over one of the X axis' resize markers. The mouse cursor will change into horizontal resizing arrows.

Click and drag horizontally.

Zooming the Y Axis

The Y axis can be zoomed in two different ways:

• Using the mouse scroll wheel

1.1.

1.2.

1.3.

Click somewhere inside the plot area.

Press and hold the CTRL key on the keyboard.

Scroll the mouse wheel in either directions.

The Y axis will zoom in or out (depending on which way you turned the mouse wheel), centered around the mouse cursor.

• Dragging the X axis resize markers

2.1.

2.2.

Position the mouse cursor over one of the X axis' resize markers. The mouse cursor will change into vertical resizing arrows.

Click and drag vertically.

Panning

You can pan around the graph in two ways:

• Dragging the plot area

1.1.

1.2.

1.3.

Position the mouse cursor inside the plot area.

Click and hold the left mouse button.

Drag the mouse.

• Dragging the axes

2.1.

2.2.

Position the mouse cursor over one of the axes. The cursor will change into a pointing hand.

Click and drag the axis.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

39

3.2.2. Graph Configuration Example

This chapter gives an example on how to configure the Graph module to be used with a target application implementing a night mode switch with a light sensor. Although this example only utilizes some of the data sources available in the Data Visualizer the procedure will be the same for all data sources. The

target code used in this example and a description of the hardware setup can be found in Graph Example

Code

chapter. The first part of the configuration example uses the code found in the first subsection of the

example code chapter ( Basic Graph ). When changes to the target application code are required as the

example progress a link to the corresponding code listing will be provided.

To do:  Select correct tool in the DGI Control Panel.

To do:  Click Connect to make a connection to the DGI on the selected tool.

To do: 

• Check the SPI checkbox

• Open the SPI Configuration dialog by pushing the gear button next to the SPI checkbox

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

40

To do: 

• Open the configuration panel

• Add a Graph module to the Data Visualizer

• Add a new plot to the graph by pushing the Add Plot button

• Drag the source connector from the interface in the DGI Control Panel into the sink for the plot to make a connection

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

41

To do: 

• Push Start in DGI Control Panel

The data will be plotted in the Graph module. It could look something like the picture below when hovering your hand above the light sensor.

The light sensor data can be used to switch between day and night mode. For the night mode switch to be useful the threshold when switching between the modes are important. The Graph module contains a useful feature called Band to mark when the plot data is within a certain range. This can be used to simplify the selection of the mode switch threshold.

To do: 

• Push Add Band in the Graph module

• Drag the interface source to the Band sink

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

42

To see that the night mode switch is actually working and switching at the right threshold the string marker feature of the Graph module is useful. In this example the CDC USART interface of the target board is used to send a string each time the mode is switched. These messages can then be shown in the graph as string markers. The target application source code for this part of the configuration example can be

found in Adding String Markers .

To do: 

• Open the Serial Port Control panel found under External Connection in the Modules section of the Configuration tab in Data Visualizer

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

43

To do: 

• Select the correct COM port corresponding to the connected kit (the Windows device manager can be used to identify the correct COM port)

• Set the serial port parameters according to the application code

• Make sure Open Terminal option is not checked

To do: 

• In the Graph module push Add String

• Drag the serial port source to the String sink

• Push Connect in the Serial Port Control Panel

String markers will appear as vertical lines with a square on top. By double-clicking the square the string text will be shown. Note that there will naturally be some delay from the ADC data values crosses the threshold until the string message reaches the host computer. In addition, the time-stamping of the data is added on the host computer and the two serial interfaces are not synchronized. This results in a misalignment of the string markers compared to the ADC values. DGI includes time-stamping functionality

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

44

on the EDBG on the Xplained Pro and this can be enabled in the DGI Control Panel at a performance cost, but CDC includes no time stamping functionality.

Tip:  In this example a separate serial interface was used for the string marker data. If the number of serial interfaces available are constrained, the same interface could be used to stream both the ADC data and the string marker data by using the Atmel Data Protocol (ADP).

For more information, see the Atmel Data Protocol .

So far the Graph module of the Data Visualizer has been used to show the data generated by the light sensor and to show when the night mode switch toggles between the two modes. The Graph module can also be used to interact with the target application while it is running. In this example the night mode threshold can be adjusted dynamically by using a horizontal cursor.

The target application source code for this part of the configuration example can be found in Using

Horizontal Cursor Code

.

To do: 

• First remove the band from the graph as it is of no use when the night mode threshold is dynamic

• Push Add Horiz. Cursor to add a horizontal cursor to the graph

• Drag the Horizontal Cursor source to the sink in the Serial Port Control Panel

The horizontal cursor will start out with a default value of 0. Every time the cursor is moved the Data

Visualizer sends a new float value to the serial port the cursor is connected to.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

45

Tip:  Turn off Auto-scroll and Automatically fit Y to more closely examine a plot while it is still running.

3.3. Oscilloscope

The Oscilloscope module visualizes data values in real-time. The oscilloscope features a trigger submodule to capture repeating signals or rare events. The oscilloscope also has a cursor system to measure various properties of the data streams.

3.3.1. Oscilloscope Module

The Oscilloscope module visualizes data values in real-time. It has four channels for monitoring four different data streams at the same time. Each channel's data stream is visualized as a graph in the plot area, each with a different color. The vertical position and amplitude of each channel can be modified. For repeating signals, or for capturing rare events, the oscilloscope has a trigger sub-module. The oscilloscope also has a cursor system to measure various properties of the data streams.

For an example on how to configure an oscilloscope, see Oscilloscope Configuration Example

.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

46

Figure 3-12. The Oscilloscope Module

2

1

9

3

4

5

6

7

8

1. Plot area. 2. Zero-line. 3. Plot. 4. Trigger level indicator line. 5. Time axis scale handle. 

6. Time axis. 7. Plot area re-size handle. 8. Control panel. 9. Show/hide control area arrow. 

3.3.1.1. Oscilloscope Control Panel

The Oscilloscope control panel is where the oscilloscope is configured and connected to the rest of the system. The control panel has five sections, which are described in detail in the following sections.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

47

Figure 3-13. Oscilloscope Control Panel

Vertical Controls

The vertical control section has four sub-sections, one for each of the four oscilloscope channels. The channel controls are disabled until a source is connected to the channel sink.

Connecting the Oscilloscope

Signals or data streams are connected to the oscilloscope through the channel sink endpoints. Drop an external source onto the sink. When connected, the rest of the channel controls will be enabled.

Adjusting the Channel Amplitude

When a channel is displayed in the plot area, the signal's height is determined by the channel amplitude setting.

There amplitude can be adjusted in three different ways:

• Enter an amplitude value into the text box. Deselect the text box to let the new value take effect.

• Click on the up/down arrows located to the right of the text box

• With the mouse cursor positioned over the text box, scroll the mouse wheel to increase/decrease the amplitude setting

Show and Hide a Channel

When a channel is in use, you can hide its plot from the plot area by clearing the Amplitude check box.

Check it to show the plot again.

Adjusting the Channel Offset

The channel's vertical position in the plot area can be adjusted with the Offset setting. The offset value is the channel's zero-point's distance above the bottom of the plot area.

There are four ways to adjust the offset:

• Enter an offset value into the text box. Deselect the text box to let the new value take effect.

• Click on the up/down arrows located to the right of the text box

• With the mouse cursor positioned over the text box, scroll the mouse wheel to increase/decrease the offset setting

• If the channel's zero line is enabled in the plot area, you can drag it to a new position

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

48

Show and Hide the Zero Line

A zero line is by default shown when a channel is enabled by connecting it to a source. The zero line is a horizontal line shown in the plot with the same color as the channel's color. It also has a 0 label on the left end.

The zero line can be shown/hidden by checking/clearing the Offset check box.

Customize the Channel Name

When you add the oscilloscope module to the workspace, the four channels are labeled Channel 1 to

Channel 4. You can change the label, as a reminder of what signal is connected to that channel.

• Click inside the label and type in the new name

Run Control

The Run/Stop and Single buttons are the run control. These buttons control if the plots are updated or not.

There are three operating modes:

• Stop (the Run/Stop button is red)

• Single (the Single button is yellow)

• Run (the Run/Stop button is green)

Enter Run Mode

When the stop or single operating mode is active (red or yellow light), you can enter the run mode by pressing the Run/Stop button. The button will turn green, and the plots will continuously update according to trigger settings.

Enter Single Mode

When the stop or run operating mode is active (red or green light), you can enter the single mode by clicking the Single button. The button will turn yellow, and the plots will trigger and update only once.

Enter Stop Mode

When the single or run operating mode is active (yellow or green light), you can enter the stop mode by pressing the Run/Stop button. The button will turn red, and the plots will freeze.

Trigger Controls

The Oscilloscope trigger sub-module helps you to identify and lock on to only the portion of the input signal that you want. Depending on the operating mode set by the run controls, the trigger can:

• Lock on to a periodic signal and constantly update the plot

• Only update the plot when the signal exceeds some level

Edge Triggering

The edge triggering mechanism is looking for the signal to cross the trigger level. For a positive edge trigger, the signal must go from below the trigger level, to above the trigger level.

Figure 3-14. Positive Edge Trigger

1 2 3

Trigger level

1. No trigger – the line must cross. 2. No trigger – wrong direction. 3. Trigger point. 

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

49

Figure 3-15. Negative Edge Trigger

1 2 3

Trigger level

1. No trigger – the line must cross. 2. No trigger – wrong direction. 3. Trigger point. 

Set the Edge Trigger Type

The trigger mechanism has two edge trigger modes: positive and negative edge trigger.

To set the positive edge trigger mode, press the button. The button will be highlighted when activated.

To set the negative edge trigger mode, press the button. The button will be highlighted when activated.

Set the Trigger Level

The trigger level can be adjusted in three different ways:

• Enter a trigger level value into the text box. Press the TAB keyboard button or click the mouse outside the text box to let the new value take effect.

• Click on the up/down arrows located to the right of the text box

• With the mouse cursor positioned over the text box, scroll the mouse wheel to increase/decrease the trigger level setting

• Drag the trigger level line in the plot area to a new position

Select the Trigger Source

The Oscilloscope trigger sub-module uses one of the channel signals when looking for the trigger condition.

• Click the colored Trigger source button corresponding to the channel you want to use as a trigger source. The active Trigger source button will be highlighted.

Set the Trigger Mode

The Oscilloscope module supports both triggered and free running mode.

• Push Normal to enable triggered mode. The plot will only be updated when the trigger condition is satisfied.

• Push Auto to enable free running mode. The plot will be updated continuously and the trigger conditions will be ignored.

Horizontal Control

The oscilloscope draws the plot lines at a constant speed. The X axis is the time axis. The axis labels show time relative to the trigger point. For the labels to display correctly, the oscilloscope needs to know the sample rate of the source.

Set the Sample Rate

In the sample rate text box, enter the source's sample rate.

Note: 

All sources connected to the oscilloscope must have the same sample rate. If not, the plot lines will not be synchronous with the time axis.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

50

Set the Horizontal Resolution

The horizontal resolution determines the time axis range, or what time-span is visible in the plot. It can be adjusted in four different ways:

• Position the mouse cursor inside the plot area. Use the mouse wheel to zoom in or out.

• Enter a resolution value into the text box. Deselect the text box to let the new value take effect.

• Click on the up/down arrows located to the right of the text box

• With the mouse cursor positioned over the text box, scroll the mouse wheel to increase/decrease the resolution setting

• Drag the time axis scale handles to change the resolution

Set the Horizontal Offset

The horizontal offset is the trigger point's position relative to the center of the plot area. You typically change the offset in order to inspect the plot on either side of the trigger point. There are five different ways of changing the offset:

• Position the mouse cursor inside the plot area. Make sure it does not touch any of the trigger line, zero line, or cursor lines. Then, click and drag the mouse horizontally to change the offset.

• Position the mouse cursor on the time axis. Then click and drag the mouse horizontally to change the offset.

• Enter an offset value into the text box. Deselect the text box to let the new value take effect.

• Click on the up/down arrows located to the right of the text box

• With the mouse cursor positioned over the text box, scroll the mouse wheel to increase/decrease the offset setting

3.3.1.2. Cursors

The oscilloscope has two cursors that can be used to inspect the plots. The cursors simplifies measurements such as pulse widths, amplitudes, frequencies, and so on.

Each cursor is displayed in the plot area as two lines, one vertical and one horizontal. When the vertical cursor line is moved, the horizontal line will follow so that the plot line, vertical and horizontal cursor lines intersect in the same point.

You can set which channel is the source for each of the cursors.

At the bottom of the plot area is the data line. It displays the X and Y values for each of the cursors. In addition, ΔX, ΔY, and 1/ΔX is calculated and displayed.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

51

Figure 3-16. Oscilloscope Cursors

Show and Hide the Cursors

In the Cursor area in the Oscilloscope control panel, toggle the Show button to show or hide the cursors and the cursor data line in the plot area.

Select Cursor Source Channel

In the Cursor group in the oscilloscope's control panel, click on the Cursor 1 and Cursor 2 drop-down list boxes to select what channel to use as the source for that channel. Pick the color matching the channel you want to use.

The cursor's X and Y labels in the data line will change color to the color of the channel you just selected.

Move a Cursor

You can only move the vertical line of a cursor, the X value. The horizontal line (the Y value) will follow.

• Position the cursor over the vertical cursor line. The mouse cursor will change into a left/right cursor. Click and drag the cursor to its new position.

After repositioning a cursor, the readouts in the data line are updated.

Bring a Cursor Into View

After some zooming and panning, a cursor can end up far outside the visible region. It is easy to bring it back into view:

• Right-click on the X1 or Y1 labels in the data line. From the pop-up menu, select Bring into view.

3.3.2. Oscilloscope Configuration Example

This chapter gives an example on how to configure the Oscilloscope module to be used with a target application implementing a night mode switch with a light sensor. Although this example only utilizes the

SPI interface as data source the procedure will be the same for all data sources. The target code used in

this example and a description of the hardware setup can be found in Oscilloscope Example Code .

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

52

To do:  Select correct tool in the DGI Control Panel.

To do:  Click Connect to make a connection to the DGI on the selected tool.

To do: 

• Check the SPI checkbox

• Open the SPI Configuration dialog by pushing the gear button next to the SPI checkbox

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

53

To do: 

• Open the configuration panel

• Add a Oscilloscope module to the Data Visualizer

• Drag the source connector from the interface in the DGI Control Panel into the sink for the oscilloscope channel to make a connection

We can now use the Oscilloscope module to analyze the data acquired from the light sensor when toggling a desk lamp on and off above the I/O1 Xplained Pro.

To do: 

• Set sample rate to 100kHz

• Enable Trigger on falling Edge and set Mode to Normal

• Push Start in DGI Control Panel

• Push Run-Stop button in Oscilloscope module

After some adjustments of the trigger level by dragging it with the mouse in the oscilloscope plot area and zooming in the plot by adjusting the Horizontal range and Vertical range, a lamp switch on event could look something like the picture below.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

54

By turning on the Cursors it is possible to measure the time it takes for the lamp to settle in the on state.

In this case it took about 300ms (ΔX in the plot area). Zooming further in makes it possible to use the cursors to measure the frequency of the light flickering. The 1/ΔX field in the plot area shows that the frequency is about 100Hz which matches well with the 50Hz AC power of the lamp (power switches polarity 100 times per second).

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

55

3.4. Power Debugging

The Power Debugging module displays current and voltage measurements (commonly referred to as power measurements) generated by the Power interface in the DGI Control Panel. The power measurements can be combined with various other interfaces like GPIO and Code Profiling in the same graph to correlate code execution on the target MCU and power consumption of the target application.

3.4.1. Power Debugging Module

The Power Debugging module displays the current consumption of a connected kit. To get started with basic current measurements, see the

Basic Current Measurement

chapter. For an example on how to use

cursors, see Power Analysis using Cursors . For examples on how to correlate current consumption with code execution, see Code Correlation .

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

56

Figure 3-17. Power Debugging

1. Current consumption graph. 2. Y-axis of channel A. 3. Channel A average and instant values. 4. Yaxis of channel B. 5. Control Panel. 6. Auto-scroll checkbox. 7. Automatically fit Y checkbox. 

8. X-axis (time), unit is [minutes]:[seconds]. 

Important:  The Power module can only be used with the Power interface.

3.4.1.1. Scaling and Scrolling a Graph

Tip:  Turn off Auto-scroll and Automatically fit Y to more closely examine a plot while it is still running.

Use the scale and offset controls in order to move the plots according to your needs. The mouse scrollwheel is useful in this regard:

• Shift-scroll on the plot to zoom on the time (X) axis

• Ctrl-scroll on the plot to zoom on the Y axis

• Drag the graph to pan on the time (X) axis and move (offset) the Y axis

• Drag the scales on the left and right to move respective channels in the Y axis (offset)

• Ctrl-scroll on the respective axis scale to zoom that channel

• Right-click and drag to select an area to zoom

3.4.1.2. Power Debugging Module Control Panel

The Power Debugging module Control Panel is placed in the upper right corner of the module.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

57

Notice:  Not all configuration options in the control panel are available on all tools. For example only the Power Debugger has both an A channel and a B channel. All options will be visible for all tools, but will have no effect unless the tool supports them.

The Auto-scroll option controls the scrolling in the X-axis direction (time axis). To zoom and examine the graphs in detail, disable this option.

The Automatically fit Y option controls whether the Data Visualizer will automatically adjust the range of the Y axis according to the graph content or not. If this option is enabled any manual adjustments of the Y axis will be overridden.

The Show zero option controls whether the zero-point of the Y axis should always be visible when

Automatically fit Y is enabled.

Channel Configuration

For each power measurement channel there is a Channel configuration section in the Control Panel of the Power Analysis module.

The channel section allows you to enable/disable the current and voltage graphs in the Power Analysis module.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

58

Notice:  If the Enable B Channel option in the Power Configuration of the DGI Control

Panel (see

Power Interface ) is not selected the B channel will not be available even though the

tool has a B channel. But the B channel configuration will still be visible in the Control Panel.

The Range setting enables the measurement range data for the current measurement channel. To cover the full range of current values supported by the current measurement channel most tools have two or more hardware configurations for each channel. The number of ranges for a channel varies with the connected tool. The switching between the hardware configurations is done automatically based on the instant current measured.

Notice:  The range graph will only be visible if the Enable Range Source option in the Power

Configuration of the DGI Control Panel is selected.

The Mode option allows for different averaging algorithms to be used for the display of data if this is enabled for the current tool.

Code Location

The Code Location section contains no options, just the source connection. To enable code locations in the Power Analysis graph the Code Profiling interface in the DGI control panel must be enabled and the Enable Code Location option in the Code Profiling Configuration of the DGI Control Panel must be enabled.

GPIO

Each of the GPIO sources can be switched on or off in the GPIO section of the Control Panel of the

Power Analysis module.

For GPIO data to be available for the Power Analysis module the GPIO interface has to be enabled in the DGI Control Panel.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

59

Cursors

The Cursors section in the Power Analysis module Control Panel allows you to enable two vertical cursors in the graph by checking the Enabled box.

The cursors can be moved by using the mouse pointer to drag them along the X-axis or they can be centered by pushing the Center button.

When the cursors are enabled the section of the graph between the cursors can be used for various measurements. The measurements will be shown in the Cursors section below the graph.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

60

Which measurements to be shown can be selected in the Measurements sub-section of the Cursors section in the Power Analysis module Control Panel.

3.4.2. Basic Current Measurement

To do:  Select correct tool in the DGI Control Panel.

To do:  Connect to the DGI on the selected tool.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

61

To do:  Enable the Power interface and modify its settings to monitor the relevant channels.

To do:  Start the Data Visualizer session.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

62

3.4.2.1. Two Channel Measurement

When using hardware with two measurement channels, the Data Visualizer will display both in the same graph (unless disabled in the Power Configuration).

On the Control panel on the right of the module you can show or hide the current and voltage plots as well as range information when available.

By default both channels will be shown in the Power Analysis graph but each plot can be moved up or down to separate them as best suited.

3.4.2.2. Scaling and Scrolling a Graph

Tip:  Turn off Auto-scroll and Automatically fit Y to more closely examine a plot while it is still running.

Use the scale and offset controls in order to move the plots according to your needs. The mouse scrollwheel is useful in this regard:

• Shift-scroll on the plot to zoom on the time (X) axis

• Ctrl-scroll on the plot to zoom on the Y axis

• Drag the graph to pan on the time (X) axis and move (offset) the Y axis

• Drag the scales on the left and right to move respective channels in the Y axis (offset)

• Ctrl-scroll on the respective axis scale to zoom that channel

• Right-click and drag to select an area to zoom

3.4.2.3. Current Averaging

The Power Analysis module displays two averaged values per channel. One shows the instantaneous current value, while the other shows the average of the samples visible in the graph view.

3.4.2.4. Power Measurement Calibration

To achieve full measurement accuracy on the current measurement hardware it should be calibrated before running the measurements. The calibration procedure is started through the Power Configuration window in the Power interface in the DGI Control Panel.

Figure 3-18. Triggering Power Measurement Calibration from the Power Configuration Window

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

63

To start the calibration procedure, check the Trigger calibration and press OK. Then follow the instructions to complete the calibration procedure for the tool.

3.4.3. Power Analysis using Cursors

In order to analyze the current more closely, the cursor feature of the Power Analysis module is useful.

To do: 

• Open the Control Panel in the upper right corner of the Power Analysis module

• Expand the Cursors section

• Check the Enabled box to turn the cursors on

Remember:  If the current measurements are still running, make sure to disable

Auto-scroll before enabling the cursors. Else the graph view will rapidly scroll away from the cursors.

The example above shows the current consumption of a target board with a LED that toggles ON and

OFF regularly.

The cursor data at the bottom of the module shows that the current consumption when the LED is OFF is about 354μA, while the current consumption when the LED is ON is about 6.5mA. The average current consumption during one period of the LED toggling is about 580μA. As the current measurement channel is also monitoring voltage, you can measure the power consumption directly. Enable this by setting the corresponding options in the Measurements section of the Cursors section in the Control Panel of the

Power Analysis module.

3.4.4. Code Correlation

To optimize current consumption, current measurements must be correlated to the code execution of the application. The Data Visualizer enables code correlation by the use of GPIO instrumentation or program

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

64

counter sample readout. Crucial to both these methods is the ability to show the code execution related events with the same time base and in the same graph as the current consumption.

3.4.4.1. GPIO Instrumentation

By inserting simple GPIO toggling in the application code you can generate common reference points between the measured current and the code execution. The Data Visualizer is capable of showing the

GPIO events in the same graph as the current measurements.

A mass storage application will be used to demonstrate the use of GPIO instrumentation.

Both Target USB and Debug USB connectors of a SAM L21 Xplained Pro board is connected to a host computer. The ATSAML21 target device is running the USB Device MSC Example from ASF for SAM L21

Xplained Pro (in Atmel Studio select File→New→Example Project and search for "MSC"). The Current

Measurement jumpers on the kit are set to measure MCU current and bypass I/O current.

The current graph after running a format of the mass storage device:

A disk format operation consists of both read and write operations, but with just the current it is difficult to tell what is going on when. To be able to separate the read and write operations, the application code is modified to set GPIO0 (PB01 on the ATSAML21) high on the start of a read operation and set it low at the end of the read operation. GPIO1 (PA16 on the ATSAML21) is similarly toggled for write operations. Both the GPIO interface and the Power interface must be enabled in the DGI Control Panel of the Data

Visualizer as shown below.

In the Control Panel of the Power Analysis module disable GPIO2 and GPIO3 as shown below.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

65

Now, with the GPIO signals enabled, you can distinguish the current consumption of the read and write operations. The yellow signal is GPIO0 which signals the read operations and the green signal is GPIO1 showing the write operations.

3.4.4.2. Program Counter Polling

Each time the Program Counter (PC) is read out from the target, we get the exact information on the address of the code location currently being executed. The Data Visualizer can show PC values with current measurements in the same graph. This allows you to see what is being executed by the target

CPU at the various sample points of the current consumption graph. The sampled PC values will only show part of the code execution as in most cases it is impossible to read out the PC values as fast as the target is executing instructions. The sampled values are still useful to indicate which code segment is being executed at any point in time.

A SAM L21 Xplained Pro board running a Mass Storage Class example will be used to demonstrate PC polling.

Both Target USB and Debug USB connectors of a SAM L21 Xplained Pro board is connected to a host computer. The ATSAML21 target device is running the USB Device MSC Example from ASF for SAM L21

Xplained Pro (in Atmel Studio select File→New→Example Project and search for "MSC"). The Current

Measurement jumpers on the kit are set to measure MCU current and bypass I/O current.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

66

The current graph after running a format of the mass storage device:

A disk format operation consists of both read and write operations, but from the current graph it's difficult to see what is going on when. To get more information on what's going on in the target at the various points in the current graph the program counter sampling feature will be useful.

To view program counter samples together with current measurement data both the Power interface and the Code Profiling interface must be enabled.

To do: 

• Enable both Power interface and Code Profiling interface in DGI Control Panel

To do: 

• Open the Code Profiling Configuration dialog by pushing the gear button on the Code

Profiling interface

• Select Enable Code Location

A typical current graph with program counter sampling enabled during a format operation is shown below.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

67

The yellow points plotted on the graph represent polled program counter values. Their location on the y axis is a visual representation of their location in the code-space of the target device. The relative grouping of samples shows us execution of different functions. Patterns can easily be seen using this technique. Hovering over one of the samples shows the location of that sample in the Code location

details box below the graph, as well as the value of the current sample at that point.

Double clicking on one of the samples will open the editor and highlight the corresponding line of code.

The highlighted sample is located in a function called udi_msc_trans_block. This function transfers data from RAM to USB. From the graph it can be seen that the current spike at the marker is generated by the execution of this function as all program counter samples are from the same location during this spike.

3.5. Custom Dashboard

The Dashboard module is a customizable Graphical User Interface (GUI) panel. It can be used to control and display parameters from the target application.

3.5.1. Dashboard Module

The Dashboard module is a customizable Graphical User Interface (GUI) panel. It can be used to control and display parameters from the application firmware. Elements (button, label, slider, etc.) are placed in the dashboard area to form the GUI. Each element can have an endpoint associated with it to send or

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

68

receive values. A slider, for example, has a source that outputs the slider position as a numeric value.

The endpoints are visible when Show Endpoints option is enabled.

For an example on how to configure a dashboard see

Dashboard Configuration Example

.

Figure 3-19. Dashboard

1. Dashboard area. 2. Edit checkbox. 3. Show Endpoints checkbox. 4. Height adjustment tab. 

3.5.1.1. Edit Panel

When going into edit mode (by checking the Edit box), the Edit panel will become visible. Here you can customize the dashboard.

Figure 3-20. Edit Panel

Placing Elements on the Dashboard

By default, the dashboard area is empty. Elements can be placed on the dashboard by following the procedure below.

• Check the Edit checkbox

• Open the Elements panel in the upper right corner of the dashboard area

• Click and hold the element

• Drag the mouse over the dashboard area

• Drop the element in the dashboard area on the desired location

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

69

Configuring Dashboard Elements

All dashboard elements can be configured when in Edit mode. The parameters will vary depending on element type, but the procedure for changing them is the same.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

70

Figure 3-21. Element Configuration

1. Common parameters. 2. Element-specific parameters. 3. Set button. 

• Check the Edit checkbox

• Select the element to configure by clicking it. The configuration window will list the configurable parameters for the selected element.

• Change the parameters to the desired value

• Click the Set button

Moving Elements

All parameters related to position and size are available in the element configurations. You can also move elements by dragging them around in the dashboard area in edit mode. Resizing can be done by dragging the black tab in the corner after selecting an element.

Deleting Elements

To delete unwanted elements, simply select the element by left-clicking it, and then right-click it to delete.

Important:  This action is permanent, and all configuration is lost after deletion.

Loading and Saving

The dashboard can be saved by pressing the Save button in edit mode. All elements and configuration parameters, in addition to dashboard background color, will be stored.

To load a dashboard, click the Load button and browse to a valid dashboard save file.

Setting Background Color

The square next to the Load button is the Background color selector. Clicking the selector will bring up the Color selector dialog. Use the sliders to select the desired color, then press OK.

3.5.1.2. Element Types

The various dashboard element types are presented in this section. All element types have some common parameters. These are listed in the table below. The following sections will only list the parameters specific to each element type.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

71

Table 3-1. Common Element Parameters

Parameter

Z-index

Type

Numeric

Left

Top

Width

Height

Numeric

Numeric

Numeric

Numeric

Label

The Label element displays a text string.

Figure 3-22. Label

Usage

Order index, 0 places the element the farthest to the back

Horizontal placement, unit pixels

Vertical placement, unit pixels

Width of element in pixels

Height of element in pixels

Endpoints

The Label element has a sink endpoint that accepts all types of sources. Any data sent to the label will be converted to a string and displayed as text.

Configuration

Table 3-2. Label Specific Parameters

Parameter

Font Size

Type

Numeric

Usage

Adjusts the size of the font

Bold

Italic

Checkbox

Checkbox

Sets bold style of the font

Sets italic style of the font

Horizontal Alignment Dropdown box Selects the alignment of the text within the specified width

Vertical Alignment Dropdown box Selects the alignment of the text within the specified height

Background Color

Foreground Color

Text

Color

Color

String

Sets the background color of the label

Sets the color of the text

Sets the label text

Numeric Input

The Numeric Input element enables input of numeric values to the dashboard.

Figure 3-23. Numerical Input

Endpoints

The Numeric Input has a source endpoint of type int32. Each time the numerical input value is changed a packet with the value is sent.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

72

Configuration

Table 3-3. Numerical Input Specific Parameters

Parameter

Minimum

Maximum

Value

Type

Numeric

Numeric

Numeric

Usage

Minimum value of input

Maximum value of input

Initial value

Button

The Button element will send an event each time it is pressed. The button can either be configured as a normal push button or as a toggle button. The button can have a static text to indicate its functionality.

When it is configured as a toggle button the text will be replaced by ON or OFF depending on the state of the button. To replace the ON/OFF text by something else the Text parameter must be given as a '/' delimited text with the first part of the text being the on state text and the second part the off state text.

Figure 3-24. Button

Endpoints

The Button element has a source endpoint of type uint8. Each time the button is pressed a packet is sent. The value of the packet will always be 0 for a normal button and 0 for a toggle button in its OFF state and a 1 for a toggle button in its ON state.

Configuration

Table 3-4. Button Parameters

Parameter Type Usage

Font Size

Text

Numeric Sets the font size of the button tag

String Sets the button tag text. If the button is configured as toggle button the test should be delimited by '/'. The first part of the text will then be the on state text while the second part will be the off state text.

Toggle Button Checkbox Configures the button to be a on/off toggle switch.

Radio Group

The Radio Group element is a group of radio buttons where only one option can be selected at any time.

Initially the first option is selected.

Figure 3-25. Radio Group

Endpoints

The Radio Group element has a source endpoint of type uint16. Each time the state of the element is changed a message is sent with the index of the currently active option.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

73

Configuration

Table 3-5. Radio Group Specific Parameters

Parameter

Font Size

Type Usage

Numeric Font size of the button text

Number of Radio Buttons Numeric Number of buttons in the group

Orientation Numeric 0 = Horizontal

1 = Vertical

Text String '/' delimited text with the text for each button starting with the text for button with index 0

Check Box

The Check Box element will send an event each time its state is changed.

Figure 3-26. Check Box

Endpoints

The Check Box element has a source endpoint of type uint8. Ever time the state of the element is changed a message is sent. When the box is checked a 1 is sent and when it is un-checked a 0 is sent.

Configuration

Table 3-6. Check Box Specific Parameters

Parameter

Font Size

Text

Type

Numeric

String

Usage

Font size for the text

Sets the Check Box tag text

Slider

The Slider element is a linear bar with a movable marker. The marker can be moved to adjust the value of the slider.

Figure 3-27. Slider

Endpoints

The Slider element has a source endpoint of type double. When the slider value is changed a packet with the value is sent.

Configuration

Table 3-7. Slider Parameters

Parameter

Minimum

Maximum

Value

Type

Numeric

Numeric

Numeric

Usage

Sets the minimum value of the slider

Sets the maximum value of the slider

Sets the value of the slider

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

74

Signal

The Signal element is a simple color-based on/off indicator.

Figure 3-28. Signal

Endpoints

The Signal element has a sink endpoint that accepts all data types, but ignores strings and multidimensional values. The color of the signal is decided by a boolean evaluation, if the incoming value is a number it is true if it is greater than 0.

Configuration

Table 3-8. Signal Parameters

Parameter

Color On

Color Off

Type

Color

Color

Usage

Selects the color used when the signal is ON

Selects the color used when the signal is OFF

Progress Bar

The Progress bar element is a linear bar that shows the position of a value between a min. and max.

value.

Figure 3-29. Progress Bar

Endpoints

The Progress bar element has a sink endpoint that accepts all numeric data types. When a value is received, it will update the amount of colored area of the progress bar depending on the min. and max.

values.

Configuration

Table 3-9. Progress Bar Parameters

Parameter

Minimum

Maximum

Value

Color

Type

Numeric

Numeric

Numeric

Color

Usage

Sets the minimum value of the progress bar

Sets the maximum value of the progress bar

Sets the value of the progress bar

Sets the color of the progress bar

Segment Display

The Segment display element simulates a hex-digit LED display.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

75

Figure 3-30. Segment Display

Endpoints

The Segment display element has a sink endpoint that accepts all numeric data types. The value received is displayed.

Configuration

Table 3-10. Segment Display Parameters

Parameter

Segment Count

Numeric Base

Segment Color

Type

Numeric

Numeric

Color

Usage

Number of hex-segments to display

Sets the base used for displaying numbers

Sets the color of the segment display

Graph

The Graph element plots the incoming data streams in a two dimensional graph. The graph can be configured to accept zooming and scrolling by mouse interaction or to be static ignoring any mouse interaction.

Figure 3-31. Graph

Endpoints

The Graph element has one sink endpoint for each plot. The endpoints accepts all numerical data types.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

76

Configuration

Table 3-11. Graph Specific Parameters

Parameter

Title color

Type

Color

Usage

Selects the color of the title text

Background color Color

Graph background color Color

Title

Number of plots

String

Selects the color of the complete Graph element background

Selects the color of the graph plot area background

Title of the graph

Numeric Number of plots to display in the graph. Each plot will have its own sink endpoint.

X Minimum

X Maximum

Numeric Minimum value of X axis

Numeric Maximum value of X axis

Y Minimum

Y Maximum

Mouse Interaction

Fit to right

Numeric Minimum value of Y axis

Numeric Maximum value of Y axis

Checkbox Enable mouse interaction with the Graph element

Checkbox Expand the Graph element to the right edge of the dashboard

Pie Chart

The Pie Chart element displays the value of the incoming streams as slizes in a pie chart.

Figure 3-32. Pie Chart

Endpoints

The Pie Chart element has one sink endpoint for each slize in the pie chart. The sink endpoints accepts all numerical data types.

Configuration

Table 3-12. Pie Chart Specific Parameters

Parameter

Title color

Background color

Type

Color

Color

Usage

Selects the color of the title text

Selects the element background color

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

77

Parameter

Title

Number of plots

Type

String

Numeric

Usage

Title of the element

Number of slizes in the pie chart

Rectangle

The Rectangle element sends a packet each time it is clicked by the mouse.

Figure 3-33. Rectangle

Endpoints

The Rectangle element has a source endpoint of type uint32. Each time the element is clicked by the mouse pointer a packet with value 0 is sent.

Configuration

Table 3-13. Rectangle Specific Parameters

Parameter

Background color

Foreground color

Type

Color

Color

Usage

Selects the color of the fill of the rectangle

Selects the color of the frame of the rectangle

Surface

The Surface element displays grid data as a surface in 3D space.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

78

Figure 3-34. Surface

Endpoints

The Surface element has one endpoint accepting any source of a grid type.

Configuration

Table 3-14. Surface Specific Parameters

Parameter

Fill color

Mesh color

Type

Color

Color

Background color Color

Background gradient color Color

Axis color

Tick color

Color

Color

X Rotation

Y Rotation

Z Rotation

Numeric

Numeric

Numeric

Usage

Selects the color of the surface fill

Selects the color of the surface mesh

Selects the color of the background

Selects the color of the background gradient

Selects the color of the axes

Selects the color of the tick labels

Sets rotation of view around X

Sets rotation of view around Y

Sets rotation of view around Z

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

79

Parameter

Show X axis

Show Y axis

Show Z axis

Show fill

Show mesh

Use palette coloring

Scaling mode

Axis minimum

Axis maximum

Type

Checkbox

Checkbox

Checkbox

Checkbox

Checkbox

Checkbox

Usage

Sets visibility of X axis

Sets visibility of Y axis

Sets visibility of Z axis

Sets visibility of surface fill

Sets visibility of surface mesh

Sets usage of palette coloring (red-yellow-green-white)

Dropdown box Selects mode of Y-axis autoscaling

Numeric Sets minimum axis value for Y

Numeric Sets maximum axis value for Y

3.5.2. Dashboard Configuration Example

This section gives an example on how to configure the Dashboard module. Although the example utilizes only a subset of the available dashboard elements data sources available in the Data Visualizer the basic principles are applicable to all elements and data sources.

This example uses manual configuration of the Dashboard module, but it is also possible to use the

Atmel Data Protocol (ADP) to set up a dashboard automatically. For more information on ADP and an

example of a automatically configured dashboard, see Atmel Data Protocol

.

The target application code used in this example and a description of the hardware setup can be found in

Dashboard Example Code

.

To do: 

• Open the configuration panel

• Add a new I/O Dashboard component by double clicking the I/O Dashboard module

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

80

To do: 

• Enable editing the dashboard by checking the Edit option in the lower left corner of the

Dashboard I/O module

• Open the Elements panel in the upper right corner of the dashboard and drag elements onto the dashboard.

Tip:  To remove an element from the dashboard, select it by left-clicking it, and then right-click the element.

Tip:  Changing the parameters in the Configuration section won't take effect until the Set button is pushed.

In this example three Label elements are added, one as a title for the dashboard and the two others as help text for the slider. A Graph element with one plot was added to be used for the light sensor data. The

Y Minimum and Y Maximum values were set to 0 and 255 respectively. A Signal element was added to be able to see which mode is active. When the night mode is active the signal turns dark blue (Color On) and when the night mode is inactive the signal turns yellow (Color Off). Finally a slider was added to make it possible to adjust the night mode threshold. The Minimum was set to 0 and the Maximum was

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

81

set to 255. Moving the slider to the left lowers the threshold and results in the night mode being active at brighter light levels.

When the dashboard has been set up it is time to connect the dashboard to the serial interfaces to enable communication with the target application.

Before the endpoints in the dashboard can be hooked up the interfaces between the target board and the host computer must be configured. This example uses the DGI SPI interface and the CDC USART interface. The CDC interface will appear on the host computer as an ordinary serial COM port.

To do:  Select correct tool in the DGI Control Panel.

To do:  Click Connect to make a connection to the DGI on the selected tool.

To do: 

• Check the SPI checkbox

• Open the SPI Configuration dialog by pushing the gear button next to the SPI checkbox

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

82

To do: 

• Open the Serial Port Control panel found under External Connection in the Modules section of the Configuration tab in Data Visualizer

To do: 

• Select the correct COM port corresponding to the connected kit (the Windows device manager can be used to identify the correct COM port)

• Set the serial port parameters according to the application code

• Make sure Open Terminal option is not checked

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

83

To do: 

• Uncheck the Edit option

• Check the Show Endpoints option

• Drag the SPI source to the graph sink

• Drag the serial port source to the signal sink

• Drag the slider source to the serial port sink

Now the dashboard is fully configured and can be used to interact with the night mode switch application.

To do: 

• Uncheck the Show Endpoints option

• Push Start in the DGI Control Panel

• Push Connect in the Serial Port Control Panel

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

84

Now the ADC raw values are shown in the graph and the slider can be adjusted to a suitable threshold for the night mode switch. The signal element shows the state of the switch.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

85

4. Utilities

Utilities are modules that don't fit in the other categories, but are still helpful for analyzing data.

The Samplerate Counter provides a measure of how much data is being transmitted.

The File Logger module stores incoming data in a file of selectable format. The file contents can then be analyzed in another application.

4.1. Samplerate Counter

The samplerate counter module takes an incoming data stream and measures the amount of incoming samples in the stream.

To use the samplerate counter simply connect a source to the sink of the samplerate counter module and start the data stream. The samplerate counter can be used with streams of any data type.

4.2. File Logger

The File Logger module logs all incoming data to a file of selectable format.

Figure 4-1. File Logging

1

2

3 4

1. Output file selection box. 2. Output format selection box. 3. Input sink. 4. Start/Stop button. 

4.2.1. Logging to a Binary File

• Select output format "BIN" in the Output format selection box

• Set the output file by pressing the "..." button in the Output file selection box and selecting a path and name

• Connect an external source to the input sink

• Press the Start button to begin logging. The button will be replaced by the Stop button.

• Press the Stop button to close the file and end logging before inspecting the logged data

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

86

5. Protocols

Most communication interfaces uses streams of bytes to transfer data. This is enough for single data values of 8-bit precision. When multiple values are required to be transmitted over the same interface, data must be packed in a protocol.

The Data Streamer is using a light-weight framing format to pack several numerical values over one interface. It is only capable of handling incoming data.

The ADP Control Panel is using the Atmel Data Protocol to automatically set up the user interface and all data streams, both incoming and outgoing. Data Visualizer is capable of automatically detect if an interface is using the Atmel Data Protocol.

5.1. Data Stream

The data stream module takes an incoming raw data stream and splits it into multiple data streams. The data stream format is specified by a configuration file provided by the user.

5.1.1. Stream Format

The data stream is processed in the same order as the configuration file specifies. All data must be given as little endian values as possible, meaning that the lowest byte must be sent first. Additionally, a wrapper consisting of one byte before and one byte after the data stream variables must be added. This wrapper is used by the interpreter to synchronize to the data stream. The start byte can be of an arbitrary value, but the end byte must be the inverse of the start byte. The configuration file shall not define the start and end bytes.

Consider the example configuration given in the previous section. The figure below gives an example raw data transmission where ADC0 is 185, ADC1 is 950, ADC2 is 0, and Prescaler is 2.

Figure 5-1. Data Streamer

… 0x03 0xB9 0x00 0xB6 0x03 0x00 0x00 0x02 0xFC …

Start

ADC0

ADC1

ADC2 Prescaler

End

5.1.2. Configuration Format

The configuration file is a comma-delimited text file that specifies one data variable per line. Each line starts by specifying the data format of the variable by one of the tags presented in the table below. The position of the variable in the output grid is then given by two coordinates starting at index 1. The final parameter assigns a text string to the variable.

Table 5-1. Data Stream Types

Type

Unsigned byte

Signed byte

Unsigned short

Signed short

Unsigned word

Size

1

1

2

2

4

Tag

B

-B

D

-D

W

Example

B,1,1,Light

-B,1,1,Encoder

D,1,1,ADC

-D,1,1,ADC

W,1,1,Transfer rate

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

87

Type

Signed word

Floating point

Double-precision floating point

Grid of unsigned bytes

Grid of signed bytes

Grid of unsigned short

Grid of signed short

Grid of unsigned word

Grid of signed word

Grid of floating point

Grid of double-precision floating point

This is an example configuration:

D,1,1,ADC0

D,1,2,ADC1

D,1,3,ADC2

B,2,1,Prescaler

5.1.3. Basic Usage

Figure 5-2. Data Streamer

Size Tag

4

4

-W

F

8 DF

1 * W * D GB<WxD>

Example

-W,1,1,Status code

F,1,1,Temperature

DF,1,1,Measurement

GB<10x10>,1,1,Surface

1 * W * D -GB<WxD> -GB<10x10>,1,1,Surface

2 * W * D GD<WxD> GD<10x10>,1,1,Surface

2 * W * D -GD<WxD> -GD<10x10>,1,1,Surface

4 * W * D GW<WxD> GW<10x10>,1,1,Surface

4 * W * D -GW<WxD> -GW<10x10>,1,1,Surface

4 * W * D GF<WxD> GF<10x10>,1,1,Surface

8 * W * D GDF<WxD> GDF<10x10>,1,1,Surface

• Press the Open file button (3)

• Browse to the configuration file and double-click it

• Click the Load configuration button (4)

• Connect the input sink (5)

• Connect one or more output source to a desired sink (1)

5.2. Atmel Data Protocol

5.2.1. Transfer using Atmel Data Protocol

The Atmel Data Protocol (ADP) is a content independent protocol intended for transferring data from a target MCU to a host PC through an EDBG based debugger (EDBG, Atmel-ICE, Power Debugger) using the Data Gateway Interface (DGI, see Embedded Debugger's Data Gateway Interface ) or directly to the host computer using a serial port. ADP is content independent and the transfer through the debugger is transparent, meaning that the content is not interpreted by the debugger.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

88

Transferring a single value is quite simple. But if we want to transfer more than one value, they have to be wrapped in some kind of protocol that both the sender and receiver understands. ADP is such a protocol.

If the MCU wraps all its data into an ADP packet, it can be decoded in the Data Visualizer and split into separate data streams.

Figure 5-3. An ADP Transfer

In the figure above, the MCU packs a temperature and a pressure variable inside an ADP packet. In the

Data Visualizer, the SPI endpoints in the DGI Control Panel are now connected to the Data endpoints of an ADP Control Panel. The ADP Control Panel will decode the packets into separate temperature and pressure data streams. They can then be connected to two plot lines in the Graph module.

The ADP protocol supports data transfer in both directions. In addition, the MCU can send configuration packets describing what modules should be opened in the Data Visualizer, and how to connect them.

When the target board is connected to the host computer everything will be configured automatically.

For more information on the ADP protocol, see

Atmel Data Protocol

.

5.2.2. ADP Example

For an example of ADP protocol usage the ADP example application for SAM D21 Xplained Pro can be used. This example can be found in Atmel Software Framework (ASF) in Atmel Studio. This example uses an SAM D21 Xplained Pro together with an I/O Xplained Pro board.

This example uses the Data Gateway Interface (DGI, see Embedded Debugger's Data Gateway

Interface ) on the Embedded Debugger (EDBG), but any serial port is sufficient.

5.2.2.1. Requirements

• Host computer with Atmel Studio 7 (or later) installed (Atmel Data Visualizer is included)

• Atmel SAM D21 Xplained Pro kit

• Atmel I/O1 Xplained Pro extension

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

89

5.2.2.2. Hardware Setup

To run the example the following hardware setup is required:

• I/O1 Xplained Pro extension connected to SAM D21 Xplained Pro EXT1 connector

• USB cable connected from host PC to DEBUG USB connector on SAM D21 Xplained Pro

A picture of the setup is shown below.

5.2.2.3. Run Example

To run the ADP example follow the steps below.

To do: 

• Open Atmel Studio

• Select File → New → Example Project

• Browse to or search for the ADP example application - SAM D21 Xplained Pro and select it

• Choose your preferred folder and give the project a name, then press OK to create the project

The project will be generated and it is just a matter of compiling it and program it into the target board.

To do: 

• Open the project properties (right click the project in the Solution Explorer and select

Properties)

• On the Tool tab select the appropriate tool and interface

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

90

To do: 

• Click Start Without Debugging (Debug->Start Without Debugging)

To do:  Open Atmel Data Visualizer as an extension inside Atmel Studio by selecting it in the

Tools menu.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

91

To do: 

• In the DGI Control Panel select SAM D21 Xplained Pro

• Check the Autodetect ADP box

• Press Connect

You should see something like the screen-shot below in the Data Visualizer.

5.2.2.4. How it Works

As the code for the ADP example is quite extensive it won't make sense to list it or describe all the details.

Especially details on how to set up the required peripherals on the Atmel ATSAMD21 will be left out. The

ADP messages required to create the ADP example dashboard will be detailed in the following chapters.

Note that after each message sent to the computer the target (the SAM D21 device) waits for a

MSG_CONF_ACK (

MSG_CONF_ACK

) before sending the next message.

Tip:  This example includes full automatic configuration of a Dashboard. However, ADP could be used to configure a set of streams to be connected manually to various modules in the Data

Visualizer like Graph, Oscilloscope, or Terminal. The ADP Control Panel shows the available sinks and sources for the current ADP instance. These sinks and sources can be used in the same way as the sources and sinks in the DGI Control Panel and the Serial Port Control

Panel. For more information, see Transfer using Atmel Data Protocol .

Serial Interface

The ADP example uses a SPI interface to stream the ADP data from the SAM D21 to the embedded debugger (EDBG) on the SAM D21 Xplained Pro board. The EDBG uses the Data Gateway Interface

(DGI) to stream the data over USB to the host computer. If the target board did not contain a device with

DGI capability ADP could have been streamed directly to the computer over a serial interface. If this was

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

92

the case the Serial Port Control Panel ( Serial Port

) would have been used in the Data Visualizer instead of the DGI Control Panel (

Data Gateway Interface (DGI)

).

Initialization

After setting up the hardware (e.g. initializing the serial interface, setting up the ADC and I/O ports), the application is ready to start sending the ADP messages. The first message sent is a

MSG_REQ_HANDSHAKE.

Table 5-2. MSG_REQ_HANDSHAKE

Description Field

Token

Message ID

Data length

Protocol version

Values

0xFF

0x00

10

0x01

Options 0x01

The ADP example uses ADP protocol version 1

GPIO is in use in this application

Token {0x58, 0x99, 0xAB, 0xC9, 0x0F,

0xE2, 0xF7, 0xAA}

Token used to verify ADP protocol

This message is repeated until a MSG_RES_HANDSHAKE (

MSG_RES_HANDSHAKE ) is received,

indicating the host is ready to receive messages.

ADP Control Panel

The ADP example configures the ADP Control Panel to look something like the screen-shot below.

Notice:  The appearance of screen-shots will vary with operating system version and configuration.

The ADP Control Panel is configured by the message detailed in the table below.

Table 5-3. MSG_CONF_INFO

Description Field

Token

Message ID

Data length

Values

0xFF

0x28

177

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

93

Field

Title

Description

Values Description

"Light Sensor Example for

Xplained Pro\0"

"This example demonstrates light intensity measurements through the ADC of a Xplained Pro board.

You will need the I/O1 Xplained

Pro (EXT1)\0"

Short description of the application

Light Sensor Dashboard

The ADP example sets up a dashboard for the I/O1 Xplained pro light sensor and LED that looks something like the screen-shot below.

Notice:  The appearance of screen-shots will vary with operating system version and configuration.

The light sensor dashboard is configured by the messages detailed in the tables below.

First the dashboard itself must be set up.

Table 5-4. MSG_CONF_DASHBOARD

Field

Token

Message ID

Data length

ID

Label

Background color

Height

Values

0xFF

0x2A

38

0x0000

"Light Sensor Example

Dashboard\0"

0xFFFFFF (transmitted as

0xFFFFFFFFFFFF as each 0xFF character must be transmitted as

0xFFFF, see

Message Format

)

300

Description

Dashboard ID

Dashboard label

Background color of dashboard

Height (in pixels) of dashboard

Then some Label elements are added to the dashboard.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

94

Table 5-5. MSG_CONF_DASHBOARD_ELEMENT, ELEMENT_TYPE_LABEL

Field

Token

Message ID

Data length

Dashboard ID

Element ID

Z-Index

X-coordinate

Y-coordinate

Width

Height

Element type

Font size

Attribute

Horizontal alignment

Vertical alignment

Background transparency

Background color

Foreground transparency

Foreground color

Label text

Values

0xFF

0x2B

47

0x0000

0x0000

0

Description

5

5

Depending on element type

ID of light sensor dashboard

Unique ID of label element

Order index, 0 places the element the farthest to the back

X-coordinate of element location.

0 is topmost position on dashboard.

Y-coordinate of element location.

0 is topmost position on dashboard.

Width of element (pixels)

Height of element (pixels)

ELEMENT_TYPE_LABEL

300

35

0x00

24

1

0

0x00

1

Bold = OFF, Italic = OFF

Center

Center

0xFFFFFF (transmitted as

0xFFFFFFFFFFFF as each 0xFF character must be transmitted as

0xFFFF, see

Message Format

)

255 (transmitted as 0xFFFF as each 0xFF character must be transmitted as 0xFFFF, see

Message Format )

0x000000

"Light Sensor Example\0"

RGB color of background

RGB color of background

Table 5-6. MSG_CONF_DASHBOARD_ELEMENT, ELEMENT_TYPE_LABEL

Field

Token

Message ID

Values

0xFF

0x2B

Description

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

95

Field

Data length

Dashboard ID

Element ID

Z-Index

X-coordinate

Y-coordinate

Width

Height

Element type

Font size

Attribute

Horizontal alignment

Vertical alignment

Background transparency

Background color

Foreground transparency

Foreground color

Label text

Values

45

0x0000

0x0001

0

5

60

Description

Depending on element type

ID of light sensor dashboard

Unique ID of label element

Order index, 0 places the element the farthest to the back

X-coordinate of element location.

0 is topmost position on dashboard.

Y-coordinate of element location.

0 is topmost position on dashboard.

Width of element (pixels)

Height of element (pixels)

ELEMENT_TYPE_LABEL

129

25

0x00

14

1

0

0x01

0

Bold = ON, Italic = OFF

Left

Center

0xFFFFFF (transmitted as

0xFFFFFFFFFFFF as each 0xFF character must be transmitted as

0xFFFF, see

Message Format

)

255 (transmitted as 0xFFFF as each 0xFF character must be transmitted as 0xFFFF, see

Message Format )

0x000000

"Light Sensor Value\0"

RGB color of background

RGB color of background

Table 5-7. MSG_CONF_DASHBOARD_ELEMENT, ELEMENT_TYPE_LABEL

Field

Token

Message ID

Data length

Dashboard ID

Element ID

Values

0xFF

0x2B

38

0x0000

0x0002

Description

Depending on element type

ID of light sensor dashboard

Unique ID of label element

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

96

Field

Z-Index

X-coordinate

Y-coordinate

Width

Height

Element type

Font size

Attribute

Horizontal alignment

Vertical alignment

Background transparency

Background color

Foreground transparency

Foreground color

Label text

Values

0

5

100

Description

Order index, 0 places the element the farthest to the back

X-coordinate of element location.

0 is topmost position on dashboard.

Y-coordinate of element location.

0 is topmost position on dashboard.

Width of element (pixels)

Height of element (pixels)

ELEMENT_TYPE_LABEL

82

25

0x00

0

1

14

0x01 Bold = ON, Italic = OFF

Left

Center

0

0xFFFFFF (transmitted as

0xFFFFFFFFFFFF as each 0xFF character must be transmitted as

0xFFFF, see

Message Format

)

RGB color of background

255 (transmitted as 0xFFFF as each 0xFF character must be transmitted as 0xFFFF, see

Message Format )

0x000000

"Night Light\0"

RGB color of background

Table 5-8. MSG_CONF_DASHBOARD_ELEMENT, ELEMENT_TYPE_LABEL

Field

Token

Message ID

Data length

Dashboard ID

Element ID

Z-Index

Values

0xFF

0x2B

38

0x0000

0x0003

0

Description

Depending on element type

ID of light sensor dashboard

Unique ID of label element

Order index, 0 places the element the farthest to the back

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

97

Field

X-coordinate

Y-coordinate

Width

Height

Element type

Font size

Attribute

Horizontal alignment

Vertical alignment

Background transparency

Background color

Foreground transparency

Values

5

230

80

25

0x00

14

0x01

0

1

0

0xFFFFFF (transmitted as

0xFFFFFFFFFFFF as each 0xFF character must be transmitted as

0xFFFF, see Message Format

)

255 (transmitted as 0xFFFF as each 0xFF character must be transmitted as 0xFFFF, see

Message Format )

0x000000

"LED Control\0"

Description

X-coordinate of element location.

0 is topmost position on dashboard.

Y-coordinate of element location.

0 is topmost position on dashboard.

Width of element (pixels)

Height of element (pixels)

ELEMENT_TYPE_LABEL

Bold = ON, Italic = OFF

Left

Center

RGB color of background

RGB color of background Foreground color

Label text

A stream needs to be set up to receive light sensor data.

Table 5-9. MSG_CONF_STREAM

Field

Token

Message ID

Data length

ID

Type

Mode

State

Label

Values

0xFF

0x20

18

0x0001

12

2

0

"Light sensor\0"

Description

ID of the light sensor data stream

Stream type float

Out from target

Stream state ON

Label of the data stream

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

98

And a Progress bar to show the light sensor data is added.

Table 5-10. MSG_CONF_DASHBOARD_ELEMENT, ELEMENT_TYPE_PROGRESS

Description Field

Token

Message ID

Data length

Dashboard ID

Element ID

Z-Index

X-coordinate

Y-coordinate

Width

Height

Element type

Minimum value

Maximum value

Initial value

Color

Values

0xFF

0x2B

29

0x0000

0x0004

0

140

60

145

25

0x03

0

4

0

0x008000

Depending on element type

ID of the light sensor dashboard

Unique ID of the progress bar element

Order index, 0 places the element the farthest to the back

X-coordinate of element location.

0 is topmost position on dashboard.

Y-coordinate of element location.

0 is topmost position on dashboard.

Width of element (pixels)

Height of element (pixels)

ELEMENT_TYPE_PROGRESS

RGB color of progress bar

Eventually the light sensor data stream is connected to the Progress bar element.

Table 5-11. MSG_CONF_ADD_STREAM_TO_ELEMENT

Description Field

Message ID

Data length

Dashboard ID

Element ID

Stream ID

Values

0x2C

6

0x0000

0x0004

0x0001

ID of the light sensor dashboard

ID of the progress bar element

ID of the light sensor data stream

Then a Graph element is added to the dashboard.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

99

Table 5-12. MSG_CONF_DASHBOARD_ELEMENT, ELEMENT_TYPE_GRAPH

Field

Token

Message ID

Data length

Dashboard ID

Element ID

Title color

Background color

Graph background color

Title text

Plot count

Xmin

Xmax

Ymin

Ymax

Mode

Values

0xFF

0x2B

53

0x0000

0x0007

0xFFFFFF (transmitted as

0xFFFFFFFFFFFF as each 0xFF character must be transmitted as

0xFFFF, see Message Format

)

0x000000

0x000000

"Light level\0"

1

0

10

0

5

0x00

Description

Depending on element type

ID of the light sensor dashboard

Unique ID of graph element

RGB color of title

RGB color of graph frame

RGB color of graph

Mouse interaction OFF

Fit graph to right edge of canvas

OFF

And the light sensor data stream is connected to the Graph.

Table 5-13. MSG_CONF_ADD_STREAM_TO_ELEMENT

Field

Message ID

Data length

Dashboard ID

Element ID

Stream ID

Values

0x2C

6

0x0000

0x0007

0x0001

A separate stream is set up to signal night mode.

Description

ID of the light sensor dashboard

ID of the graph element

ID of the light sensor data stream

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

100

Table 5-14. MSG_CONF_STREAM

Field

Token

Message ID

Data length

ID

Type

Mode

State

Label

Values

0xFF

0x20

16

0x0029

2

2

0

"Night Mode\0"

Description

ID of the night mode stream

Stream type uint_8

Out from target

Stream state ON

Label of the data stream

A Signal element is added to the dashboard for the night mode signal.

Table 5-15. MSG_CONF_DASHBOARD_ELEMENT, ELEMENT_TYPE_SIGNAL

Description Field

Token

Message ID

Data length

Dashboard ID

Element ID

Z-Index

X-coordinate

Y-coordinate

Width

Height

Element type

On transparency

On color

Values

0xFF

0x2B

22

0x0000

0x0005

0

140

100

25

25

0x04

255 (transmitted as 0xFFFF as each 0xFF character must be transmitted as 0xFFFF, see

Message Format )

0x008000

Depending on element type

ID of the light sensor dashboard

Unique ID of the signal element

Order index, 0 places the element the farthest to the back

X-coordinate of element location.

0 is topmost position on dashboard.

Y-coordinate of element location.

0 is topmost position on dashboard.

Width of element (pixels)

Height of element (pixels)

ELEMENT_TYPE_SIGNAL

RGB color for ON state

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

101

Field

Off transparency

Off color

Values

255 (transmitted as 0xFFFF as each 0xFF character must be transmitted as 0xFFFF, see

Message Format )

0x000000

Description

RGB color for OFF state

And the night mode stream is connected to the Signal element.

Table 5-16. MSG_CONF_ADD_STREAM_TO_ELEMENT

Field

Message ID

Data length

Dashboard ID

Element ID

Stream ID

Values

0x2C

6

0x0000

0x0005

0x0029

Description

ID of the light sensor dashboard

ID of the signal element

ID of the night mode stream

Then a incoming stream (in to target) is set up to transfer Button status to the target.

Table 5-17. MSG_CONF_STREAM

Description Field

Token

Message ID

Data length

ID

Type

Mode

State

Label

Values

0xFF

0x20

16

0x0030

2

0

0

"LED Toggle\0"

ID of the button stream

Stream type uint_8

In to target

Stream state ON

Label of the stream

A Button is added to the dashboard to toggle the target LED.

Table 5-18. MSG_CONF_DASHBOARD_ELEMENT, ELEMENT_TYPE_BUTTON

Description Field

Token

Message ID

Data length

Dashboard ID

Element ID

Values

0xFF

0x2B

26

0x0000

0x0006

Depending on element type

ID of the light sensor dashboard

Unique ID of the signal element

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

102

Field

Z-Index

X-coordinate

Y-coordinate

Values

0

110

230

Description

Order index, 0 places the element the farthest to the back

X-coordinate of element location.

0 is topmost position on dashboard.

Y-coordinate of element location.

0 is topmost position on dashboard.

Width of element (pixels)

Height of element (pixels)

ELEMENT_TYPE_BUTTON

Width

Height

Element type

Font size

Button text

Toggle button

75

50

0x01

10

"LED Toggle\0"

0x00 = Normal button

0x01 = Toggle button

Normal button

And the button stream is connected to the Button element.

Table 5-19. MSG_CONF_ADD_STREAM_TO_ELEMENT

Field

Message ID

Data length

Dashboard ID

Element ID

Stream ID

Values

0x2C

6

0x0000

0x0006

0x0030

Description

ID of the light sensor dashboard

ID of the button element

ID of the button stream

Control Dashboard

The ADP example sets up a dashboard to control the ADC. The Control dashboard will look something like the screen-shot below.

Notice:  The appearance of screen-shots will vary with operating system version and configuration.

The control dashboard is configured by the messages detailed in the tables below.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

103

First the dashboard itself is set up:

Table 5-20. MSG_CONF_DASHBOARD

Field

Token

Message ID

Data length

ID

Label

Background color

Height

Values

0xFF

0x2A

25

0x0001

Description

"Control Dashboard\0"

0xFFFFFF (transmitted as

0xFFFFFFFFFFFF as each 0xFF character must be transmitted as

0xFFFF, see

Message Format

)

150

Dashboard ID

Dashboard label

Background color of dashboard

Height (in pixels) of dashboard

Then a few labels are added to the dashboard.

Table 5-21. MSG_CONF_DASHBOARD_ELEMENT, ELEMENT_TYPE_LABEL

Description Field

Token

Message ID

Data length

Dashboard ID

Element ID

Z-Index

Values

0xFF

0x2B

45

0x0001

0x0008

0

X-coordinate

Y-coordinate

Width

Height

Element type

Font size

Attribute

Horizontal alignment

Vertical alignment

5

20

128

25

0x00

14

0x01

0

1

ID of control dashboard

Unique ID of label element

Order index, 0 places the element the farthest to the back

X-coordinate of element location.

0 is topmost position on dashboard.

Y-coordinate of element location.

0 is topmost position on dashboard.

Width of element (pixels)

Height of element (pixels)

ELEMENT_TYPE_LABEL

Bold = ON, Italic = OFF

Left

Center

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

104

Field

Background transparency

Background color

Foreground transparency

Foreground color

Label text

Values

0

0xFFFFFF (transmitted as

0xFFFFFFFFFFFF as each 0xFF character must be transmitted as

0xFFFF, see

Message Format

)

Description

RGB color of background

255 (transmitted as 0xFFFF as each 0xFF character must be transmitted as 0xFFFF, see

Message Format )

0x000000

"Hysteresis Values\0"

RGB color of background

Table 5-22. MSG_CONF_DASHBOARD_ELEMENT, ELEMENT_TYPE_LABEL

Field

Token

Message ID

Data length

Dashboard ID

Element ID

Z-Index

X-coordinate

Y-coordinate

Width

Height

Element type

Font size

Attribute

Horizontal alignment

Vertical alignment

Background transparency

Values

0xFF

0x2B

31

0x0001

0x000A

0

25

100

30

25

0x00

14

0x02

0

1

0

Description

ID of control dashboard

Unique ID of label element

Order index, 0 places the element the farthest to the back

X-coordinate of element location.

0 is topmost position on dashboard.

Y-coordinate of element location.

0 is topmost position on dashboard.

Width of element (pixels)

Height of element (pixels)

ELEMENT_TYPE_LABEL

Bold = OFF, Italic = ON

Left

Center

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

105

Field

Background color

Foreground transparency

Foreground color

Label text

Values

0xFFFFFF (transmitted as

0xFFFFFFFFFFFF as each 0xFF character must be transmitted as

0xFFFF, see

Message Format

)

255 (transmitted as 0xFFFF as each 0xFF character must be transmitted as 0xFFFF, see

Message Format )

0x000000

"High\0"

Description

RGB color of background

RGB color of background

Table 5-23. MSG_CONF_DASHBOARD_ELEMENT, ELEMENT_TYPE_LABEL

Field

Token

Message ID

Data length

Dashboard ID

Element ID

Z-Index

X-coordinate

Y-coordinate

Width

Height

Element type

Font size

Attribute

Horizontal alignment

Vertical alignment

Background transparency

Background color

Values

0xFF

0x2B

30

0x0001

0x0009

0

Description

25

60

ID of control dashboard

Unique ID of label element

Order index, 0 places the element the farthest to the back

X-coordinate of element location.

0 is topmost position on dashboard.

Y-coordinate of element location.

0 is topmost position on dashboard.

Width of element (pixels)

Height of element (pixels)

ELEMENT_TYPE_LABEL

30

25

0x00

0

1

14

0x02 Bold = OFF, Italic = ON

Left

Center

0

0xFFFFFF (transmitted as

0xFFFFFFFFFFFF as each 0xFF character must be transmitted as

0xFFFF, see

Message Format

)

RGB color of background

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

106

Field

Foreground transparency

Foreground color

Label text

Values

255

0x000000

"Low\0"

Description

RGB color of background

Table 5-24. MSG_CONF_DASHBOARD_ELEMENT, ELEMENT_TYPE_LABEL

Field

Token

Message ID

Data length

Dashboard ID

Element ID

Z-Index

X-coordinate

Y-coordinate

Width

Height

Element type

Font size

Attribute

Horizontal alignment

Vertical alignment

Background transparency

Background color

Foreground transparency

Foreground color

Label text

Values

0xFF

0x2B

44

0x0001

0x000B

0

Description

350

20

ID of control dashboard

Unique ID of label element

Order index, 0 places the element the farthest to the back

X-coordinate of element location.

0 is topmost position on dashboard.

Y-coordinate of element location.

0 is topmost position on dashboard.

Width of element (pixels)

Height of element (pixels)

ELEMENT_TYPE_LABEL

130

25

0x00

14

1

0

0x01

0

Bold = ON, Italic = OFF

Left

Center

0xFFFFFF (transmitted as

0xFFFFFFFFFFFF as each 0xFF character must be transmitted as

0xFFFF, see

Message Format

)

255 (transmitted as 0xFFFF as each 0xFF character must be transmitted as 0xFFFF, see

Message Format )

0x000000

"ADC Sample Value\0"

RGB color of background

RGB color of background

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

107

Then a stream is set up to set the high value of the hysteresis.

Table 5-25. MSG_CONF_STREAM

Field

Token

Message ID

Data length

ID

Values

0xFF

0x20

16

0x0010

Description

Type

Mode

State

Label

4

0

0

"Hyst. High\0"

ID of the hysteresis high value stream

Stream type uint_16

In to target

Stream state ON

Label of the data stream

A Slider is added to be able to adjust the high value of the hysteresis from the dashboard.

Table 5-26. MSG_CONF_DASHBOARD_ELEMENT, ELEMENT_TYPE_SLIDER

Description Field

Token

Message ID

Data length

Dashboard ID

Element ID

Z-Index

X-coordinate

Y-coordinate

Width

Height

Element type

Minimum value

Maximum value

Initial value

Values

0xFF

0x2B

26

0x0001

0x000D

0

75

100

156

25

0x02

2500

4000

3000

ID of the control dashboard

Unique ID of the slider element

Order index, 0 places the element the farthest to the back

X-coordinate of element location.

0 is topmost position on dashboard.

Y-coordinate of element location.

0 is topmost position on dashboard.

Width of element (pixels)

Height of element (pixels)

ELEMENT_TYPE_SLIDER

And the hysteresis high value stream is connected to the Slider element.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

108

Table 5-27. MSG_CONF_ADD_STREAM_TO_ELEMENT

Field

Message ID

Data length

Dashboard ID

Element ID

Values

0x2C

6

0x0001

0x000D

Description

Stream ID 0x0010

ID of the control dashboard

ID of the hysteresis high slider element

ID of the hysteresis high stream

A stream for hysteresis low values is created and added to a Slider element in the same way as for the hysteresis high value above.

Table 5-28. MSG_CONF_STREAM

Description Field

Token

Message ID

Data length

ID

Values

0xFF

0x20

15

0x0011

Type

Mode

State

Label

4

0

0

"Hyst. Low\0"

ID of the hysteresis low value stream

Stream type uint_16

In to target

Stream state ON

Label of the data stream

Table 5-29. MSG_CONF_DASHBOARD_ELEMENT, ELEMENT_TYPE_SLIDER

Field

Token

Message ID

Data length

Dashboard ID

Element ID

Z-Index

X-coordinate

Y-coordinate

Values

0xFF

0x2B

26

0x0001

0x000C

0

75

60

Description

ID of the control dashboard

Unique ID of the slider element

Order index, 0 places the element the farthest to the back

X-coordinate of element location.

0 is topmost position on dashboard.

Y-coordinate of element location.

0 is topmost position on dashboard.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

109

Field

Width

Height

Element type

Minimum value

Maximum value

Initial value

Values

156

25

0x02

1000

2400

2000

Table 5-30. MSG_CONF_ADD_STREAM_TO_ELEMENT

Field

Message ID

Data length

Dashboard ID

Element ID

Values

0x2C

6

0x0001

0x000C

Description

Width of element (pixels)

Height of element (pixels)

ELEMENT_TYPE_SLIDER

Description

Stream ID 0x0011

ID of the control dashboard

ID of the hysteresis low slider element

ID of the hysteresis low stream

A separate stream for the light sensor ADC values to be fed to the Segment display is set up.

Table 5-31. MSG_CONF_STREAM

Description Field

Token

Message ID

Data length

ID

Type

Mode

State

Label

Values

0xFF

0x20

22

2

0

0x0002

4

"Light Sensor ADC\0"

ID of the adc value stream

Stream type uint_16

Out from target

Stream state ON

Label of the data stream

Then a Segment display with four segments is added to the dashboard.

Table 5-32. MSG_CONF_DASHBOARD_ELEMENT, ELEMENT_TYPE_SEGMENT

Description Field

Token

Message ID

Data length

Dashboard ID

Values

0xFF

0x2B

20

0x0001 ID of the control dashboard

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

110

Field

Element ID

Z-Index

X-coordinate

Y-coordinate

Width

Height

Element type

Count

Base

Transparency

Color

Values

0x000D

0

500

20

150

50

0x05

4

10

0xFF (transmitted as 0xFFFF as each 0xFF character must be transmitted as 0xFFFF, see

Message Format )

0xFF0000 (transmitted as

0xFFFF0000 as each 0xFF character must be transmitted as

0xFFFF, see Message Format

)

Description

Unique ID of the segment display element

Order index, 0 places the element the farthest to the back

X-coordinate of element location.

0 is topmost position on dashboard.

Y-coordinate of element location.

0 is topmost position on dashboard.

Width of element (pixels)

Height of element (pixels)

ELEMENT_TYPE_SEGMENT

4 segments

Ordinary decimal base

0 - 255

RGB color of display

And the ADC sample value stream is connected to the Segment display.

Table 5-33. MSG_CONF_ADD_STREAM_TO_ELEMENT

Description Field

Message ID

Data length

Dashboard ID

Element ID

Stream ID

Values

0x2C

6

0x0001

0x000D

0x0002

ID of the control dashboard

ID of the segment display element

ID of the ADC sample data stream

Terminal

The ADP example sets up a terminal module that looks something like the screen-shot below.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

111

Notice:  The appearance of screen-shots will vary with operating system version and configuration.

The terminal module is configured by the messages detailed in the tables below.

First a stream is set up to send terminal data to the host computer.

Table 5-34. MSG_CONF_STREAM

Description Field

Token

Message ID

Data length

ID

Type

Mode

State

2

0

Values

0xFF

0x20

21

0x0000

2 UINT_8 stream

Outgoing stream (out from target)

Stream state ON

Label "Status messages\0" Label of the data stream

Then the terminal itself is configured.

Table 5-35. MSG_CONF_TERMINAL

Field

Token

Message ID

Data length

ID

Label

Width

Height

Values

0xFF

0x26

26

0x0000

"Status terminal\0"

80

50

Description

ID of terminal

Terminal label

Number of characters wide

Number of lines high

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

112

Field

Background color

Foreground color

Values

0xFFFFFF (transmitted as

0xFFFFFFFFFFFF as each 0xFF character must be transmitted as

0xFFFF, see

Message Format

)

0x008000

Description

RGB background color

RGB foreground color

And finally the data stream is connected to the terminal module.

Table 5-36. MSG_CONF_ADD_TO_TERMINAL

Field

Token

Message ID

Data length

Terminal ID

Stream ID

Mode

Text color

Values

0xFF

0x27

27

0x0000

0x0000

0xFF (transmitted as 0xFFFF as each 0xFF character must be transmitted as 0xFFFF, see

Message Format )

0x000000

Description

ID of terminal

ID of stream

Implicit newline in incoming text = ON

RGB color of the text stream received

Tag text

Tag text color

"Status messages\0"

0x000000 RGB color of the tag text

Data Transmission

When the terminal module and the two dashboards have been set up as described in the previous sections the ADP example goes into a mode where it is continuously sending data to the host computer and receiving data from the host computer according to the configured streams. Below are given examples of data messages being transmitted from the Atmel ATSAMD21 target to the host computer.

Table 5-37. Light Sensor ADC Stream

Description Field

Token

Message ID

Data length

Number of streams (N)

Stream ID

Num bytes (Xn)

Stream X data sample M

Values

0xFF

0x40

6

1

0x0002

2

634 (0x027A)

ID of ADC value stream

Number of bytes from the stream

The data of the stream (uint_16)

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

113

Table 5-38. Night Mode Stream

Field

Token

Message ID

Data length

Number of streams (N)

Stream ID

Num bytes (Xn)

Stream X data sample M

Values

0xFF

0x40

5

1

0x0029

1

0x01 (Bright light, day mode)

Description

ID of night mode stream

Number of bytes from the stream

The data of the stream (uint_8)

When the night mode changes the example also changes the background color of the terminal module by sending another MSG_CONF_TERMINAL.

Table 5-39. MSG_CONF_TERMINAL to update Terminal Background Color to White

Description Field

Token

Message ID

Data length

ID

Label

Width

Height

Background color

Foreground color

Values

0xFF

0x26

26

0x0000

"Status terminal\0"

80

50

0xFFFFFF

0x008000

ID of terminal

Terminal label

Number of characters wide

Number of lines high

RGB background color

RGB foreground color

Table 5-40. Status Message Stream

Field

Token

Message ID

Data length

Number of streams (N)

Stream ID

Values

0xFF

0x40

44

1

0x0000

Description

ID of status message stream

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

114

Field

Num bytes (Xn)

Stream X data samples

Values

40

"It's bright again... Entered day mode!\r\n"

{0x49, 0x74, 0x27, 0x73, 0x20,

0x62, 0x72, 0x69, 0x67, 0x68,

0x74, 0x20, 0x61, 0x67, 0x61,

0x69, 0x6E, 0x2E, 0x2E, 0x2E,

0x20, 0x45, 0x6E, 0x74, 0x65,

0x72, 0x65, 0x64, 0x20, 0x64,

0x61, 0x79, 0x20, 0x6D, 0x6F,

0x64, 0x65, 0x21, 0x0D, 0x0A}

Description

Number of bytes from the stream

The data of the stream (uint_8)

Examples of data messages for the various streams from the computer to the target can be found in the tables below.

Table 5-41. Hysteresis Low Value Stream Data Message

Description Field

Token

Message ID

Data length

Stream ID

Bytes sent

Data bytes

Values

0xFF

0x14

5

0x0011

2

0x07C6

MSG_RES_DATA

ID of hysteresis low value stream

Number of bytes in the data payload

The data (uint_16)

Table 5-42. Hysteresis High Value Stream Data Message

Field

Token

Message ID

Data length

Stream ID

Values

0xFF

0x14

5

0x0002

Description

MSG_RES_DATA

Bytes sent

Data bytes

2

0x0BB7

ID of hysteresis high value stream

Number of bytes in the data payload

The data (uint_16)

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

115

Table 5-43. LED Toggle Stream Data Message

Field

Token

Message ID

Data length

Stream ID

Bytes sent

Values

0xFF

0x14

5

0x0030

1

Description

MSG_RES_DATA

Data bytes 0x00

ID of LED toggle stream

Number of bytes in the data payload

The data (uint_8)

5.2.3. Message Flow

The target is the master in the system, whereas the host computer is the slave. The target will initiate communication, and the computer will respond. However, the computer will transmit data to the target

MCU as soon as data is generated on the computer.

Before any data can be exchanged between the target and the computer the connection must be established using handshake messages.

5.2.4. Message Format

The ADP protocol uses a common message format for both directions of communication and all message types.

Table 5-44. ADP Message Format

Field

Token

Message ID

Data length

Data

Size

1 byte

1 byte

2 bytes

N bytes

Values

0xFF

0x00-0xFE

0x0000-0xFFFF

...

Description

Start token for ADP data

Identifies the type of message being sent

Length of data packet

(bytes)

Data content of the message

Token

The value 0xFF followed by a value other than 0xFF (0xFF is not a valid Message ID) is used to indicate start of message. This means that 0xFF must be sent in between each message.

If the value 0xFF is to be transmitted as part of data or data length, a new 0xFF should be inserted after it. When receiving messages, two 0xFF should be decoded as a single 0xFF. The extra 0xFF bytes are not contributing to the Data length field. For example a color field with value 0xFFFFFF will have to be transmitted as 0xFFFFFFFFFFFF but only contributes to the data length by three bytes.

The value 0xFF is not allowed to be used as a message ID. When polling for data over SPI, the 0xFF token must be used as a dummy character to not trigger a command unintentionally.

Endianness

All message data is ordered using little endian.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

116

5.2.5. Message Types

There are three main message types; Request messages, Configuration messages, and Data messages.

5.2.5.1. Request Messages

Request messages are used by the target to request information/status from the host PC. These messages are pre-fixed with MSG_REQ. The PC should always respond with the corresponding response message, pre-fixed MSG_RES.

Table 5-45. Request Messages and Responses

Message Type

MSG_REQ_HANDSHAKE

MSG_RES_HANDSHAKE

MSG_REQ_STATUS

MSG_RES_STATUS

MSG_RES_DATA

ID

0x00

0x10

0x02

0x12

0x14

Description

Request handshake

Respond to handshake

Request status from PC

Respond to status

Raw data from PC to target

5.2.5.2. Configuration Messages

Used by target to send configuration settings to the PC. These messages are pre-fixed with MSG_CONF.

The PC should respond to these messages with an acknowledge message (MSG_ACK).

Table 5-46. Configuration Messages, Target to PC

Message type

MSG_CONF_STREAM

Reserved

MSG_CONF_GRAPH

ID

0x20

0x21

0x22

0x23

Description

Create a new stream

Reserved for future use

Create new graph or reconfigure existing one

Add stream to axis in graph

MSG_CONF_ADD_STREAM_T

O_AXIS

MSG_CONF_CURSOR_TO_GR

APH

Reserved

MSG_CONF_TERMINAL

0x24

0x25

0x26

Add parameter cursor to graph

Reserved for future use

Create new terminal or reconfigure existing one

Add stream to terminal

MSG_CONF_ADD_TO_TERMIN

AL

MSG_CONF_INFO

MSG_CONF_AXIS

0x27

0x28

0x29

MSG_CONF_DASHBOARD

0x2A

Info about the application

Create new axis or reconfigure existing one

Add dashboard container

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

117

Message type

MSG_CONF_DASHBOARD_EL

EMENT

MSG_CONF_ADD_STREAM_T

O_ELEMENT

ID

0x2B

0x2C

Description

Add element to dashboard container

Tie an already configured stream to an already configured dashboard element.

Table 5-47. Configuration Messages, PC to Target

Message type

MSG_CONF_ACK

ID

0x30

Description

Status of last received configuration message

5.2.5.3. Data Messages

Used by a target to send data to the PC. Prefixed with MSG_DATA. These messages should not be responded too.

Table 5-48. Data Messages

Message Type

MSG_DATA_STREAM

ID

0x40

Description

Send data from one or more streams

5.2.5.4. Request Message Details

MSG_REQ_HANDSHAKE

Before any data can be exchanged between the target and the PC the connection must be established using handshake messages.

Field

Message ID

Data length

Protocol version

Options

Token

Size

1 byte

2 bytes

1 byte

1 byte

8 bytes

Values

0x00

10

0x01-0xFF

Description

0xXX

{0x58, 0x99, 0xAB,

0xC9, 0x0F, 0xE2, 0xF7,

0xAA}

Version of protocol on target

Reserved for future use

Token used to verify

ADP protocol

MSG_RES_HANDSHAKE

The PC should respond to a handshake request from the target with this packet. The PC should always communicate with the target using the protocol version stated in the targets handshake request message.

If the PC for some reason is unable to do this, the handshake request must be rejected.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

118

Field

Message ID

Data length

Handshake status

Size

1 byte

2 bytes

1 byte

Values

0x10

1

0x00: Handshake accepted

0x01: Handshake rejected. Invalid protocol version.

0x02: Handshake rejected. Other reason.

Description

MSG_REQ_STATUS

Message used by target to request status from PC. It is good practice to ask for status each time a new configuration message is sent. While sending raw data, it is good practice to ask for status... occasionally.

Description Field

Message ID

Data length

Size

1 byte

2 bytes

Values

0x02

0

This message has no data fields.

MSG_RES_STATUS

Status message from PC to target. Once a status is requested from the target and this packet is sent, all status flags should be cleared on the PC.

Description Field

Message ID

Data length

Status code

Size

1 byte

2 bytes

2 bytes

Values

0x12

2

0x0000 Reserved for future use

MSG_RES_DATA

Data packet from PC to target MCU. This message can come asynchronously from the PC. I.e. without the target MCU having requested it.

Description Field

Message ID

Data length

Stream ID

Size

1 byte

2 bytes

2 bytes

Values

0x14

3 + Data bytes

ID of stream

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

119

Field

Bytes sent

Data bytes

Size

1 byte

N bytes

Table 5-49. STREAM_DATA_TYPE

2

3

Type code

0

1

Data type

EVENT

STRING

UINT_8

INT_8

Values

5.2.5.5. Configuration Message Details

MSG_CONF_STREAM

Used to create a new stream. The type of the stream can be either EVENT, TEXT, or DATA. Each stream must be given an unique ID.

Field

Message ID

Data length

ID

Type

Mode

Size

1 byte

2 bytes

2 bytes

1 byte

1 byte

Values

0x20

5 + label length (N) + parameter length (M)

0x0000-0xFFFF

Description

ID of stream

STREAM_DATA_TYPE Stream type

0 = Incoming (normal)

1 = Incoming (single value)

2 = Outgoing

Stream mode/direction

Direction is defined seen from target

State

Label

Parameters

1 byte

N bytes

M bytes

0 = ON

1= OFF

Null-terminated string

Byte array

Stream state

Label of the data stream

Parameters specific to stream type

Parameters

None

None

None

None

Description

Number of bytes in the data payload. If the target has requested data from an unknown stream, or if the stream has no data to send, this field should be set to 0 and the appropriate status flag should be set.

The data

Data size

0 Bytes

N Bytes

1 Byte

1 Byte

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

120

12

13

20

8

9

10

11

Type code

6

7

4

5

Data type

UINT_16

INT_16

UINT_32

INT_32

XY_8

XY_16

XY_32

BOOL

Float

Double

Grid

Parameters

None

None

None

None

None

None

None

None

None

None

Base data type (1Byte, e.g. 6 for UINT_32)

Width of grid (1Byte)

Depth of grid (1Byte)

Data size

2 Bytes

2 Bytes

4 Bytes

4 Bytes

2 Bytes

4 Bytes

8 Bytes

1 Byte

4 Bytes

8 Bytes

Size of base data type *

Width * Depth

The XY data types are combos of X and Y coordinates. If the format is XY_8 the data will contain one byte of X-coordinate and one byte of Y-coordinate. For XY_16 the data will contain two bytes of Xcoordinate and two bytes of Y-coordinates and for XY_32 each coordinate will be four bytes long.

MSG_CONF_GRAPH

Used to create a new or reconfigure a existing graph view. The graph view requires an unique ID. Values for range, labels, and background color can also be set.

Description Field

Message ID

Data length

Size

1 byte

2 bytes

Values

0x22

23 + label length (N) +

Xlabel length (M)

0x0000-0xFFFF

Null-terminated string

ID

Label

Xmin

Xmax

Xlabel

Xscale numerator

Xscale denumerator

2 bytes

N bytes

4 bytes

4 bytes

M bytes

4 bytes

4 bytes

Null-terminated string

ID of new graph

Graph label

Range Xmin value

Range Xmax value

X label

X range scale value. Set to 0 to enable auto range.

X range scale value. Set to 0 to enable auto range.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

121

Field

Scale mode

Background color

Scroll mode

Size

1 byte

3 bytes

1 byte

Values

0 = scaling off

1 = auto-scale

0xRRGGBB

0 = no scrolling

1 = stepping

2 = scroll

3 = circular/sweep

Description

Vertical scaling

RGB background color

Horizontal scrolling

MSG_CONF_ADD_STREAM_TO_AXIS

Used to add a stream to the specified graph view.

Field

Message ID

Data length

Graph ID

Axis ID

Stream ID

Size

1 byte

2 bytes

2 bytes

2 bytes

2 bytes

Sample rate numerator 4 bytes

Sample rate denominator

Yscale numerator

Yscale denumerator

Yoffset

Transparency

Mode

4 bytes

4 bytes

4 bytes

4 bytes

1 byte

1 byte

Values

0x23

32

0x0000-0xFFFF

0x0000-0xFFFF

0x0000-0xFFFF

0 - 255

For graphs: bit 0 = line ON/OFF bit 1 = points

ON/OFF

For text:

0 = flag

1 = text

Description

ID of graph

ID of axis

ID of stream

Sample rate of stream, set to 0 if not applicable

Sample rate of stream, set to 0 in not applicable

Y range scale value. Set to 0 to enable auto range.

Y range scale value. Set to 0 to enable auto range.

Offset of values

Adjust the transparency

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

122

Field

Thickness

Color

Size

1 byte

3 bytes

Values

0 - 255

0xRRGGBB

Description

Thickness of line

RGB color of line

MSG_CONF_CURSOR_TO_GRAPH

Used to add a parameter cursor to a graph.

Field

Message ID

Data length

Stream ID

Graph ID

Axis ID

Label

Thickness

Color

Initial value

Minimum

Maximum

Scale numerator

Scale denominator

Scale offset

Style

Size

1 byte

2 bytes

2 bytes

2 bytes

2 bytes

N bytes

1 byte

3 bytes

4 bytes

4 bytes

4 byte

4 bytes

4 bytes

4 bytes

1 byte

Values

0x24

35 + label length (N)

0x0000-0xFFFF

0x0000-0xFFFF

0x0000-0xFFFF

Null-terminated string

0 - 255

0xRRGGBB

0xXX

Description

ID of stream

ID of graph

ID of axis

Label of cursor

Thickness of line

RGB color of cursor

Starting point of cursor

Minimum allowed value

Maximum allowed value

Numerator of scaling value

Denominator of scaling value

Offset of scaling value

Reserved for future use

MSG_CONF_TERMINAL

Used to create a new or reconfigure an existing terminal. The terminal requires an unique ID. Values for label and background color must also be set.

Description Field

Message ID

Data length

ID

Label

Width

Height

Size

1 byte

2 bytes

2 bytes

N bytes

1 byte

1 byte

Values

0x26

10 + label length (N)

0x0000-0xFFFF

Null-terminated string

0 - 255

0 - 255

ID of terminal

Terminal label

Number of characters wide

Number of lines high

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

123

Field

Background color

Foreground color

Size

3 bytes

3 byte

MSG_CONF_ADD_TO_TERMINAL

Used to add a stream to the specified terminal.

Field

Message ID

Data length

Terminal ID

Stream ID

Mode

Text color

Size

1 byte

2 bytes

2 bytes

2 bytes

1 byte

3 bytes

Values

0xRRGGBB

0xRRGGBB

Values

0x27

11 + tag length (N)

0x0000-0xFFFF

0x0000-0xFFFF

0bXXXNXXXX

0xRRGGBB

Description

RGB background color

RGB foreground color

Description

ID of terminal

ID of stream

N = implicit newline in incoming text

RGB color of the text stream received

Descriptive tag

RGB color of the tag text

Tag text

Tag text color

N bytes

3 bytes

Null-terminated string

0xRRGGBB

MSG_CONF_INFO

Used to send info about the application. For example, a text string describing the example application.

Description Field

Message ID

Data length

Title

Description

Size

1 byte

2 bytes

N bytes

M bytes

Values

0x28

Title length (N) +

Description length (M)

Null-terminated string

Null-terminated string

Application title

Short description of the application

MSG_CONF_AXIS

Used to create a new or reconfigure an existing axis of a graph view. The axis requires a unique ID.

Values for range, label, and axis color must also be set

Description Field

Message ID

Data length

Axis ID

Graph ID

Label

Size

1 byte

2 bytes

2 bytes

2 bytes

N bytes

Values

0x29

24 + label length (N)

0x0000-0xFFFF

0x0000-0xFFFF

Null-terminated string

ID of new axis

ID of graph containing the axis

Axis label

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

124

Field

Ymin

Ymax

Yscale numerator

Yscale denominator

Size

4 bytes

4 bytes

4 bytes

4 bytes

Values Description

Range Ymin value

Range Ymax value

Y range scale value. Set to 0 to enable auto range.

Y range scale value. Set to 0 to enable auto range.

Vertical scaling Scale mode 1 byte 0 = scaling off

1 = auto-scale

0xRRGGBB Axis color 3 bytes

MSG_CONF_DASHBOARD

Add a dashboard container where dashboard elements can be placed.

Field

Message ID

Data length

ID

Label

Background color

Size

1 byte

2 bytes

2 bytes

N bytes

3 bytes

Values

0x2A

7 + label length (N)

0x0000-0xFFFF

Null-terminated string

0xRRGGBB

RGB color

Description

Height 2 bytes

Dashboard ID

Dashboard label

Background color of dashboard

Height (in pixels) of dashboard

MSG_CONF_DASHBOARD_ELEMENT

Configure a dashboard element and add it to the specified dashboard. The table shows common fields for all dashboard element types. Additional fields must be added, depending on element type. See below.

Description Field

Message ID

Data length

Dashboard ID

Element ID

Z-Index

Size

1 byte

2 bytes

2 bytes

2 bytes

1 byte

Values

0x2B

14 + element specific length

0x0000-0xFFFF

0x0000-0xFFFF

Depending on element type

ID of dashboard to add the element to

Unique ID of element

Order index, 0 places the element the farthest to the back

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

125

Field

X-coordinate

Y-coordinate

Width

Height

Element type

Size

2 bytes

2 bytes

2 bytes

2 bytes

1 byte

Values

Coordinate value in pixels

Coordinate value in pixels

Width in pixels

Height in pixels

ELEMENT_TYPE

Description

X-coordinate of element location. 0 is topmost position on dashboard.

Y-coordinate of element location. 0 is topmost position on dashboard.

Width of element

Height of element

See each element type below

ELEMENT_TYPE_LABEL

The tables below describes the ELEMENT_TYPE_LABEL specific parameters and additional fields for the MSG_CONF_DASHBOARD_ELEMENT message.

Table 5-50. ELEMENT_TYPE_LABEL Parameters

ELEMENT_TYPE

Total data length of MSG_CONF_DASHBOARD_ELEMENT when using

ELEMENT_TYPE_LABEL

0x00

26 + length of default text (N)

Table 5-51. Additional Data Fields to MSG_CONF_DASHBOARD_ELEMENT

Field

Font size

Attribute

Size

1 byte

1 byte

Values

1-255

Bit 0: Bold ON/OFF

Bit 1: Italic ON/OFF

Horizontal alignment 1 byte 0 = Left

1 = Center

2 = Right

Vertical alignment 1 byte 0 = Top

1 = Center

2 = Bottom

Background transparency 1 byte 0 - 255

Background color 3 bytes 0xRRGGBB

Foreground transparency 1 byte 0 - 255

Foreground color

Label text

3 bytes 0xRRGGBB

N bytes Null-terminated string max. 100 bytes

Description

RGB color of background

RGB color of background

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

126

Example

The picture below shows an example of two labels with the corresponding parameters given in the tables below the picture.

Notice:  The appearance of elements will vary with operating system version and configuration.

Table 5-52. Label1

Field

Z-index

X-coordinate

Y-coordinate

Width

Height

Element type

Font size

Attribute

Horizontal alignment

Vertical alignment

Background transparency

Background color

[DRAFT]

Value

0

30

30

200

100

0x00

16

0x01

0

0

255

0x64FF64

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

127

Field

Foreground transparency

Foreground color

Label text

Value

255

0x000000

"Label1\0"

Table 5-53. Label2

Field

Z-index

X-coordinate

Y-coordinate

Width

Height

Element type

Font size

Attribute

Horizontal alignment

Vertical alignment

Background transparency

Background color

Foreground transparency

Foreground color

Label text

Value

1

90

70

75

25

0x00

1

1

12

0x00

100

0x646464

255

0x7C0000

"Label2\0"

ELEMENT_TYPE_BUTTON

The tables below describes the ELEMENT_TYPE_BUTTON specific parameters and additional fields for the MSG_CONF_DASHBOARD_ELEMENT message.

Table 5-54. ELEMENT_TYPE_BUTTON Specific Parameters

ELEMENT_TYPE

Total data length of MSG_CONF_DASHBOARD_ELEMENT when using

ELEMENT_TYPE_BUTTON

0x01

16 + length of button text (N)

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

128

Table 5-55. Additional Data Fields to MSG_CONF_DASHBOARD_ELEMENT for ELEMENT_TYPE_BUTTON

Field

Font size

Size Values

1 byte 0-255

Button text N bytes Null-terminated string, max. 20 bytes

Toggle button 1 byte 0x00 = Normal button

0x01 = Toggle button

Description

For toggle button text is selected by '/' delimited text (<off text>/<on text>)

Change mode to toggle button. Button text is selected by '/' delimited text field.

Example

The picture below shows an example of two buttons; one normal button and one toggle button. The element data fields for the example are shown in the tables below the picture.

Notice:  The appearance of elements will vary with operating system version and configuration.

Table 5-56. Button

Field

Z-index

X-coordinate

Y-coordinate

Width

[DRAFT]

Value

0

30

30

75

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

129

Field

Height

Element type

Font size

Button text

Toggle button

Table 5-57. Toggle Button

Field

Z-index

X-coordinate

Y-coordinate

Width

Height

Element type

Font size

Button text

Toggle button

Value

25

0x01

12

"Button\0"

0x00

Value

0

30

70

120

25

0x01

12

"ON/OFF\0"

0x01

ELEMENT_TYPE_SLIDER

The tables below describes the ELEMENT_TYPE_SLIDER specific parameters and additional fields for the MSG_CONF_DASHBOARD_ELEMENT message.

Table 5-58. ELEMENT_TYPE_SLIDER Specific Parameters

ELEMENT_TYPE

Total data length of MSG_CONF_DASHBOARD_ELEMENT when using

ELEMENT_TYPE_SLIDER

0x02

26

Table 5-59. Additional Data Fields to MSG_CONF_DASHBOARD_ELEMENT for ELEMENT_TYPE_SLIDER

Field

Minimum value

Maximum value

Initial value

Size

4 bytes

4 bytes

4 byte

Values Description

Example

The picture below shows an example of a slider element with a range from 0 to 50 and an initial value of

20. The corresponding element data fields are given in the table below the picture.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

130

Notice:  The appearance of elements will vary with operating system version and configuration.

Table 5-60. Slider

Field

Z-index

X-coordinate

Y-coordinate

Width

Height

Element type

Minimum value

Maximum value

Initial value

30

0x02

0

50

20

Value

0

20

20

200

ELEMENT_TYPE_PROGRESS

The tables below describes the ELEMENT_TYPE_PROGRESS specific parameters and additional fields for the MSG_CONF_DASHBOARD_ELEMENT message.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

131

Table 5-61. ELEMENT_TYPE_PROGRESS Specific Parameters

ELEMENT_TYPE

Total data length of MSG_CONF_DASHBOARD_ELEMENT when using

ELEMENT_TYPE_PROGRESS

0x03

29

Table 5-62. Additional Data Fields to MSG_CONF_DASHBOARD_ELEMENT for ELEMENT_TYPE_PROGRESS

Field

Minimum value

Maximum value

Initial value

Color

Size

4 bytes

4 bytes

4 byte

3 bytes

Values

0xRRGGBB

Description

RGB color of progress bar

Example

The picture below shows an example of a progress bar element. The corresponding element data fields are given in the table below the picture.

Notice:  The appearance of elements will vary with operating system version and configuration.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

132

Table 5-63. Progress Bar

Field

Z-index

X-coordinate

Y-coordinate

Width

Height

Element type

Minimum value

Maximum value

Initial value

Color

Value

0

10

10

100

30

0x03

0

100

50

0x01D328

ELEMENT_TYPE_SIGNAL

The tables below describes the ELEMENT_TYPE_SIGNAL specific parameters and additional fields for the MSG_CONF_DASHBOARD_ELEMENT message.

Table 5-64. ELEMENT_TYPE_SIGNAL Specific Parameters

ELEMENT_TYPE

Total data length of MSG_CONF_DASHBOARD_ELEMENT when using

ELEMENT_TYPE_SIGNAL

0x04

22

Table 5-65. Additional Data Fields to MSG_CONF_DASHBOARD_ELEMENT for ELEMENT_TYPE_SIGNAL

Field

On transparency

On color

Off transparency

Off color

Size

1 byte

3 bytes

1 byte

3 bytes

Values

0 - 255

0xRRGGBB

0xRRGGBB

Description

RGB color for on state

RGB color for off state

Example

The picture below shows an example of a signal element. The corresponding element data fields are given in the table below the picture.

Notice:  The appearance of elements will vary with operating system version and configuration.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

133

Table 5-66. Signal

Field

Z-index

X-coordinate

Y-coordinate

Width

Height

Element type

On transparency

On color

Off transparency

Off Color

Value

0

20

20

50

50

0x04

255

0x00FF00

255

0xFF0000

ELEMENT_TYPE_SEGMENT

The tables below describes the ELEMENT_TYPE_SEGMENT specific parameters and additional fields for the MSG_CONF_DASHBOARD_ELEMENT message.

Table 5-67. ELEMENT_TYPE_SEGMENT Specific Parameters

ELEMENT_TYPE

Total data length of MSG_CONF_DASHBOARD_ELEMENT when using

ELEMENT_TYPE_SEGMENT

0x05

20

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

134

Table 5-68. Additional Data Fields to MSG_CONF_DASHBOARD_ELEMENT for ELEMENT_TYPE_SEGMENT

Field

Count

Base

Transparency

Color

Size

1 byte

1 byte

1 byte

3 bytes

Values

1-20

2-16

0 - 255

0xRRGGBB

Description

Number of displays

Numeric base

RGB color of display

Example

The picture below shows an example of a segment element with two digits. The corresponding element data fields are given in the table below the picture.

Notice:  The appearance of elements will vary with operating system version and configuration.

Table 5-69. Signal

Field

Z-index

X-coordinate

Y-coordinate

Width

[DRAFT]

Value

0

30

30

174

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

135

Field

Height

Element type

Count

Base

Transparency

Color

Value

150

0x05

2

10

255

0xFD0000

ELEMENT_TYPE_GRAPH

The tables below describes the ELEMENT_TYPE_GRAPH specific parameters and additional fields for the MSG_CONF_DASHBOARD_ELEMENT message. This element generates a graph that visualizes the data from the target. There will be one input stream for each plot.

Table 5-70. ELEMENT_TYPE_GRAPH Specific Parameters

ELEMENT_TYPE

Total data length of MSG_CONF_DASHBOARD_ELEMENT when using

ELEMENT_TYPE_GRAPH

0x06

41 + length of title (N)

Table 5-71. Additional Data Fields to MSG_CONF_DASHBOARD_ELEMENT for ELEMENT_TYPE_GRAPH

Field

Title color

Background color

Graph background color

Title text

Plot count

Xmin

Xmax

Size Values

3 bytes 0xRRGGBB

3 bytes 0xRRGGBB

3 bytes 0xRRGGBB

N bytes Null-terminated string max. 20 bytes

1 byte 1-10

4 bytes Floating point, seconds

4 bytes Floating point, seconds

Description

RGB color of title

RGB color of graph frame

RGB color of graph

Number of plots

Will be converted to

<minutes>:<seconds> format

Will be converted to

<minutes>:<seconds> format

Ymin

Ymax

Mode

4 bytes Floating point

4 bytes Floating point

1 byte Bit 0: Mouse interaction

ON/OFF

Bit 1: Fit graph to right edge of canvas

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

136

Example

The picture below shows an example of a graph element with tree input plot inputs. The element data fields for the example is shown in the table below the picture.

Notice:  The appearance of elements will vary with operating system version and configuration.

Table 5-72. Graph

Field

Z-index

X-coordinate

Y-coordinate

Width

Height

Element type

Title color

Background color

Graph background color

Title text

Plot count

Xmin

Xmax

Ymin

[DRAFT]

Value

0

10

10

500

250

0x06

0xFFFFFF

0x000000

0x646464

"Graph\0"

3

0

100

0

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

137

Field

Ymax

Mode

Value

2.45

0x01

ELEMENT_TYPE_NUMERICAL_INPUT

The tables below describes the ELEMENT_TYPE_NUMERICAL_INPUT specific parameters and additional fields for the MSG_CONF_DASHBOARD_ELEMENT message. This element type is used to output numerical values to the target from the PC. The element is editable in the dashboard.

Table 5-73. ELEMENT_TYPE_NUMERICAL_INPUT Specific Parameters

ELEMENT_TYPE

Total data length of MSG_CONF_DASHBOARD_ELEMENT when using

ELEMENT_TYPE_NUMERICAL_INPUT

0x07

26

Table 5-74. Additional Data Fields to MSG_CONF_DASHBOARD_ELEMENT for

ELEMENT_TYPE_NUMERICAL_INPUT

Field

Minimum

Maximum

Value

Size

4 bytes

4 bytes

4 bytes

Values

Signed 32 bit integer

Signed 32 bit integer

Signed 32 bit integer

Description

Initial value

Example

The picture below shows an example of a numerical input element with a range of valid values from -100 to 100 and a default value of 30. The element data fields for the example is shown in the table below the picture.

Notice:  The appearance of elements will vary with operating system version and configuration.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

138

Table 5-75. Numerical Input

Field

Z-index

X-coordinate

Y-coordinate

Width

Height

Element type

Minimum

Maximum

Value

Value

0

20

20

50

25

0x07

-100

100

30

ELEMENT_TYPE_RADIO

The tables below describes the ELEMENT_TYPE_RADIO specific parameters and additional fields for the MSG_CONF_DASHBOARD_ELEMENT message. This element generates a group of radio buttons where only one option can be selected. Initially the first option is selected.

Table 5-76. ELEMENT_TYPE_RADIO Specific Parameters

ELEMENT_TYPE

Total data length of MSG_CONF_DASHBOARD_ELEMENT when using

ELEMENT_TYPE_RADIO

0x08

17 + length of text fields (N)

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

139

Table 5-77. Additional Data Fields to MSG_CONF_DASHBOARD_ELEMENT for ELEMENT_TYPE_RADIO

Field

Font size

Number of items

Orientation

Size

1 byte

1 byte

1 byte

Values

0-100

1-10

0 = Horizontal

1 = Vertical

Description

Text fields N bytes Null-terminated string max. 20 bytes '/' separated option list

Example

The picture below shows an example of radio button group with three buttons. The corresponding element data fields are given in the table below the picture.

Notice:  The appearance of elements will vary with operating system version and configuration.

Table 5-78. Radio Button Group

Field

Z-index

X-coordinate

Y-coordinate

[DRAFT]

Value

0

20

20

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

140

Field

Width

Height

Element type

Font size

Number of radio buttons

Orientation

Text fields

Value

100

100

0x08

16

3

1

"Op 1/Op 2/Op 3\0"

ELEMENT_TYPE_PIE

The tables below describes the ELEMENT_TYPE_PIE specific parameters and additional fields for the

MSG_CONF_DASHBOARD_ELEMENT message. This element generates a pie chart. The size of the slices are updated based on the data from the target to the PC. There will be one data stream input for each slice.

Table 5-79. ELEMENT_TYPE_PIE Specific Parameters

ELEMENT_TYPE

Total data length of MSG_CONF_DASHBOARD_ELEMENT when using

ELEMENT_TYPE_PIE

0x09

21 + length of title (N)

Table 5-80. Additional Data Fields to MSG_CONF_DASHBOARD_ELEMENT for ELEMENT_TYPE_PIE

Field

Background color 3 bytes 0xRRGGBB

Title color

Title

Number of slices

Size

3 bytes

N bytes

Values

0xRRGGBB

Null-terminated string max. 20 bytes

1 byte 1-10

Description

RGB color of background

RGB color of title

Example

The picture below shows an example of a pie element with three slices. The corresponding element data fields are given in the table below the picture.

Notice:  The appearance of elements will vary with operating system version and configuration.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

141

Table 5-81. Numerical Input

Field

Z-index

X-coordinate

Y-coordinate

Width

Height

Element type

Background color

Title color

Title

Number of slices

Value

0

20

20

600

400

0x09

0xFFFFFF

0x000000

"Pie\0"

3

ELEMENT_TYPE_SURFACE

The tables below describes the ELEMENT_TYPE_SURFACE specific parameters and additional fields for the MSG_CONF_DASHBOARD_ELEMENT message. This element generates a 3D surface plot that visualizes the grid of data points from the target. There is one input stream for that accepts grid type data.

Table 5-82. ELEMENT_TYPE_SURFACE Specific Parameters

ELEMENT_TYPE

Total data length of MSG_CONF_DASHBOARD_ELEMENT when using

ELEMENT_TYPE_SURFACE

0x0D

47

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

142

Table 5-83. Additional Data Fields to MSG_CONF_DASHBOARD_ELEMENT for ELEMENT_TYPE_SURFACE

Field

Fill color

Mesh color

Background color

Background gradient color

Axis color

Tick color

X Rotation

Y Rotation

Z Rotation

Size Values

3 bytes 0xRRGGBB

3 bytes 0xRRGGBB

4 bytes 0xAARRGGBB

4 bytes 0xAARRGGBB

3 bytes 0xRRGGBB

3 bytes 0xRRGGBB

1 byte

1 byte

1 byte

-90-90

-90-90

-90-90

Description

RGB color of surface fill

RGB color of surface mesh

RGB color of background

RGB color of background gradient

RGB color of axes

RGB color of ticks

Rotation of view around X axis in degrees

Rotation of view around Y axis in degrees

Rotation of view around Z axis in degrees

Attributes 1 byte Bit 0: Show X axis

Bit 1: Show Y axis

Bit 2: Show Z axis

Bit 3: Show fill

Bit 4: Show mesh

Bit 5: Use palette coloring

Scaling mode

Axis minimum

Axis maximum

1 byte 0 = Static

1 = Scale roof and floor

2 = Scale roof

3 = Scale floor

4 = Sticky scale roof and floor

5 = Sticky scale roof

6 = Sticky scale floor

4 bytes Floating point

4 bytes Floating point

Minimum value (floor) of Y axis

Maximum value (roof) of Y axis

Example

The picture below shows an example of a surface element. The element data fields for the example are shown in the table below the picture.

Notice:  The appearance of elements will vary with operating system version and configuration.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

143

Table 5-84. Surface

Field

Z-index

X-coordinate

Y-coordinate

Width

Height

Element type

Fill color

Mesh color

Background color

Axis color

Tick color

[DRAFT]

Value

0

5

5

750

590

0x0D

0x2F4F4F

0x000000

0x00000000

0x505050

0x505050

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

144

Field

X Rotation

Y Rotation

Z Rotation

Attributes

Scaling mode

Axis minimum

Axis maximum

5

0

10

Value

35

-70

0

0b00111111

MSG_CONF_ADD_STREAM_TO_ELEMENT

This message is used to tie an already configured stream to an already configured dashboard element.

Description Field

Message ID

Data length

Dashboard ID

Size

1 byte

2 bytes

2 bytes

Values

0x2C

6

0x0000-0xFFFF

Element ID

Stream ID

2 bytes

2 bytes

0x0000-0xFFFF

0x0000-0xFFFF

ID of dashboard of given element

ID of element

ID of stream for this element

MSG_CONF_ACK

Sent by PC to target to verify whether last received configuration message was valid or not.

Description Field

Message ID

Data length

Status

Size

1 byte

2 bytes

1 byte

Values

0x30

1

0 = Not OK

1 = OK

OK = Last configuration was

OK and applied

Not OK = Last configuration was invalid and got discarded

5.2.5.6. Data Message Details

MSG_DATA_STREAM

This message is used to send data from all enabled streams to the PC. It is possible to send one or multiple samples of data from all streams in one single message. Only data from the enabled streams will be sent.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

145

Field

Message ID

Data length

Number of streams (N)

Stream ID

Num bytes (Xn)

Size

1 byte

2 bytes

1 byte

2 bytes

1 byte

Stream X data sample M Dependent on data type of the stream (Xd)

Values

0x40

1 + number of streams

(N) * (2 + num bytes for each stream (Xn) + length of each data sample in the stream

(Xd))

1 - 255

0x0000-0xFFFF

1-255

Description

ID of stream X

Number of bytes from stream X

The data of stream X

Note that the last row repeats for each sample in the stream and the three last rows repeats for each stream in the message.

MSG_DATA_STREAM_SINGLE

This message is used to send data from a single enabled stream to the PC. Only data from enabled streams will be sent.

Description Field

Message ID

Data length

Stream ID

Stream data sample

Size

1 byte

2 bytes

2 bytes

Dependent on data type of the stream (Xd)

Values

0x41

2 + length of one data sample of the stream

(Xd)

0x0000-0xFFFF ID of stream

The data of stream

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

146

6. Example Code Snippets

This is chapter contains the code snippets used in the examples in this user guide.

6.1. Code Profiling Example Code

A Mass Storage Class example is used as an example on how to use the data polling and control of data variables features. A SAM L21 Xplained Pro board is connected to a host computer both trough Target

USB and Debug USB connectors on the kit. The ATSAML21 target device is running the USB Device

MSC Example from ASF for SAM L21 Xplained Pro.

To be able to work through this example, the following is required:

• Host computer with Atmel Studio 7 (or later) installed (Atmel Data Visualizer is included)

• Atmel ATSAML21 Xplained Pro kit

To do: 

• Connect both the Target USB and Debug USB connectors on the SAM L21 Xplained Pro board

This example makes use of the USB Device MSC Example from ASF for SAM L21 Xplained Pro.

To do: 

• In Atmel Studio, create a New Example Project

• In the New Example dialog, select the SAM L21 device family (or other relevant device) and filter by the keyword "MSC"

• Select the USB Device MSC Example

• Build the project/solution (F7)

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

147

To do: 

• Open the project properties (right click the project in the Solution Explorer and select

Properties)

• On the Tool tab select the appropriate tool and interface

We will now see how Data Visualizer can poll variables from the target and display their values in graphical form.

Important:  Data polling is only available when Data Visualizer is run as an extension within

Atmel Studio. This is because it needs to access the debug system on the device through the

Atmel Studio debugger backend.

First we will add a few lines of code containing variables to poll.

To do:  Open ui.c and add two global variables to the top of the file.

volatile uint32_t write_count = 0; volatile uint32_t read_count = 0;

Important:  Declaring variables you are interested in polling as volatile will ensure that they are placed in SRAM and that their values will not be cached in registers by the compiler. Registers cannot be polled, only SRAM locations.

Tip:  Data polling operates on absolute SRAM locations. It is thus advised to use global variables for this purpose so that they are always available at the same location in SRAM.

Polling locations in the stack can yield unpredictable results based on the stack context at the time of polling.

To do:  Modify the two 'start' functions in ui.c to increment read and write counters on each access started.

void ui_start_read( void )

{

port_pin_set_output_level(EXT1_PIN_GPIO_0, true);

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

148

read_count++;

} void ui_start_write( void )

{

port_pin_set_output_level(EXT1_PIN_GPIO_1, true);

write_count++;

}

To do: 

• Build the project/solution (F7)

• Open Data Visualizer

• Connect

For data polling functionality we need to enable the Code Profiling interface.

To do: 

• Start the Data Visualizer session

• Launch the debug session using Start Debugging and Break (Alt + F5)

Data polling operates on SRAM locations, so to find out where variables are located in SRAM we need to use the Atmel Studio watch window.

To do: 

• Locate the two global variables we added to ui.c

• Right-click each variable and select Add to Watch

• Examine the type field of each variable in the watch window to find its location

Switch back to the Data Visualizer to set up the Code Profiling interface and to connect the two variables to a graph.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

149

6.1.1. Application Interaction using Dashboard Controls

We will now see how components placed on a dashboard in Data Visualizer can be hooked up to variables in the application, and how the dashboard can thus interact with the application at run-time.

Instead of a predefined interval of 1000 USB sync pulses (1 second), we will add a variable compare reference to the original code.

To do:  Modify ui.c to include a LED blinker in the ui_process() handler as shown here.

volatile uint32_t frame_comparator = 100; volatile uint32_t frames_received = 0; void ui_process( uint16_t framenumber)

{

frames_received++; if (frames_received >= frame_comparator) {

LED_Toggle(LED_0_PIN);

frames_received = 0;

}

}

To do: 

• Build the project/solution (F7)

• Launch a debug session using Start Debugging and Break (Alt + F5)

• Find the location of the variable uint32_t frame_comparator

6.2. Terminal Example Code

A typical use of the Terminal module is printf type debugging. A serial interface is used to print debug messages from the target device to the terminal. In the following example an SPI interface will be used but the procedure will be the same for any serial interface.

The target device is an Atmel ATmega256RFR2 on an ATmega256RFR2 Xplained Pro kit. As the SPI interface is already wired internally on the board the only connection needed is the USB cable between the host computer and the Xplained Pro board.

To do: 

• Make a new project in Atmel Studio (FileNewProjectGCC C Executable

Project)

• Replace the content of the automatically generated main.c file with the code below

#include <avr/interrupt.h>

#include <avr/sleep.h> volatile uint8_t led_on; volatile uint8_t send_message;

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

150

volatile uint8_t ticker = 0; const char* message_on = "LED ON "; const char* message_off = "LED OFF ";

ISR (INT4_vect)

{

// Simple debounce

if (PINE & (1 << 4))

return;

// Update LED

if (led_on)

PORTB |= (1 << 4);

else

PORTB &= ~(1 << 4);

// Invert led_on

led_on = ~led_on;

// Flag a message send

send_message = 1;

// Increment ticker

ticker++;

// Reset ticker

if (ticker >= 10)

ticker = 0;

} void spi_send (const char data)

{

PORTB &= ~(1 << PINB0);

// Send a character to the USART

SPDR = data;

// Wait for the character to be sent

while (!(SPSR & (1 << SPIF)))

;

PORTB |= (1 << PINB0);

} int main(void){

// PORTB4 to output

DDRB = (1 << PINB4);

// LED OFF

PORTB |= (1 << PINB4);

led_on = 0;

// Enable pullup on button pin to avoid floating line

PORTE |= (1<<PINE4);

// Enable falling edge interrupt for button pin

EIMSK = (1 << INT4);

EICRB = (1 << ISC41);

// SPI

// MOSI, SCK and /SS as output

DDRB |= (1 << PINB2) | (1 << PINB1) | (1 << PINB0);

// Set /SS high

PORTB |= (1 << PINB0);

// Enable SPI, Master, set clock rate fck/16

SPCR = (1 << SPE) | (1 << MSTR) | (1 << SPR0);

// Interrupts on

sei();

while(1) {

if(send_message) {

// Send a message

const char* pmessage;

if (led_on)

pmessage = message_on;

else

pmessage = message_off;

while (*pmessage)

spi_send(*pmessage++);

// Send the ticker value

spi_send(ticker + '0');

spi_send('\n');

// Sent

send_message = 0;

}

}

}

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

151

The code triggers an interrupt when the switch (SW0) on the Xplained Pro board is pushed and toggles the LED0 at each push. Each time the switch is pushed a message is printed on the SPI interface.

To do:  Build the project/solution (F7).

To do: 

• Open the project properties (right click the project in the Solution Explorer and select

Properties)

• On the Tool tab select the appropriate tool and interface

To do:  Program the application into the target by selecting Start Without Debugging (Ctrl+Alt

+F5).

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

152

To do:  Open Atmel Data Visualizer as an extension inside Atmel Studio by selecting it in the

Tools menu.

6.3. Graph Example Code

To demonstrate how to use the Graph module an example with a night mode switch will be used. An

ATmega256RFR2 Xplained Pro with an I/O1 Xplained Pro extension is suitable as target hardware. The

I/O1 extension board features a light sensor that can be used to detect whether it is night or day. This information can be used for example to switch a lamp on when the surroundings turn dark.

The example requires the following equipment and software:

• Host computer with Atmel Studio 7 or later installed (Atmel Data Visualizer is included)

• Atmel ATmega256RFR2 Xplained Pro kit

• Atmel I/O1 Xplained Pro extension

To run the example the following hardware setup is required:

• I/O1 Xplained Pro extension connected to ATmega256RFR2 Xplained Pro EXT1 connector

• USB cable connected from host computer to ATmega256RFR2 Xplained Pro

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

153

A picture of the setup is shown below.

6.3.1. Basic Graph

To start with we just implement sampling of the light sensor and stream the data to the host computer to be able to view the data as a plot in a graph.

To do: 

• Make a new project in Atmel Studio (FileNewProjectGCC C Executable

Project)

• Replace the content of the automatically generated main.c file with the code below

#include <avr/io.h> uint16_t adc_value = 0; void adc_init(void){

// Internal 1.5V reference, ADC0 as single ended input

ADMUX = (1 << REFS1);

// Enable the ADC,

ADCSRA |= (1<<ADEN);

// Check that the reference is OK

while (0x00 == (ADCSRB & (1 << REFOK)));

} uint16_t adc_sample(void){

// Trigger an ADC conversion

ADCSRA |= (1<<ADSC);

// Wait for conversion to finish

while (0x00 == (ADCSRA & (1 << ADIF)));

// Clear the interrupt flag

ADCSRA |= (1 << ADIF);

return (ADC);

} void spi_init(void){

// Slave select (PB0), MOSI (PB2) and SCK (PB1) as output

DDRB |= (1<<PINB0) | (1<<PINB2) | (1<<PINB1);

//Slave select high (inactive)

PORTB |= (1<<PINB0);

// Master mode, enable SPI module.

// Clock polarity and phase is kept at default (Sample on rising edge)

SPCR = (1<<SPE) | (1<<MSTR);

} void spi_send(uint8_t data){

// Slave select low

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

154

PORTB &= ~(1<<PINB0);

// Write data to shift register

SPDR = data;

// Wait for the transmission to complete

while (0x00 == (SPSR & (1<<SPIF)));

// Slave select high

PORTB |= (1<<PINB0);

} int main(void){

adc_init();

spi_init();

while (1){

adc_value = adc_sample();

// Send the ADC value over SPI to the host

// Only the 8 lower bits contain useful data

spi_send(adc_value & 0xFF);

}

}

The code samples the ADC continuously and sends the data over the SPI interface to the EDBG

(Embedded Debugger) on the ATmega256RFR2 Xplained Pro board. The EDBG then sends the SPI data over DGI to the host computer. The ATmega256RFR2 ADC is 10 bit but only the lower 8 bits contain useful data in this example.

To do:  Build the project/solution (F7).

To do: 

• Open the project properties (right click the project in the Solution Explorer and select

Properties)

• On the Tool tab select the appropriate tool and interface

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

155

To do:  Program the application into the target and start the debugging by selecting Continue

(F5).

To do:  Open Atmel Data Visualizer as an extension inside Atmel Studio by selecting it in the

Tools menu.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

156

6.3.2. Adding String Markers

Then it is time to implement the mode switch. To see that the switch is actually working and switching at the right threshold the string marker feature of the Graph module is useful. By setting up the CDC

USART interface of the ATmega256RFR2 Xplained Pro to send a string each time the mode is switched.

These messages can then be shown in the graph as string markers. First extend the code as shown below.

#include <avr/io.h>

#include <avr/interrupt.h> const char* message_on = "NIGHT MODE ON"; const char* message_off = "NIGHT MODE OFF"; uint16_t adc_value = 0; uint8_t nightmode_threshold = 40; uint8_t nightmode_active = 0; void adc_init(void){

// Internal 1.5V reference, ADC0 as single ended input

ADMUX = (1 << REFS1);

// Enable the ADC,

ADCSRA |= (1<<ADEN);

// Check that the reference is OK

while (0x00 == (ADCSRB & (1 << REFOK)));

} uint16_t adc_sample(void){

// Trigger an ADC conversion

ADCSRA |= (1<<ADSC);

// Wait for conversion to finish

while (0x00 == (ADCSRA & (1 << ADIF)));

// Clear the interrupt flag

ADCSRA |= (1 << ADIF);

return (ADC);

} void spi_init(void){

// Slave select (PB0), MOSI (PB2) and SCK (PB1) as output

DDRB |= (1<<PINB0) | (1<<PINB2) | (1<<PINB1);

//Slave select high (inactive)

PORTB |= (1<<PINB0);

// Master mode, enable SPI module.

// Clock polarity and phase is kept at default (sample on rising edge)

SPCR = (1<<SPE) | (1<<MSTR);

} void spi_send(uint8_t data){

// Slave select low

PORTB &= ~(1<<PINB0);

// Write data to shift register

SPDR = data;

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

157

// Wait for the transmission to complete

while (0x00 == (SPSR & (1<<SPIF)));

// Slave select high

PORTB |= (1<<PINB0);

} void cdc_init(void){

// Baud rate 9600 based on 8 MHz CPU clock

UBRR1 = 51;

// Enable the transmitter and receiver, 8 bit character size,

// receive interrupts enabled

UCSR1B = (1<<RXEN1) | (1<<TXEN1) | (1<<RXCIE1);

} void cdc_send(const char data){

// Wait for transmitter to be ready for more data

while (0x00 == (UCSR1A & (1<<UDRE1)));

// Send the data

UDR1 = data;

} void send_message(const char* message){

while (*message)

cdc_send(*message++);

// String markers requires Null-termination

cdc_send(0);

} int main(void){

adc_init();

spi_init();

cdc_init();

while (1){

adc_value = adc_sample();

// Send the ADC value over SPI to the host

// Only the 8 lower bits contain useful data

spi_send(adc_value & 0xFF);

// higher adc value == less light

if (adc_value > nightmode_threshold){

if (0x00 == nightmode_active){

// Changing from night mode inactive to active

nightmode_active = 0x01;

send_message(message_on);

}

} else {

if (0x01 == nightmode_active){

// Changing from night mode active to inactive

nightmode_active = 0x00;

send_message(message_off);

}

}

}

}

To do: 

• Build the project, program and run the application by simply selecting Continue (F5) in the Debug menu of Atmel Studio.

6.3.3. Using Horizontal Cursor Code

So far the Graph module of the Data Visualizer has been used to show the data generated by the light sensor and to show when the night mode switch toggles between the two modes. The Graph module can also be used to interact with the target application while it is running. In this example the night mode threshold can be adjusted dynamically by using a horizontal cursor.

First the code must be extended to accept incoming data on the CDC USART. The output of the horizontal cursor is a 4 byte float value and will be sent over the CDC interface to the target application.

This float value will be used as the threshold for the night mode switch.

#include <avr/io.h>

#include <avr/interrupt.h> const char* message_on = "NIGHT MODE ON";

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

158

const char* message_off = "NIGHT MODE OFF"; union u_float{

float flt;

char data[4];

}; uint16_t adc_value = 0; uint8_t nightmode_threshold; uint8_t nightmode_active = 0; union u_float cdc_received_data; uint8_t cdc_read_index=0;

ISR (USART1_RX_vect){

// A byte is received on the CDC UART, MSB first

cdc_received_data.data[cdc_read_index] = UDR1 & 0xFF;

if (3 == cdc_read_index){

// A complete float value is received

nightmode_threshold = (uint8_t) cdc_received_data.flt;

cdc_read_index = 0;

}

else {

cdc_read_index++;

}

} void adc_init(void){

// Internal 1.5V reference, ADC0 as single ended input

ADMUX = (1 << REFS1);

// Enable the ADC,

ADCSRA |= (1<<ADEN);

// Check that the reference is OK

while (0x00 == (ADCSRB & (1 << REFOK)));

} uint16_t adc_sample(void){

// Trigger an ADC conversion

ADCSRA |= (1<<ADSC);

// Wait for conversion to finish

while (0x00 == (ADCSRA & (1 << ADIF)));

// Clear the interrupt flag

ADCSRA |= (1 << ADIF);

return (ADC);

} void spi_init(void){

// Slave select (PB0), MOSI (PB2) and SCK (PB1) as output

DDRB |= (1<<PINB0) | (1<<PINB2) | (1<<PINB1);

//Slave select high (inactive)

PORTB |= (1<<PINB0);

// Master mode, enable SPI module.

// Clock polarity and phase is kept at default (sample on rising edge)

SPCR = (1<<SPE) | (1<<MSTR);

} void spi_send(uint8_t data){

// Slave select low

PORTB &= ~(1<<PINB0);

// Write data to shift register

SPDR = data;

// Wait for the transmission to complete

while (0x00 == (SPSR & (1<<SPIF)));

// Slave select high

PORTB |= (1<<PINB0);

} void cdc_init(void){

// Baud rate 9600 based on 8 MHz CPU clock

UBRR1 = 51;

// Enable the transmitter and receiver, 8 bit character size,

// receive interrupts enabled

UCSR1B = (1<<RXEN1) | (1<<TXEN1) | (1<<RXCIE1);

} void cdc_send(const char data){

// Wait for transmitter to be ready for more data

while (0x00 == (UCSR1A & (1<<UDRE1)));

// Send the data

UDR1 = data;

} void send_message(const char* message){

while (*message)

cdc_send(*message++);

// String markers requires Null-termination

cdc_send(0);

} int main(void){

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

159

adc_init();

spi_init();

cdc_init();

// Interrupts on

sei();

while (1){

adc_value = adc_sample();

// Send the ADC value over SPI to the host

// Only the 8 lower bits contain useful data

spi_send(adc_value & 0xFF);

// higher adc value == less light

if (adc_value > nightmode_threshold){

if (0x00 == nightmode_active){

// Changing from nightmode inactive to active

nightmode_active = 0x01;

send_message(message_on);

}

} else {

if (0x01 == nightmode_active){

// Changing from nightmode active to inactive

nightmode_active = 0x00;

send_message(message_off);

}

}

}

}

To do: 

• Build the project, program and run the application by simply selecting Continue (F5) in the Debug menu of Atmel Studio.

6.4. Oscilloscope Example Code

To demonstrate how to use the Oscilloscope module a light sensor target application will be used. The light sensor example is a rather generic data source where an analog to digital converter is used to sample the sensor and the example applies to a wide range of other data sources.

The example requires the following equipment and software:

• Host computer with Atmel Studio 7 or later installed (Atmel Data Visualizer is included)

• Atmel ATmega256RFR2 Xplained Pro kit

• Atmel I/O1 Xplained Pro extension

To run the example the following hardware setup is required:

• I/O1 Xplained Pro extension connected to ATmega256RFR2 Xplained Pro EXT1 connector

• USB cable connected from host computer to ATmega256RFR2 Xplained Pro

A picture of the setup is shown below.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

160

To be able to view the light sensor data in the Oscilloscope module the ATmega256RFR2 target has to be programmed with code that samples the light sensor and sends the data to the Embedded Debugger

(EDBG) on the ATmega256RFR2 Xplained Pro over a serial interface. The EDBG then uses the Data

Gateway Interface (DGI) to send the data to the host computer.

First a new project for the target application code has to be set up in Atmel Studio.

To do: 

• Make a new project in Atmel Studio (FileNewProjectGCC C Executable

Project)

• Replace the content of the automatically generated main.c file with the code below

#include <avr/io.h>

#include <avr/interrupt.h> uint16_t adc_value = 0; volatile uint8_t send_data = 0; void adc_init(void){

// Internal 1.5V reference, ADC0 as single ended input

ADMUX = (1 << REFS1);

// Enable the ADC, auto triggered mode, interrupt on conversion finished

ADCSRA |= (1<<ADEN) | (1<<ADATE) | (1<<ADIE);

// Timer/Counter compare match A as trigger of ADC conversion

ADCSRB |= (1<<ADTS1) | (1<<ADTS0);

// Check that the reference is OK

while (0x00 == (ADCSRB & (1 << REFOK)));

} void spi_init(void){

// Slave select (PB0), MOSI (PB2) and SCK (PB1) as output

DDRB |= (1<<PINB0) | (1<<PINB2) | (1<<PINB1);

//Slave select high (inactive)

PORTB |= (1<<PINB0);

// 2X mode, 4MHz SPI clock when CPU clock is 8MHz

SPSR |= (1<<SPI2X);

// Master mode, enable SPI module.

// Clock polarity and phase is kept at default (Sample on rising edge)

SPCR = (1<<SPE) | (1<<MSTR);

} void spi_send(uint8_t data){

// Slave select low

PORTB &= ~(1<<PINB0);

// Write data to shift register

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

161

SPDR = data;

// Wait for the transmission to complete

while (0x00 == (SPSR & (1<<SPIF)));

// Slave select high

PORTB |= (1<<PINB0);

} void timer_init(){

// Set TOP value for timer (output compare A value)

OCR0A = 80;

// Clear timer on compare match mode

TCCR0A = (1<<WGM01);

// Timer clocked by CPU clock, no prescaler

TCCR0B = (1<<CS00);

}

ISR (ADC_vect){

// Store the light sensor sample

adc_value = (ADC);

// Clear timer interrupt flag to enable the next sample

TIFR0 |= (1<<OCF0A);

// Flag sending of data to host

send_data = 1;

} int main(void){

timer_init();

adc_init();

spi_init();

// Interrupts on

sei();

while (1){

if (1 == send_data){

send_data = 0;

// Send the ADC value over SPI to the host

// Only the 8 lower bits contain useful data

spi_send(adc_value & 0xFF);

}

}

}

The code configures the ADC to take a new sample every 10 th

μs giving a sample rate of 100kHz. This is achieved by using a timer that counts up to 80 before resetting. The code is based on the target CPU running on the internal 16MHz clock with a clock prescaler of 2 (default) and the CKDIV8 fuse not set.

The data samples are sent to the EDBG over the DGI SPI interface. The SPI interface is running at

4MHz. The ATmega256RFR2 ADC is 10 bit but only the lower 8 bits contain useful data in this example.

To do:  Build the project/solution (F7).

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

162

To do: 

• Open the project properties (right click the project in the Solution Explorer and select

Properties)

• On the Tool tab select the appropriate tool and interface

To do:  Program the application into the target and start the debugging by selecting Continue

(F5).

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

163

To do:  Open Atmel Data Visualizer as an extension inside Atmel Studio by selecting it in the

Tools menu.

6.5. Dashboard Example Code

To demonstrate how to use the Dashboard module an example with a night mode switch will be used. An

ATmega256RFR2 Xplained Pro with an I/O1 Xplained Pro extension is suitable as target hardware. The

I/O1 extension board features a light sensor that can be used to detect whether it is night or day. This information can be used for example to switch a lamp on when the surroundings turn dark.

The example requires the following equipment and software:

• Host computer with Atmel Studio 7 or later installed (Atmel Data Visualizer is included)

• Atmel ATmega256RFR2 Xplained Pro kit

• Atmel I/O1 Xplained Pro extension

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

164

To run the example the following hardware setup is required:

• I/O1 Xplained Pro extension connected to ATmega256RFR2 Xplained Pro EXT1 connector

• USB cable connected from host computer to ATmega256RFR2 Xplained Pro

A picture of the setup is shown below.

The ATmega256RFR2 target on the Xplained Pro must be programmed with code that implements the night mode switch.

To do: 

• Make a new project in Atmel Studio (FileNewProjectGCC C Executable

Project)

• Replace the content of the automatically generated main.c file with the code below

#include <avr/io.h>

#include <avr/interrupt.h> union u_double{

double dbl;

char data[8];

}; uint16_t adc_value = 0; uint8_t nightmode_threshold; uint8_t nightmode_active = 0; union u_double cdc_received_data; uint8_t cdc_read_index=0;

ISR (USART1_RX_vect){

// A byte is received on the CDC UART, MSB first

cdc_received_data.data[cdc_read_index] = UDR1 & 0xFF;

if (7 == cdc_read_index){

// A complete double value is received

nightmode_threshold = (uint8_t) cdc_received_data.dbl;

cdc_read_index = 0;

}

else {

cdc_read_index++;

}

} void adc_init(void){

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

165

// Internal 1.5V reference, ADC0 as single ended input

ADMUX = (1 << REFS1);

// Enable the ADC,

ADCSRA |= (1<<ADEN);

// Check that the reference is OK

while (0x00 == (ADCSRB & (1 << REFOK)));

} uint16_t adc_sample(void){

// Trigger an ADC conversion

ADCSRA |= (1<<ADSC);

// Wait for conversion to finish

while (0x00 == (ADCSRA & (1 << ADIF)));

// Clear the interrupt flag

ADCSRA |= (1 << ADIF);

return (ADC);

} void spi_init(void){

// Slave select (PB0), MOSI (PB2) and SCK (PB1) as output

DDRB |= (1<<PINB0) | (1<<PINB2) | (1<<PINB1);

//Slave select high (inactive)

PORTB |= (1<<PINB0);

// Master mode, enable SPI module. Clock polarity and phase is kept at default (Rising edge is leading edge and sample on leading edge)

SPCR = (1<<SPE) | (1<<MSTR);

} void spi_send(uint8_t data){

// Slave select low

PORTB &= ~(1<<PINB0);

// Write data to shift register

SPDR = data;

// Wait for the transmission to complete

while (0x00 == (SPSR & (1<<SPIF)));

// Slave select high

PORTB |= (1<<PINB0);

} void cdc_init(void){

// Baud rate 9600 based on 8 MHz CPU clock

UBRR1 = 51;

// Enable the transmitter and receiver, 8 bit character size, receive interrupts enabled

UCSR1B = (1<<RXEN1) | (1<<TXEN1) | (1<<RXCIE1);

} void cdc_send(const char data){

// Wait for transmitter to be ready for more data

while (0x00 == (UCSR1A & (1<<UDRE1)));

// Send the data

UDR1 = data;

} int main(void){

adc_init();

spi_init();

cdc_init();

// Interrupts on

sei();

while (1){

adc_value = adc_sample();

// Send the ADC value over SPI to the host

// Only the 8 lower bits contain useful data

spi_send(adc_value & 0xFF);

// higher adc value == less light

if (adc_value > nightmode_threshold){

if (0x00 == nightmode_active){

// Changing from nightmode inactive to active

nightmode_active = 0x01;

}

} else {

if (0x01 == nightmode_active){

// Changing from nightmode active to inactive

nightmode_active = 0x00;

}

}

cdc_send(nightmode_active);

}

}

The code samples the ADC continuously and sends the data over the SPI interface to the EDBG

(Embedded Debugger) on the ATmega256RFR2 Xplained Pro board. The EDBG then sends the SPI data

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

166

over DGI to the host computer. The ATmega256RFR2 ADC is 10 bit but only the lower 8 bits contain useful data in this example.

In addition the code sets up the CDC USART and sends the state of the night mode switch as a single byte. The received data on the CDC USART is parsed as a double value and is used as threshold for the night mode switch.

To do:  Build the project/solution (F7).

To do: 

• Open the project properties (right click the project in the Solution Explorer and select

Properties)

• On the Tool tab select the appropriate tool and interface

To do:  Program the application into the target and start the debugging by selecting Continue

(F5).

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

167

To do:  Open Atmel Data Visualizer as an extension inside Atmel Studio by selecting it in the

Tools menu.

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

168

7. Document Revision History

Document revision

42730A

Date

05/2016

Comment

Initial document release

[DRAFT]

Atmel Data Visualizer [USER GUIDE]

Atmel-B-Data-Visualizer_User Guide-09/2016

169

Atmel Corporation

1600 Technology Drive, San Jose, CA 95110 USA T: (+1)(408) 441.0311

F: (+1)(408) 436.4200

| www.atmel.com

©

2016 Atmel Corporation. / Rev.: Atmel-B-Data-Visualizer_User Guide-09/2016

Atmel

®

, Atmel logo and combinations thereof, Enabling Unlimited Possibilities

® other countries. Windows

®

, and others are registered trademarks or trademarks of Atmel Corporation in U.S. and

is a registered trademark of Microsoft Corporation in U.S. and or other countries. ARM

®

, ARM Connected

®

logo, Cortex

®

, and others are the registered trademarks or trademarks of ARM Ltd. Other terms and product names may be trademarks of others.

DISCLAIMER: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to any intellectual property right is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN THE ATMEL TERMS AND

CONDITIONS OF SALES LOCATED ON THE ATMEL WEBSITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED

OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY,

FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,

CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS AND PROFITS, BUSINESS

INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL HAS BEEN ADVISED

OF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no representations or warranties with respect to the accuracy or completeness of the contents of this document and reserves the right to make changes to specifications and products descriptions at any time without notice. Atmel does not make any commitment to update the information contained herein. Unless specifically provided otherwise, Atmel products are not suitable for, and shall not be used in, automotive applications. Atmel products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life.

SAFETY-CRITICAL, MILITARY, AND AUTOMOTIVE APPLICATIONS DISCLAIMER: Atmel products are not designed for and will not be used in connection with any applications where the failure of such products would reasonably be expected to result in significant personal injury or death (“Safety-Critical Applications”) without an Atmel officer's specific written consent. Safety-Critical Applications include, without limitation, life support devices and systems, equipment or systems for the operation of nuclear facilities and weapons systems. Atmel products are not designed nor intended for use in military or aerospace applications or environments unless specifically designated by Atmel as military-grade. Atmel products are not designed nor intended for use in automotive applications unless specifically designated by Atmel as automotive-grade.

[DRAFT]

Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project