Data Visualizer – displaying data from a microcontroller

After reading several stories about how programmers transfer data from microcontrollers to PCs in order to conveniently display them on a large screen (SCADA, LabView), it occurred to me to tell about another way to do this. The method is not new, but it seems not very well known. The method is to use the Atmel Data Visualizer program or its successor – MPLAB Data Visualizer.

The material was intended as a post, and not as a manual, but there were too many beeches.

The Data Visualizer program provides ample opportunities for displaying data transmitted over serial interfaces.
You can build a graph based on them in real time, with all sorts of markers and cursors, there is an oscilloscope mode, and most importantly – a Dashboard, where you can place various digital and graphic indicators with the mouse, buttons – a kind of micro-SCADA
From the name we can conclude that this program is designed to work with Microchip controllers (Atmel, PIC), but this is not entirely true.

I will voice the main points:

  1. Data Visualizer is presented as a separately downloadable and installed program. Those. You don’t even need to download and install full IDEs from Microchip to use it. However, if they are already installed, then this thing is already available as a plugin.

  1. Data Visualizer is designed not only for hardware from Microchip. It can receive data via a serial port (USB-UART and all kinds of virtual ones, including) Branded debuggers provide even more opportunities for monitoring hardware interfaces – they have UART, I2C, SPI, GPIO, as well as current and voltage sensors (we measure consumption in dynamics), and, in general, from any device. You can even do without an oscilloscope and logic analyzer. But these debuggers also cost a significant amount of money.

The initial setup is carried out visually: component connections are shown as pin connectors that can be dragged with the mouse.
But to parse data packets, you need configs that are written in a text editor.
There is documentation for all this, but there are some opaque points that are worth uncovering.

Documentation online 1
Documentation online 2
Documentation PDF 1
Documentation PDF 2

Atmel Data Visualizer allows you to receive and visualize data that is transmitted via one of two protocols: Data Stream Protocol (simpler, but requires configuration) and Atmel Data Protocol (sophisticated). That is, variables and register values ​​inside the microcontroller must be transmitted as a sequence of bytes of a given format. The formats are well documented.

For everything to work, in the simplest case, you need to:

  1. Select the component – data source (Serial port, from the list), set the exchange rate (Open Terminal should be disabled if we do not want to see the raw data stream)

  2. Add and connect the parser component of the desired Data Streamer protocol and, on the Data Stream Control Panel that appears, specify the .ds text file in which the configuration of the transmitted data is written (according to the description).

Example file:

This means that the program will wait on the port for the following sequence of data:
{(Unsigned byte) start_token} {(Unsigned short) ADC0}{(Unsigned short) ADC1}{(Unsigned short) ADC2}{(Unsigned byte) Prescaler}{(Unsigned byte) инвертированный start_token}
start_token – it looks like any byte you like.
The parser will read this file and display all kinds of data that it expects in the transmitted data stream. In this example: ADC0, ADC1, ADC2, Prescaler (If the parser is not connected, the entire data stream will be perceived as a stream of a single byte parameter, without headers).

  1. The parsed data can be directed with the mouse to visualization: Graph, Osciloscope, Dashboard. Settings (presets) of indicators on the Dashboard and their connections with data streams are stored in .db and .sc configuration text files

To avoid having to configure all this every time, there is automatic configuration.
The controller must periodically transmit a data packet in a special format, like:
uint8_t config_id_packet[] = {
/* Token / 0x5F, / Specify checksum LRC8 / 0xB4, 0x00, 0x86, 0x4A, / Configuration ID / 0xC0, 0xFF, 0xEE, 0xC0, 0xFF, 0xEE, 0xC0, 0xFF, 0xEE, 0xC0, 0xFF, 0xEE, / The actual checksum / 0x78, / Inverse of Token */

Here is a different token, a checksum using the LRC8 algorithm and a configuration identifier: 0xC0FFEEC0FFEEC0FFEEC0FFEE
When you run the automatic configuration, Data Visualizer will filter this package into the data stream, and upon receiving it, it will automatically load the configuration from the files, C0FFEEC0FFEEC0FFEEC0FFEE.db And C0FFEEC0FFEEC0FFEEC0FFEE.ds
It is not enough to transmit this package once: Data Visualizer automatically selects the exchange speed and simply will not see the configuration the first time. In the example from the developer, this packet is transmitted every 100 data packets.
This example is easy to adapt for Arduino.

If all this seemed inconvenient, then there is a much more complex Atmel Data Protocol (ADP). It already provides for two-way data exchange, and instructions for which indicator to transfer what value. An example implementation of this protocol is hidden deep in Atmel ASF, and it is easier to use it in the form plugin for Microchip Studio. In general, this protocol is more tied to Microchip/Atmel

In general, Atmel Data Visualizer is a relatively compact and, one might say, portable program. BUT there is a very big BUT – it does not retain its state at all. Maximum – you can load configurations using the auto-detect protocol.

MPLAB Data Visualizer does not have many of the shortcomings of its predecessor. The state of the windows is saved to a file. Configuration of the data package and dashboard is carried out visually – with the mouse. ADP, as such, is not supported at all, data is received in the form of a Data Stream (there is import from .ds), but now it is called Variables Stream. We added another, new DVRT protocol, which allows you to work with a set of real variables imported from the .elf file – this is real-time debugging. The interface has been made without dragging connections with the mouse, and is generally more beautiful. And the most interesting thing is that, despite the fact that MPLAB Data Visualizer is bulky and written in Java, and takes longer to load, it works somewhat faster in Atmel Data Visualizer, written in C#.

Thus, you can get, for example, excellent graphs of parameter changes inside a microprocessor controller without writing a single line of code for a PC.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *