Wiki

This version (30 Sep 2021 06:49) was approved by Pratyush Mallick.The Previously approved version (28 Sep 2021 07:01) is available.Diff

AD4696 Mbed IIO Application

Introduction

This page gives an overview of using the ARM Mbed platform supported firmware example with Analog Devices AD4696 Evaluation board(s) and SDP-K1 controller board. This example code leverage the ADI developed IIO (Industrial Input Output) ecosystem to evaluate the AD4696 family devices by providing a device debug and data capture support.

The overview of an entire system is shown below:

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 (AD4696) 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 AD4696 IIO device. The AD4696B Eval board is used for development and testing of this application.

This code has been developed and tested on SDP-K1 Controller Board using the on-board Arduino Headers. However, same code can be used without or with little modifications on any Mbed enabled board which has Arduino Header Support on it, such as STM32-Discovery, STM32-Nucleo, etc.

Hardware Connections

Power Connections:

  • Connect a 12V ( 1A max ) DC power supply to board through VPWR and GND4 pin.
  • Connect the VCC_HOST pin of the AD4696 to the 3.3V supply.
Note: Make sure to connect the 12V DC power supply to VPWR before supplying 3.3v to the VCC_HOST pin to adhere to the power-supply-sequence requirement

SDP-K1:

  • Connect the VIO_ADJUST jumper on the SDP-K1 board to 1.8V position to drive SDP-K1 GPIOs at 1.8V

EVAL-AD4696-FMCZ:

Arduino Connections:

Note: To achieve reliable high speed data transfer between the SDP-K1 and AD4696 Eval board, make sure to use good quality jumper wires with length not more than 10cm

The AD4696 device is configured in “Serial Software” mode in the firmware. AD4696 uses SPI communication for device register access and data capture.

SDP-K1 is powered through USB connection 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 also support high speed VirtualCOM port UART interface if “USE_VIRTUAL_COM_PORT” macro is defined in the firmware (in app_config.h file).


Theory of operation

The SDP-K1 generates PWM signals to manually trigger conversion on the AD4696. The digital pin and the sampling rate for PWM signal can be configured in the app_config_mbed.h file. By default it is generated at 62.5 KSPS on D6 Arduino pin. To achieve this, the CS of the SDP-K1 and CNV pins on the Eval board should be shorted/soldered either by switching JP31 onboard jumper position to A or by using external wires to connect the same. The D6 (CNV) Arduino pin on the MCU should should be left floating, as this pin is used only to trigger interrupt attached to the data capture callback function in the software. The rising edge on the CS pin acts as conversion start signal for the AD4696: whenever a SPI read transaction is performed in the data capture callback function.

The firmware supports both unipolar and pseudo bipolar modes. By default the firmware is configured in unipolar mode. To switch to pseudo bipolar mode, by defining “PSEUDO_BIPOLAR_MODE” macro in app_config.h file. Make sure to change the JP6 jumper to position A on the Eval board to use the PSEUDO_BIPOLAR_MODE. Since the pin pairing option is same for all the channels in standard sequencer mode, hence polarity mode for all the channels is also kept same to avoid stale ADC output codes.

Software Downloads

Mbed Firmware

Latest firmware (Use below link):

Quick Start to use Mbed IIO Firmware

If you have some familiarity with the Mbed platform, the following is a basic list of steps required to start running the code, see below for more detail:

  • Connect the AD4696 EVAL-board to the SDP-K1 controller board as specified in hardware connections section.
  • Connect the SDP-K1 controller board to your computer over USB provided along with SDP-K1 board.
  • Go to the link of the code provided above in the 'Downloads' section and import code into Mbed online compiler (Edit app_config.h file (defaults to AD4696 device) if evaluating any other device).
  • Ensure SDP-K1 controller board is selected (top right of online-compiler page).
  • Compile the code.
  • After a successful compile a binary will be downloaded to your computer - store this on your drive.
  • Drag and drop this binary to the USB drive hosted by your controller board.
  • Press reset button to reset the microcontroller and the application will start to run.

Libiio: IIO Library

This library provides an abstracted library interface to communicate IIO device (AD4696) 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):

IIO Oscilloscope (Client)

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):


Evaluating AD4696 Using IIO Ecosystem

Ensure that hardware connection has been made properly in between Mbed Controller Board (SDP-K1) and AD4696 EVAL board. Also ensure all software's (IIO firmware, Libiio windows installer and IIO Oscilloscope windows installer) are downloaded and installed in your computer before trying to communicate with AD4696 device.

Running IIO Oscilloscope (Client)

Open the IIO Oscilloscope application from start menu and configure the serial (UART) settings as shown below. Click on refresh button and AD4696 device should pop-up in IIO devices list. Click 'Connect' and select the AD4696 device from the drop down menu list of 'Device Selection'.

Configure/Access Device Attributes (Parameters)

The IIO Oscilloscope allows user to access and configure different device parameters, called as 'Device Attributes”. There are 2 types of attributes:

  1. Device Attributes (Global): Access/Configure common device parameters.
  2. Channel Attributes (Specific to channels): Access/Configure channel specific device parameters.

How to read and write attribute:

  • To 'Read' an attribute, simply select the attribute from a list or press 'Read' button on left side.
  • To 'Write' an attribute, select attribute value in the 'value field' and press 'Write' button.

Note: AD4696 IIO firmware expose only few (important) attributes and there is no option to modify (write) them. They are listed below: 1) “sampling-rate” – Defines the actual sampling rate (ODR) used in the firmware for data capturing. 2) “raw” – ADC raw value corresponding to selected channel. 3) “scale” – This attribute is used to convert ADC raw value into ‘voltage’ in DMM tab.

Using DMM Tab to Read DC Voltage on Input Channels

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, it is not encouraged to use Data Capture or Debug tab as this could impact data capturing.

Data Capture from IIO Device

To capture the data from ad4696 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.

More info here: https://wiki.analog.com/resources/tools-software/product-support-software/data-capture-using-iio-app

The continuous time domain data capture can work correctly at ODR/Sampling Rate defined in the firmware code (32KSPS) and also at 0 Oversampling Rate. For plotting frequency domain response max 4096 samples can be selected due to limited buffer size in the firmware. These limitations are due to the firmware architecture and design choices and does not limit the actual device specifications provided in device datasheet

Time Domain

Frequency Domain

Modifying Firmware

The below block diagram shows the ad4696 IIO firmware layer.

app_config.h

This file can be used to:

  1. Select the active platform using macro “ACTIVE_PLATFORM_MBED” (Only Mbed is supported)
  2. Select between physical or virtual COM Port using “USE_VIRTUAL_COM_PORT” macro. Default is physical UART interface
  3. Select between polarity mode of AD4696 (unipolar/pseudo bipolar) using “PSEUDO_BIPOLAR_MODE”. Default is unipolar mode.
  4. Select the 'Active Device' to evaluate by changing '#define DEV_AD4696' macro. Default active device is AD4696.

app_config_mbed.h

This file can be used to:

  1. Select Mbed compatible board pin mapping w.r.t. Arduino connector (e.g. SDP-K1).
  2. Define the possible sampling rate (ODR). Should never exceed than the default ODR selected using macro “SAMPLING_RATE” as this could impact data capture with device.

ad4696_user_config.c

These files define the user configurations for the AD4696, such as SPI parameters (frequency, mode, etc) and other init parameters used by No-OS drivers to initialize AD4696 device (active device, data format, etc). These are the parameters loaded into device when device is powered-up or power-cycled.

ad4696_data_capture.c

This file implements the data capturing logic for the AD4696 device. The adc_data_capture.c module present in platform drivers acts as an abstracted layer for common IIO application data capturing.

iio_ad4696.c

This file defines getter/setter functions for all the device and channel specific attributes (related to AD4696 devices) to read/write the device parameters. The majority of device specific functionality is present in this module.

No-OS Drivers for AD4696

The no-os drivers provide the high-level abstracted layer for digital interface of AD4696 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: 1. ad469x.c 2. ad469x.h The drivers are can use SPI engine framework or Standard SPI framework to communicate with the board. By default, the drivers use the Standard SPI framework. The SPI engine framework can be enabled defining the “ENABLE_SPI_ENGINE” macro in the ad469x.h file.

It is hoped that the most common functions of the AD4696 family are coded, but it's likely that some special functionality is not implemented. Feel free to consult Analog Devices Engineer-Zone for feature requests, feedback, bug-reports etc.
resources/tools-software/product-support-software/ad4696_mbed_iio_application.txt · Last modified: 30 Sep 2021 06:49 by Pratyush Mallick