Example program for EVAL-ADMX2001

Dependencies:   ADMX2001

README.txt

Committer:
nsheth
Date:
2021-11-17
Revision:
15:fca7551aaf0a
Parent:
11:9d9cca17d2b1

File content as of revision 15:fca7551aaf0a:

Evaluation Boards/Products Supported
------------------------------------ 
EVAL-ADMX2001

Overview
--------
These code files provide the console application and device libraries to 
interface with ADMX2001 board. This code was developed and tested on SDP-K1 
controller board: https://os.mbed.com/platforms/SDP_K1/

Product details: 
Eval board details: 
User Guide for this code: 
Communication Protocol: SPI


Hardware Setup
--------------
Required: SDP-K1 (or alternative MBED enabled controller board), ADMX2001, 
USB cable.
Plug in the ADMX2001 board on SDP-K1 board (or any other Mbed enabled 
controller board) using the SDP connector and screws.
Connect SDP-K1 board to the PC using the USB cable.


How to Get Started
------------------
Open Mbed online compiler. https://ide.mbed.com/compiler
Import Code into compiler from here: https://os.mbed.com/teams/AnalogDevices/code/EVAL-ADMX2001/
instructions on how to import code are here: https://os.mbed.com/docs/mbed-os/v6.15/build-tools/importing-code.html
Compile code. Open Tera Term (or alternative), select serial communication with 115200 baud rate, and the applicable COM 
port. Drag and drop binary into SDP-K1 controller board. Find detailed 
instructions here: https://os.mbed.com/docs/mbed-os/v6.15/build-tools/getting-your-program-on-your-board.html 
Tera term will then display the print output of your complied code.  

Details of Operation
--------------------

The ADMX2001 library, contain the code required to interface with the ADMX2001 module via the SPI interface. 
The EVAL-ADMX2001 is a program that initialises the spi interface and uses the ADMX2001 library to communicate with the 
ADMX2001 module. 
This code performs a measurement and calibration. The set of SPI read/write operations needed for measurement and 
calibration are present in measure.cpp and calibrate.cpp respectively. 
The gpio_config file contains code to interface with the on board resistors and allow us to change the test load across the ADMX2001 terminals. 

Before any operation, the board is reset to default attribute values by performing a software reset of the module. 
This is achieved by sending command with command ID 0x12 (CMD_RESET). 

The steps followed for measurement are as follows :- 

1. Set the test load across the ADMX2001 terminal to a 1000 ohm resistor, by setting mux enable select to 3.
2. Send SPI command with commmand ID as 0x0F (CMD_Z) to initiate a measurement. 
3. Poll the status and wait for bit 32 (ADMX200X_STATUS_MEASURE_DONE_BITM) of the status to be set. 
4. Once the ADMX200X_STATUS_MEASURE_DONE_BITM bit is set, the measurment fifo will be populated with the measured values. 
   Read these values by reading the complete fifo. 
5. To acquire the sweep points, firstly send SPI command with command ID 0x11 (CMD_READ_SWEEP_POINTS). 
   Then read the complete fifo now populated with the sweep points. 
6. Format and display the sweep points along with the corresponding measured values. 
7. In case of any error in this process, clear the SPI and abort the measurement by sending SPI command with command ID 0x1A (CMD_ABORT).

The steps followed for calibration are as follows :-

1. Set the test load across the ADMX2001 terminal to a 0 ohms (short), by setting mux enable select to 1.
2. Set the voltage gain to 0 by sending a SPI command with 0 as the data and with command ID as 0x28 (CMD_VOLTAGE_GAIN). 
3. Set the current gain to 0 by sending a SPI command with 0 as the data and with command ID as 0x29 (CMD_CURRENT_GAIN). 
4. To perform either short, open or load calibration, send SPI command with command ID as 0x04 (CMD_CALIBRATE). 
   The address and the data for this command needs to be set according to the type of calibration. 
   For example, sending address as 1 performs short calibration.
5. Poll the status and wait for bit 32 (ADMX200X_STATUS_MEASURE_DONE_BITM) of the status to be set. 
6. The fifo will now contain the measurement performed during calibration, the measurement values and the sweep points can be read similar to how its done during a simple measurement. 
7. Print the measurement in the appropriate format, in case of failure, read warning register, and status register to pinpoint the exact error. 

Notes
-----
If using Win 7, install serial drivers for Mbed. https://os.mbed.com/docs/mbed-os/v5.12/tutorials/windows-serial-driver.html
A detailed user guide on SDP-K1 controller board is available here https://www.analog.com/en/design-center/evaluation-hardware-and-software/evaluation-boards-kits/SDP-K1.html.


License
-------
Copyright (c) 2021 Analog Devices, Inc.  All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
  - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.  
  - Modified versions of the software must be conspicuously marked as such.
  - This software is licensed solely and exclusively for use with processors/products manufactured by or for Analog Devices, Inc.
  - This software may not be combined or merged with other code in any manner that would cause the software to become subject to terms and conditions which differ from those listed here.
  - Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
  - The use of this software may or may not infringe the patent rights of one or more patent holders.  This license does not release you from the requirement that you obtain separate licenses from these patent holders to use this software.

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, TITLE, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, DAMAGES ARISING OUT OF CLAIMS OF INTELLECTUAL PROPERTY RIGHTS INFRINGEMENT; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

2021-01-10-7CBSD SLA