This is an old revision of the document!
This page gives an overview of using the ARM platforms supported (default is Mbed) firmware example with Analog Devices AD4130 Evaluation board and SDP-K1 controller board. This example code leverages the ADI developed IIO (Industrial Input Output) ecosystem to evaluate the AD4130 device by providing a device debug and data capture support.
IIO oscilloscope is used as client application running on Windows-os, which is ADI developed GUI for ADC data visualization and device debug. The interface used for communicating client application with firmware application (IIO device) is UART (Note: SDP-K1 can also support high speed VirtualCOM port @1Mbps or higher speed for faster data transmission). The firmware application communicates with IIO device using ADI No-OS drivers and platform drivers low level software layers. SDP-K1 is used as controller board, on which IIO firmware application runs and using above software libraries, the IIO firmware communicates with IIO device.
AD4130 uses SPI communication for device register access and data capture.
For data transmission to IIO client, VirtualCOM Or UART serial communication is used. SDP-K1 by default uses the VCOM serial interface for higher speed data transmission.
SDP-K1 is powered through USB connections from the computer. SDP-K1 acts as a Serial device when connected to PC, which creates a COM Port to connect to IIO Oscilloscope GUI running on windows-os. The COM port assigned to a device can be seen through the device manager for windows-based OS.
SDP-K1 can support high speed VirtualCOM port USB interface, so by default VCOM is configured as default interface in the firmware. The interface can be set to UART by defining macro “USE_PHY_COM_PORT” in the app_config.h file.
*Note: Actual COM port number for your device may not be the same as shown above. Therefore, always check your SDP-K1 serial COM port number before connecting to IIO client.
This section briefs on the usage of MBED firmware. This also explains the steps to compile and build the application using mbed and make based build.
Source code is hosted here:
Build Guide for Precision Converters MBED firmware (Use below link):
This library provides an abstracted library interface to communicate IIO device and IIO client application (IIO Oscilloscope) without worrying about the low level hardware details. Download and install below Libiio windows installer in your computer.
Libiio installer for Windows (Use below link):
This is a GUI (Graphical User Interface) based IIO client application for data visualization and device configuration/debugging. The data from IIO devices (ADCs/DACs) is transmitted over Serial/Ethernet/USB link to IIO Oscilloscope client through the abstracted layer of “libiio”. Download and install below IIO Oscilloscope windows installer in your computer.
IIO Oscilloscope installer for Windows (Use below link):
Open the IIO Oscilloscope application from start menu and configure the serial (UART) settings as shown below. Click on refresh button and AD4130 device should pop-up in IIO devices list.
Click 'Connect' and it should by default open the data ‘Capture’ window. You can drag aside or close this window to see the main ‘Debug and DMM’ tab window.
The IIO Oscilloscope allows user to access and configure different device parameters, called as 'Device Attributes“. There are 2 types of attributes:
How to read and write attribute:
DMM tab can be used read the instantaneous voltage applied on analog input channels. Simply select the device and channels to read and press start button.
*Note: The voltage is just instantaneous, so it is not possible to get RMS AC voltage or averaged DC voltage. Also, when using DMM tab, do not access/use the Data Capture or Debug tab as this could impact data capturing. Both DMM scan and data capture uses different methods of conversion. The DMM data is read using single conversion, while data capture uses continuous conversion mode of operation.
To capture the data from AD4130 IIO device, simply select the device and channels to read/capture data. The data is plotted as “ADC Raw Value” Vs “Number of Samples” and is just used for Visualization. The data is read as is from device without any processing. If user wants to process the data, it must be done externally by capturing data from the Serial link on controller board.
*Note: The DMM or Debug tab should not be accessed when capturing data as this would impact data capturing. Both DMM scan and data capture uses different methods of conversion. The DMM data is read using single conversion, while data capture uses continuous conversion mode of operation.
More info here: Data Capture using IIO App
Data capturing utilizes two modes:
*Note: Due to low sampling rate (50SPS) for temperature sensor measurement, select 50 or less samples during data capturing for sensor demo mode channels.
*Note: Max 4096 samples can be selected for plotting frequency domain response due to limited buffer size in the firmware.
AD4130 IIO firmware provides support for interfacing different sensors to analog inputs and perform the measurement on them. Below sensor demo modes are supported in the firmware.
*Note: The selection of default sensor types can be changed from ‘ad4130_temperature_sensor.cpp’ file to large extent and from respective user config header files to some extent.
The sensor mode selection is done from “app_config.h” file using “ACTIVE_DEMO_MODE_CONFIG” macro. The selection is done at compilation time, that means only one sensor demo mode is active at a time. Whenever demo mode is changed from app_config.h file, the code must be compiled again to generate a new binary file for that.
Firmware maintains the unique user configuration file for each sensor demo mode as per below table. The configurations can be updated by using .c and .h user config files.
Sensor measurement for RTD, Thermistor, Thermocouple, Noise Test, ECG, Power Test and User Default Config can be done using the IIO oscilloscope GUI client application or by executing python scripts from the ‘scripts’ folder. Temperature result for RTD, TC and Thermistor would be in degree Celsius. The result for other configs would in voltage/current.
Sensor measurement for Load Cell can be done by executing the python script available in the project “scripts” folder. IIO oscilloscope can only support measurement for voltage, current and temperature quantities and threfore python code is developed to support measurement for other sensor types.
The python script can be executed from ‘Visual Studio Code’ or any other preferred IDE/console prompt application using “python script_name.py” command as shown below. The demo config is fetched from the firmware by establishing serial (UART/VCOM) connection between host and MCU (sdp-k1). Refer next section to install necessary python tools and updating/executing the python scripts.
It is possible to calibrate the device channels which are connected to external sensors. The sensors calibration (gain and offset) is done by executing the python script “ad4130_calibration.py”.
Data capture, sensor measurement, device calibration, etc. can be achieved with python based IIO clients, using 'pyadi-iio' library. A possible option using ADI's pyadi-iio library in python has been demonstrated in the forthcoming sections. The python scripts are provided along with firmware package.
*Make sure to install additional support packages by running requirements.txt file using command “python -m pip install -r requirements.txt from “scripts/” directory”
While executing the adxxxx_data_capture.py, the command prompt requests for the number of samples to be entered by the user.
On Entering the number of samples n, on successful completion of capturing n samples, the data points are stored in a csv as adc_data_capture.csv in the folder where the script is present.
This file defines the user configurations for the AD4130, such as SPI parameters (frequency, mode, etc) and other init parameters used by No-OS drivers to initialize AD4130 device (e.g. required GPIOs, software/hardware mode, etc). These are the parameters loaded into device when device is powered-up or power-cycled.
This file implements the data capturing logic for the AD4130 device. The data capturing can be done using normal ‘Sequencer’ Or using internal ‘FIFO’. Enable the macro ‘FIFO_ENABLED’ for enabling FIFO mode.
This file defines getter/setter functions for all the device and channel specific attributes (related to AD4130 devices) to read/write the device parameters. The majority of device specific functionality is present in this module.
The no-os drivers provide the high level abstracted layer for digital interface of AD4130 devices. The complete digital interface (to access memory map and perform data read) is done in integration with platform drivers. The functionality related with no-os drivers is covered in below 2 files: