Skip to content

Commit

Permalink
deploy: be77a24
Browse files Browse the repository at this point in the history
  • Loading branch information
ribdp committed Apr 2, 2024
1 parent f63922b commit 811547f
Show file tree
Hide file tree
Showing 50 changed files with 18,384 additions and 0 deletions.
Binary file added doctrees/common/data_streaming.doctree
Binary file not shown.
Binary file added doctrees/common/examples.doctree
Binary file not shown.
Binary file added doctrees/common/installation.doctree
Binary file not shown.
Binary file added doctrees/common/limitations.doctree
Binary file not shown.
Binary file added doctrees/common/support.doctree
Binary file not shown.
Binary file added doctrees/environment.pickle
Binary file not shown.
Binary file added doctrees/index.doctree
Binary file not shown.
Binary file added doctrees/reference_api/index.doctree
Binary file not shown.
4 changes: 4 additions & 0 deletions html/.buildinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: a51ffaadf356a98bc4fe3c64387cfaa1
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file added html/_images/PCXEvalStack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added html/_images/pctlbxLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
91 changes: 91 additions & 0 deletions html/_sources/common/data_streaming.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
Data Streaming
--------------

Remote data streaming to and from hardware is made available through `system object interfaces <https://www.mathworks.com/help/matlab/matlab_prog/what-are-system-objects.html>`_ , which are unique for each component or platform. The hardware interfacing system objects provide a since class to both configure a given platform and move data back and forth from the device.

Command and control of hardware from MATLAB is accomplished by leveraging the `IIO drivers <https://wiki.analog.com/software/linux/docs/iio/iio>`_ built into the target platform's kernel and `libiio <https://wiki.analog.com/resources/tools-software/linux-software/libiio>`_ which provides remote backends to control drivers across different backends. Backends can be Ethernet/IP/USB based. Below is a diagram of the different components in the stack for a setup targeting the evaluation of the AD7380, but the setup will be nearly similar for other ADCs as well.

.. image:: images/PCXEvalStack.png
:width: 600

Since libiio is cross-platform it can be used from Windows, Linux, or macOS based systems. It is also a lower level library independent of MATLAB, so when moving toward production or untethered systems similar APIs that are used in MATLAB can be used in C, C++, Python, or other languages.

============================
Connecting and Configuration
============================

Connecting to hardware is done by setting the **uri** property of the system object interface. The **uri** for libiio always has the convention "*< backend >:< address >*", where *backend* can be ethernet, ip or usb. *address* will be specific to the backend. This is documented in the `libiio API <https://analogdevicesinc.github.io/libiio/master/libiio/group__Context.html#gafdcee40508700fa395370b6c636e16fe>`_ .

Below is a basic example of setting up a generic ADC using an Ethernet/IP backend:

.. code-block:: MATLAB
rx = adi.ADxxxx.Rx;
rx.uri = 'ip:analog.local';
data = rx();
With the code above, the hardware is not contacted until the operator or step method is called on line 3. Therefore, any properties that are set or defined before line 3 are not applied or updated on the hardware until after line 3. However, after line 3 has completed the object will become locked and certain configuration changes cannot be applied after this point. These will primarily sample rates and buffer sizes.

The state of the object follows the flow of the diagram below triggered by line 3 above.

Once the object becomes locked it must be released if the sample rate or buffers need to be modified. This will disconnect from the hardware:

.. code-block:: MATLAB
rx.release(); % Release object
To provide a complete example we can do more advanced configuration like so to demonstrate property changes:

.. code-block:: MATLAB
rx = adi.ADxxxx.Rx;
rx.uri = 'ip:analog.local';
rx.SamplesPerFrame = 1024;
rx.SampleRate = 256000;
data1 = rx();
% Update tunable property
rx.SampleRate = 128000;
data2 = rx();
% Update non-tunable property
rx.release();
rx.SamplesPerFrame = 4096;
dataLargerBuffer = rx();
==============
Receiving Data
==============

To receive or capture data from a given device first you must instantiate that device's interface class. For a generic ADC, this would be as follows:

.. code-block:: MATLAB
rx = adi.ADxxxx.Rx;
Once instantiated you can configure the number of samples to be captured by setting the property **SamplesPerFrame.**

.. code-block:: MATLAB
rx.SamplesPerFrame = 1e6;
**SamplesPerFrame** is the number of samples per channel which will be captured. If your device produces complex data (I and Q) this is the number of complex samples. There will be a limit to the maximum samples which can be collected. By default this is set to 2^20, but it may be possible to make it larger depending on hardware. Once the operator methods are used for a give instantiation, the object will become locked and the **SamplesPerFrame** property cannot be changed. This is known as a non-tunable property.

To actually collect the samples or perform the capture, the operator of the system object should be used or the **step** method as so:

.. code-block:: MATLAB
data = rx(); % Operator method
data = rx.step(); % Step method
Both method calls are equivalent, and the produced matrix **data** will be of size [SamplesPerFrame x length(EnabledChannels)]. **EnabledChannels** determines the channels which data will be collected from. **EnabledChannels** is a [1xN] vector with indexes starting at 1 of the desired channels.

===========================
Continuous Data Acquisition
===========================

If you are capturing multiple frames or buffers of data, then there might arise situations where discontinuities appear in the samples, when plotted.

Some detail and tips are discussed in this wiki page on `IIO System Considerations, Tips and Tricks <https://wiki.analog.com/resources/tools-software/linux-software/libiio_tips_tricks>`_

The IIO buffer size is governed by the SamplesPerFrame property of the System Object classes. The kernelBuffersCount is also a property defined for the classes, and can be modified.
12 changes: 12 additions & 0 deletions html/_sources/common/examples.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Examples
--------

Examples for streaming data are listed within the Toolbox documentation itself. To view run the following with MATLAB:

.. code-block:: MATLAB
doc adi
They can also be viewed on GitHub:

- `Streaming examples <https://github.com/analogdevicesinc/PrecisionToolbox/tree/master/examples>`_
45 changes: 45 additions & 0 deletions html/_sources/common/installation.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Installation
------------

============
Dependencies
============

The toolbox has different dependencies based on the features required. The base dependencies for streaming data are listed below.

The base dependencies for the toolbox requires libiio and the libiio MATLAB bindings. There are three options for this install with different required MathWorks Toolboxes:

- `Communications Toolbox Support Package for Xilinx Zynq-Based Radio <https://www.mathworks.com/help/supportpkg/xilinxzynqbasedradio/index.html>`_
- Communications Toolbox
- Signal Processing Toolbox :sup:`TM`
- DSP System Toolbox :sup:`TM`
- `Communications Toolbox Support Package for Analog Devices ADALM-Pluto Radio <https://www.mathworks.com/help/supportpkg/plutoradio/index.html>`_
- Communications Toolbox
- Signal Processing Toolbox :sup:`TM`
- DSP System Toolbox :sup:`TM`
- `libiio MATLAB Binding Standalone Installer (R2021b+) <https://github.com/mathworks/buildroot/releases/download/mathworks_zynq_R21.2.0/libiio.mlpkginstall>`_
- Signal Processing Toolbox :sup:`TM`


=========================
Precision Toolbox Install
=========================

The Precision Toolbox itself can be installed either from:

- `MATLAB's Add-On Explorer <https://www.mathworks.com/products/matlab/add-on-explorer.html>`_
- `GitHub Releases page <https://github.com/analogdevicesinc/PrecisionToolbox/releases>`_

.. warning::
Before installing Precision Toolbox check the `Release Page <https://github.com/analogdevicesinc/PrecisionToolbox/releases>`_ to check for the latest supported version of MATLAB. The latest version is the one which is available in `Add-on Explorer <https://www.mathworks.com/products/matlab/add-on-explorer.html>`_ , since Add-On Explorer does not currently support hosting multiple versions. If you have an older release of MATLAB, download the MLTBX installer from matching release on the `Release Page <https://github.com/analogdevicesinc/PrecisionToolbox/releases>`_ .

===========================
Add-On Explorer Walkthrough
===========================

To install the toolbox from within MATLAB using the Add-On Explorer:

- Launch the Add-Ons Explorer from MATLAB's Home tab
- Search for 'Precision Toolbox'
- Select Precision Toolbox from Analog Devices, Inc. from the results:
- Install the toolbox
27 changes: 27 additions & 0 deletions html/_sources/common/limitations.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Limitations
-----------

Known Limitations, Bugs and Quirks
==================================

Some limitations and bugs are known to be present in the support for the ADCs relevant to the Precision Toolbox. They have been summarized below.

**Libiio backend**

Currently only ethernet/IP backends are supported for all the parts in the toolbox. For AD4030-24, AD4630-16 and AD4630-24 the usb backend can also be used. Serial backends are not supported.

**AD7380**

Trigger setup needs to be done before running any of the toolbox scripts that interact with the AD7380. Refer to the `Trigger Management section on the AD738x Linux IIO driver wiki page <https://wiki.analog.com/resources/tools-software/linux-drivers/iio-adc/ad738x#trigger_management>`_

**AD7768**

The Linux IIO driver for the AD7768 returns data for all the channels whenever a data capture is requested. So, in order to get sensible outputs, ensure that the EnabledChannels array consists of indices for all the channels.

**AD4030-24. AD4630-16, AD4630-24**

The Linux IIO driver for the three parts (there's a common Linux driver that addresses all three parts) returns data for all the channels whenever a data capture is requested. In order to have sensible outputs, ensure that the EnabledChannels array consists of indices for all the channels.

Another known issue here has to do with the case where the ADC sends out common mode voltage data along with the differential voltage data. The EnabledChannel property values that consist of more than two indices (even when there are 4 IIO channels), are not 'valid'. Of the possible groupings with two channel indices, the ones that correspond to {differential0, common_voltage0} and {differential1, common_voltage1} are also not 'valid'

It is possible to get data (common-mode and differential) for all the ADC channels, by using a 'valid' channel grouping, setting the BufferTypeConversionEnable property to 'false' in the Base class for the AD463x family, and adding custom parsing logic to extract the data for all IIO channels, from the 32-bit raw words you get from the data capture.
9 changes: 9 additions & 0 deletions html/_sources/common/support.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Support
-------

Support is provided online through the EngineerZone forums. If you have questions related to the hardware itself outside of this BSP, contact your local FAE or ask on the forums.

Question regarding specific aspect of the BSP should be asked in the following places:

- `Software Interface Tools <https://ez.analog.com/sw-interface-tools/f/q-a)>`_ for questions on the BSP itself
- `Linux Software Drivers <https://ez.analog.com/linux-software-drivers/f/q-a)>`_ for libiio and iio driver questions
55 changes: 55 additions & 0 deletions html/_sources/index.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
.. pctlbx-docs documentation master file, created by
sphinx-quickstart on Mon Apr 1 11:50:10 2024.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Precision Toolbox for MATLAB
============================

.. image:: /pctlbxLogo.png
:width: 600

ADI maintains a set of tools to interface with ADI precision converters within MATLAB and Simulink. These are combined into a single toolbox. Currently, the toolbox supports only configuration and data streaming.

.. toctree::
:maxdepth: 1
:caption: Contents:

/common/installation.rst
/common/data_streaming.rst
/common/examples.rst
/common/limitations.rst
/common/support.rst
/reference_api/index.rst

The following have device-specific implementations in MATLAB and Simulink. In general, if a device has an IIO driver, MATLAB support is possible, but a device-specific MATLAB or Simulink interface may not exist yet.

.. csv-table:: Supported Parts
:header: "Evaluation Card", "FPGA Board", "Streaming Support", "Targeting", "Variants and Minimum Supported Release"
:widths: 30, 30, 30, 30, 30

"AD7380", "Zedboard", "Yes", "No", "ADI (2021b)"
"AD7768", "Zedboard", "Yes", "No", "ADI (2021b)"
"AD7768-1", "Zedboard", "Yes", "No", "ADI (2021b)"
"AD4030-24", "Zedboard", "Yes", "No", "ADI (2021b)"
"AD4630-16", "Zedboard", "Yes", "No", "ADI (2021b)"
"AD4630-24", "Zedboard", "Yes", "No", "ADI (2021b)"
"AD4858", "Zedboard", "Yes", "No", "ADI (2021b)"
"AD2S1210", "Zedboard", "Yes", "No", "ADI (2021b)"
"AD4000", "Zedboard", "Yes", "No", "ADI (2021b)"
"AD4001", "Zedboard", "Yes", "No", "ADI (2021b)"
"AD4002", "Zedboard", "Yes", "No", "ADI (2021b)"
"AD4003", "Zedboard", "Yes", "No", "ADI (2021b)"
"AD4004", "Zedboard", "Yes", "No", "ADI (2021b)"
"AD4005", "Zedboard", "Yes", "No", "ADI (2021b)"
"AD4006", "Zedboard", "Yes", "No", "ADI (2021b)"
"AD4007", "Zedboard", "Yes", "No", "ADI (2021b)"
"AD4008", "Zedboard", "Yes", "No", "ADI (2021b)"
"AD4010", "Zedboard", "Yes", "No", "ADI (2021b)"
"AD4011", "Zedboard", "Yes", "No", "ADI (2021b)"
"AD4020", "Zedboard", "Yes", "No", "ADI (2021b)"
"AD4021", "Zedboard", "Yes", "No", "ADI (2021b)"
"AD4022", "Zedboard", "Yes", "No", "ADI (2021b)"
"AD7124-4", "Zedboard", "Yes", "No", "ADI (2021b)"
"AD7124-8", "Zedboard", "Yes", "No", "ADI (2021b)"

7 changes: 7 additions & 0 deletions html/_sources/reference_api/index.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Reference APIs
--------------

.. toctree::
:maxdepth: 1
:caption: Driver Classes:

134 changes: 134 additions & 0 deletions html/_static/_sphinx_javascript_frameworks_compat.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
/*
* _sphinx_javascript_frameworks_compat.js
* ~~~~~~~~~~
*
* Compatability shim for jQuery and underscores.js.
*
* WILL BE REMOVED IN Sphinx 6.0
* xref RemovedInSphinx60Warning
*
*/

/**
* select a different prefix for underscore
*/
$u = _.noConflict();


/**
* small helper function to urldecode strings
*
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent#Decoding_query_parameters_from_a_URL
*/
jQuery.urldecode = function(x) {
if (!x) {
return x
}
return decodeURIComponent(x.replace(/\+/g, ' '));
};

/**
* small helper function to urlencode strings
*/
jQuery.urlencode = encodeURIComponent;

/**
* This function returns the parsed url parameters of the
* current request. Multiple values per key are supported,
* it will always return arrays of strings for the value parts.
*/
jQuery.getQueryParameters = function(s) {
if (typeof s === 'undefined')
s = document.location.search;
var parts = s.substr(s.indexOf('?') + 1).split('&');
var result = {};
for (var i = 0; i < parts.length; i++) {
var tmp = parts[i].split('=', 2);
var key = jQuery.urldecode(tmp[0]);
var value = jQuery.urldecode(tmp[1]);
if (key in result)
result[key].push(value);
else
result[key] = [value];
}
return result;
};

/**
* highlight a given string on a jquery object by wrapping it in
* span elements with the given class name.
*/
jQuery.fn.highlightText = function(text, className) {
function highlight(node, addItems) {
if (node.nodeType === 3) {
var val = node.nodeValue;
var pos = val.toLowerCase().indexOf(text);
if (pos >= 0 &&
!jQuery(node.parentNode).hasClass(className) &&
!jQuery(node.parentNode).hasClass("nohighlight")) {
var span;
var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg");
if (isInSVG) {
span = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
} else {
span = document.createElement("span");
span.className = className;
}
span.appendChild(document.createTextNode(val.substr(pos, text.length)));
node.parentNode.insertBefore(span, node.parentNode.insertBefore(
document.createTextNode(val.substr(pos + text.length)),
node.nextSibling));
node.nodeValue = val.substr(0, pos);
if (isInSVG) {
var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
var bbox = node.parentElement.getBBox();
rect.x.baseVal.value = bbox.x;
rect.y.baseVal.value = bbox.y;
rect.width.baseVal.value = bbox.width;
rect.height.baseVal.value = bbox.height;
rect.setAttribute('class', className);
addItems.push({
"parent": node.parentNode,
"target": rect});
}
}
}
else if (!jQuery(node).is("button, select, textarea")) {
jQuery.each(node.childNodes, function() {
highlight(this, addItems);
});
}
}
var addItems = [];
var result = this.each(function() {
highlight(this, addItems);
});
for (var i = 0; i < addItems.length; ++i) {
jQuery(addItems[i].parent).before(addItems[i].target);
}
return result;
};

/*
* backward compatibility for jQuery.browser
* This will be supported until firefox bug is fixed.
*/
if (!jQuery.browser) {
jQuery.uaMatch = function(ua) {
ua = ua.toLowerCase();

var match = /(chrome)[ \/]([\w.]+)/.exec(ua) ||
/(webkit)[ \/]([\w.]+)/.exec(ua) ||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
/(msie) ([\w.]+)/.exec(ua) ||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
[];

return {
browser: match[ 1 ] || "",
version: match[ 2 ] || "0"
};
};
jQuery.browser = {};
jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true;
}
Binary file added html/_static/adi_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added html/_static/background_b01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 811547f

Please sign in to comment.