Wiki

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
resources:eval:user-guides:ad4130:mbed_iio_app [16 Apr 2021 11:40] Zhaoqun Guoresources:eval:user-guides:ad4130:mbed_iio_app [31 May 2023 07:54] (current) Mahesh Phalke
Line 1: Line 1:
-=====Mbed IIO Application===== +===== AD4130 IIO Application===== 
-====Introduction==== + 
-This page gives an overview of using the ARM Mbed platform supported firmware example with Analog +===== Introduction ===== 
 + 
 +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 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  the ADI developed IIO (Industrial Input Output) ecosystem to evaluate the AD4130 device by providing a 
 device debug and data capture support. device debug and data capture support.
-The overview of an entire system is shown below: + 
-{{ :resources:eval:user-guides:ad4130:screenshot_2021-04-15_161906.png?600 |}} +{{section>resources/tools-software/product-support-software/iio_support_introduction#Introduction&showfooter=nofooter}} 
-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. The firmware application communicates with IIO device  +
-(AD4130) 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 AD4130 IIO device. The AD4130 eval board is used for development and  +
-testing of this application.+
 ===Useful links=== ===Useful links===
-  * [[https://ide.mbed.com/compiler/#nav:/;|Mbed Online Compiler]] +{{section>resources/tools-software/product-support-software/useful_links#Useful Link&showfooter=nofooter}} 
-  * [[https://os.mbed.com/platforms/SDP_K1/|SDP-K1 on Mbed]]+  * [[adi>en/products/ad4130-8.html|AD4130 Product Page]] 
 +  * [[adi>en/products/ad4130-8.html#product-evaluationkit|AD4130 Evaluation Kit]] 
 + 
 +----
  
 ====Hardware Connections==== ====Hardware Connections====
 +{{ :resources:eval:user-guides:ad4130:ad4130-eval_and_sdp-k1_hardware_connections.png?600 |}}
 +
 ===Jumper Settings=== ===Jumper Settings===
   * SDP-K1:\\ Connect the VIO_ADJUST jumper on the SDP-K1 board to 3.3V position to drive SDP-K1 GPIOs at 3.3V   * SDP-K1:\\ Connect the VIO_ADJUST jumper on the SDP-K1 board to 3.3V position to drive SDP-K1 GPIOs at 3.3V
-  * EVAL-AD4130:\\ {{ :resources:eval:user-guides:ad4130:screenshot_2021-04-15_162938.png?600 |}}+  * EVAL-AD4130:\\ {{ :resources:eval:user-guides:ad4130:ad4130_evb_jumper_settings.xlsx |}} 
 + 
 +<note>Above jumper settings of AD4130 EVB are specific to sensor demo modes supported in the firmware. Change the jumper settings according to your requirements.</note>
  
-===Hardware Interface=== 
-{{ :resources:eval:user-guides:ad4130:screenshot_2021-04-15_163209.png?600 |}} 
 AD4130 uses SPI communication for device register access and data capture. AD4130 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. 
-{{ :resources:eval:user-guides:ad4130:screenshot_2021-04-15_164837.png?400 |}} 
  
-====Software Downloads==== +{{section>resources/tools-software/product-support-software/hardware_connections_uart#UART Connections&showfooter=nofooter}} 
-===Firmware=== + 
-==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 AD4130 EVAL-board to the SDP-K1 controller board as specified in hardware connections section+===== Software Downloads ===== 
-  - 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 'Downloadssection and import code into [[https://ide.mbed.com/compiler/#nav:/;|Mbed Online Compiler]].\\ {{ :resources:eval:user-guides:ad4130:screenshot_2021-04-16_103924.png?600 |}} +{{section>resources/tools-software/product-support-software/iio_support_software_downloads#Software Downloads&showfooter=nofooter}} 
-  - Ensure SDP-K1 controller board is selected (top right of online-compiler page)(SDP-K1 platform pre-installed from [[https://os.mbed.com/platforms/SDP_K1/|here]]. + 
-  - 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+==== Evaluating AD4130 Using IIO Ecosystem ==== 
-*Note: For more details on importing code into Mbed online compiler, refer below link (Section: Importing  + 
-from local machine): [[https://os.mbed.com/handbook/Importing-code|here]]+{{section>resources/tools-software/product-support-software/note_hardware_connections#Note in Hardware Connections&showfooter=nofooter}} 
-===Libiio: IIO Library=== + 
-This library provides an abstracted library interface to communicate IIO device (AD4130) and IIO client application (IIO Oscilloscope) without worrying about the low level hardware detailsDownload and install below [[resources:tools-software:linux-software:libiio|libiio]] windows installer in your computer+==== Running IIO Oscilloscope (Client) ==== 
-Libiio 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. 
-  * [[https://github.com/analogdevicesinc/libiio/releases|libiio windows installer (.exe)]] + 
-===IIO Oscilloscope (Client)=== +{{ :resources:eval:user-guides:ad4130:ad4130_iio_osc_connection.png?600 |}} 
-This is a GUI (Graphical User Interface) based IIO client application for data visualization and device configuration/debugging. The data from IIO devices (ADCs/DACsis transmitted over Serial/Ethernet/USB link to IIO Oscilloscope client through the abstracted layer of [[resources:tools-software:linux-software:iio_oscilloscopelibiio|libiio]]”Download and install below IIO Oscilloscope windows installer in your computer+ 
-IIO Oscilloscope installer for Windows (Use below link): +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.  
-  * [[https://github.com/analogdevicesinc/iio-oscilloscope/releases|IIO Oscilloscope windows installer (.exe)]]+ 
 +{{ :resources:eval:user-guides:ad4130:ad4130_iio_osc_windows.png?600 |}} 
 + 
 + 
 +==== 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: 
 +  - Device Attributes (Global): Access/Configure common device parameters
 +  - 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. 
 + 
 +==== Using DMM Tab to Read DC Voltage on Input Channels ==== 
 + 
 +DMM tab can be used read the instantaneous voltage applied on analog input channelsSimply select the device and channels to read and press start button. 
 + 
 +<fc #ff0000>//*NoteThe 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 capturingBoth 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.//</fc> 
 + 
 +{{ :resources:tools-software:product-support-software:ad4130_iio_osc_dmm_tab.png?600 |}} 
 + 
 +==== Data Capture from IIO Device ==== 
 + 
 +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 VisualizationThe 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. 
 + 
 +<fc #ff0000>//*Note: The DMM or Debug tab should not be accessed when capturing data as this would impact data capturingBoth 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.//</fc> 
 + 
 +More info here: [[resources:tools-software:product-support-software:data-capture-using-iio-app|Data Capture using IIO App]] 
 + 
 +Data capturing utilizes two modes: 
 +  - Normal sequencer: In this mode, the channel for which data to be captured are enabled and automatically added into a sequencer. The sequencer operates in the continuous conversion mode. After each conversion, an interrupt signal attached to configured INT source is triggered and conversion result is read into a internal acquisition buffer. 
 + 
 +  - FIFO mode: This mode uses the internal FIFO of device to store the ADC samples. The conversion happens in continuous conversion mode and an interrupt signal attached to configured INT source is triggered when internal FIFO becomes full (reached to watermark limit). The data from FIFO is read periodically when FIFO is made available by device. The FIFO is operated in ‘Oldest Save’ mode as there must be enough time provided to read the FIFO after it becomes full. If FIFO is operated into streaming mode, the previous data could get overwritten before it is being acquired by the firmware
 + 
 + 
 +=== Time Domain Plot === 
 + 
 +<fc #ff0000>//*Note: Due to low sampling rate (50SPSfor temperature sensor measurement, select 50 or less samples during data capturing for sensor demo mode channels.//</fc> 
 + 
 +{{ :resources:eval:user-guides:ad4130:ad4130_iio_osc_time_domain_plot.png?800 |}} 
 + 
 +=== Frequency Domain Plot === 
 +<fc #ff0000>//*Note: Max 4096 samples can be selected for plotting frequency domain response due  to limited buffer size in the firmware.//</fc> 
 + 
 +{{ :resources:eval:user-guides:ad4130:ad4130_iio_osc_freq_domain_plot.png?600 |}} 
 + 
 +---- 
 + 
 +==== Python Environment and Scripts ==== 
 + 
 +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 sectionsThe python scripts are provided along with firmware package. 
 + 
 +{{section>resources/tools-software/product-support-software/iio_support_python_application#Python Application&showfooter=nofooter}} 
 + 
 +---- 
 + 
 +==== Sensor Demo Modes ==== 
 +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
 + 
 +  - User Default Config (All channels test
 +  - 2-wire/3-wire/4-wire RTD (Default is PT100) 
 +  - Thermistor (Default is 10K NTC) 
 +  - Thermocouple (Default is T type TC and PT1000 RTD as CJC) 
 +  - Load Cell (4-wire bridge) 
 +  - Noise Test (AIN0-AIN1 shorted) 
 +  - ECG 
 +  - Power Test (ADC internal channels voltage/current measurement) 
 + 
 +<fc #ff0000>//*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.//</fc> 
 + 
 +=== Demo Mode Selection === 
 +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 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. 
 + 
 +{{ :resources:eval:user-guides:ad4130:ad4130_sensor_demo_selection.png?600 |}} 
 + 
 +=== Demo Mode User Configuration === 
 + 
 +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. 
 + 
 +{{ :resources:eval:user-guides:ad4130:ad4130_sensor_demo_configs.png?600 |}} 
 + 
 +=== Sensor Measurement === 
 +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/VCOMconnection between host and MCU (sdp-k1). Refer next section to install necessary python tools and updating/executing the python scripts. 
 + 
 +{{ :resources:eval:user-guides:ad4130:ad4130_sensor_demo_console.png?600 |}} 
 + 
 +=== Sensor Channels Calibration === 
 +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”. 
 + 
 +---- 
 + 
 +==== AD4130 Firmware Structure ==== 
 + 
 +{{ :resources:eval:user-guides:ad4130:ad4130_fw_structure.png?400 |}} 
 + 
 +=== app_config.h === 
 +  - Select the AD4130 device package (either LFCSP or WLCSP). Default is WLCSP. The corresponding hardware board must be used with software selected package type
 +  - Select demo config mode (e.g. Thermistor, 2-wire RTD, etc). 
 +  - Select data capture mode (Continuous, Burst, FIFO). 
 +  - Select UART/VCOM (only for SDP-K1). 
 + 
 +=== ad4130_user_config.c === 
 +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. 
 + 
 +=== ad4130_data_capture.c === 
 +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. 
 + 
 +=== ad4130_iio.c === 
 +This file defines getter/setter functions for all the device and channel specific attributes (related to AD4130 devices) to read/write the device parametersThe majority of device specific functionality is present in this module. 
 + 
 +=== No-OS Drivers for AD4130 === 
 +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 readis done in integration with platform drivers. 
 +The functionality related with no-os drivers is covered in below 2 files: 
 +  - ad413x.c 
 +  - ad413x.h
  
resources/eval/user-guides/ad4130/mbed_iio_app.1618566032.txt.gz · Last modified: 16 Apr 2021 11:40 by Zhaoqun Guo