Analog Devices / ADMX2001
Committer:
nsheth
Date:
Tue Nov 02 10:13:33 2021 +0000
Revision:
10:49537b1dbbd7
Parent:
9:f286301109fb
Child:
11:071709f5f7d4
Removing platform drivers

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nsheth 9:f286301109fb 1 /* Copyright (c) 2021 Analog Devices, Inc. All rights reserved.
nsheth 9:f286301109fb 2
nsheth 9:f286301109fb 3 Redistribution and use in source and binary forms, with or without modification,
nsheth 9:f286301109fb 4 are permitted provided that the following conditions are met:
nsheth 9:f286301109fb 5 - Redistributions of source code must retain the above copyright notice,
nsheth 9:f286301109fb 6 this list of conditions and the following disclaimer.
nsheth 9:f286301109fb 7 - Redistributions in binary form must reproduce the above copyright notice,
nsheth 9:f286301109fb 8 this list of conditions and the following disclaimer in the documentation
nsheth 9:f286301109fb 9 and/or other materials provided with the distribution.
nsheth 9:f286301109fb 10 - Modified versions of the software must be conspicuously marked as such.
nsheth 9:f286301109fb 11 - This software is licensed solely and exclusively for use with processors/products
nsheth 9:f286301109fb 12 manufactured by or for Analog Devices, Inc.
nsheth 9:f286301109fb 13 - This software may not be combined or merged with other code in any manner
nsheth 9:f286301109fb 14 that would cause the software to become subject to terms and conditions which
nsheth 9:f286301109fb 15 differ from those listed here.
nsheth 9:f286301109fb 16 - Neither the name of Analog Devices, Inc. nor the names of its contributors
nsheth 9:f286301109fb 17 may be used to endorse or promote products derived from this software without
nsheth 9:f286301109fb 18 specific prior written permission.
nsheth 9:f286301109fb 19 - The use of this software may or may not infringe the patent rights of one or
nsheth 9:f286301109fb 20 more patent holders. This license does not release you from the requirement
nsheth 9:f286301109fb 21 that you obtain separate licenses from these patent holders to use this software.
nsheth 9:f286301109fb 22
nsheth 9:f286301109fb 23 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. AND CONTRIBUTORS "AS IS" AND
nsheth 9:f286301109fb 24 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
nsheth 9:f286301109fb 25 TITLE, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
nsheth 9:f286301109fb 26 NO EVENT SHALL ANALOG DEVICES, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
nsheth 9:f286301109fb 27 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE OR CONSEQUENTIAL DAMAGES
nsheth 9:f286301109fb 28 (INCLUDING, BUT NOT LIMITED TO, DAMAGES ARISING OUT OF CLAIMS OF INTELLECTUAL
nsheth 9:f286301109fb 29 PROPERTY RIGHTS INFRINGEMENT; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
nsheth 9:f286301109fb 30 OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
nsheth 9:f286301109fb 31 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
nsheth 9:f286301109fb 32 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
nsheth 9:f286301109fb 33 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
nsheth 9:f286301109fb 34
nsheth 9:f286301109fb 35 2021-01-10-7CBSD SLA
nsheth 9:f286301109fb 36 */
nsheth 10:49537b1dbbd7 37
nsheth 3:81d1980d45aa 38 /**
nsheth 9:f286301109fb 39 * @file ADMX2001_commands.h
nsheth 3:81d1980d45aa 40 * @brief This file contains Macros for the SPI Commands
nsheth 3:81d1980d45aa 41 * @{
nsheth 3:81d1980d45aa 42 */
nsheth 3:81d1980d45aa 43
nsheth 3:81d1980d45aa 44 #ifndef __ADMX200X_COMMANDS_H__
nsheth 3:81d1980d45aa 45 #define __ADMX200X_COMMANDS_H__
nsheth 3:81d1980d45aa 46
nsheth 3:81d1980d45aa 47 /** Bit mask to indicate read or write */
nsheth 3:81d1980d45aa 48 #define CMD_READ_BITM 0x80
nsheth 3:81d1980d45aa 49
nsheth 10:49537b1dbbd7 50 /** Length of a command */
nsheth 3:81d1980d45aa 51 #define ADMX200X_CMD_LENGTH 7
nsheth 3:81d1980d45aa 52
nsheth 3:81d1980d45aa 53 /** Basic commands */
nsheth 3:81d1980d45aa 54 /** Read status */
nsheth 3:81d1980d45aa 55 #define CMD_STATUS_READ 0x00U
nsheth 3:81d1980d45aa 56 /** Read result */
nsheth 3:81d1980d45aa 57 #define CMD_RESULT_READ 0x01
nsheth 3:81d1980d45aa 58 /** Clear error */
nsheth 3:81d1980d45aa 59 #define CMD_CLEAR_ERROR 0x02
nsheth 3:81d1980d45aa 60 /** Read fifo */
nsheth 3:81d1980d45aa 61 #define CMD_FIFO_READ 0x03
nsheth 10:49537b1dbbd7 62 /** Command to calibrate */
nsheth 3:81d1980d45aa 63 #define CMD_CALIBRATE 0x04
nsheth 10:49537b1dbbd7 64 /** Command to read compensation value */
nsheth 3:81d1980d45aa 65 #define CMD_COMPENSATION 0x5
nsheth 10:49537b1dbbd7 66 /** Command to read calibration coefficient */
nsheth 3:81d1980d45aa 67 #define CMD_CAL_READ 0x06
nsheth 10:49537b1dbbd7 68 /** Command to store calibration coefficient */
nsheth 3:81d1980d45aa 69 #define CMD_STORE_CAL 0x08
nsheth 10:49537b1dbbd7 70 /** Command to store calibration coefficient */
nsheth 3:81d1980d45aa 71 #define CMD_RESET_CAL 0x09
nsheth 3:81d1980d45aa 72 /** Command to swithc on or off error check */
nsheth 3:81d1980d45aa 73 #define CMD_ERR_CHECK 0xa
nsheth 3:81d1980d45aa 74 /** Command to swithc on or off error check */
nsheth 3:81d1980d45aa 75 #define CMD_SELF_TEST 0xb
nsheth 10:49537b1dbbd7 76 /** Command to read calibration coefficient */
nsheth 3:81d1980d45aa 77 #define CMD_COMP_READ 0xc
nsheth 10:49537b1dbbd7 78 /** Command to store calibration coefficient */
nsheth 3:81d1980d45aa 79 #define CMD_STORE_COMP 0xd
nsheth 3:81d1980d45aa 80 /** Command to read temperature */
nsheth 3:81d1980d45aa 81 #define CMD_TEMPERATURE 0xe
nsheth 3:81d1980d45aa 82 /** Command Z */
nsheth 3:81d1980d45aa 83 #define CMD_Z 0xf
nsheth 3:81d1980d45aa 84 /** Read sweep points */
nsheth 3:81d1980d45aa 85 #define CMD_READ_SWEEP_POINTS 0x11
nsheth 3:81d1980d45aa 86 /** Reset */
nsheth 3:81d1980d45aa 87 #define CMD_RESET 0x12
nsheth 3:81d1980d45aa 88 /** Current gain table */
nsheth 3:81d1980d45aa 89 #define CMD_CURRENT_GAIN_TABLE 0x13
nsheth 3:81d1980d45aa 90 /** Voltage gain table */
nsheth 3:81d1980d45aa 91 #define CMD_VOLTAGE_GAIN_TABLE 0x14
nsheth 3:81d1980d45aa 92 /** Version Details */
nsheth 3:81d1980d45aa 93 #define CMD_VERSION 0x15
nsheth 10:49537b1dbbd7 94 /** Command to read or write spi regsiters */
nsheth 3:81d1980d45aa 95 #define CMD_IP_REGISTERS 0x16
nsheth 10:49537b1dbbd7 96 /** Initiates the measurement */
nsheth 3:81d1980d45aa 97 #define CMD_INITIATE (0x17)
nsheth 10:49537b1dbbd7 98 /** Triggers the measurement */
nsheth 3:81d1980d45aa 99 #define CMD_TRIGGER (0x18)
nsheth 10:49537b1dbbd7 100 /** Fetch the last measurement */
nsheth 3:81d1980d45aa 101 #define CMD_FETCH (0x19)
nsheth 10:49537b1dbbd7 102 /** Aborts the measurement */
nsheth 3:81d1980d45aa 103 #define CMD_ABORT (0x1a)
nsheth 3:81d1980d45aa 104 /** Calibration commit command */
nsheth 3:81d1980d45aa 105 #define CMD_CAL_COMMIT (0x1b)
nsheth 10:49537b1dbbd7 106 /** Calibration commit password set */
nsheth 3:81d1980d45aa 107 #define CMD_SET_PASSWORD (0x1c)
nsheth 10:49537b1dbbd7 108 /** Calibration commit get password */
nsheth 3:81d1980d45aa 109 #define CMD_GET_PASSWORD (0x1d)
nsheth 3:81d1980d45aa 110 /** Command to read or write spi regsiters with address more than uint16 */
nsheth 3:81d1980d45aa 111 #define CMD_IP_REGISTERS_U32 (0x1e)
nsheth 3:81d1980d45aa 112
nsheth 3:81d1980d45aa 113 /** Base of attribute commands */
nsheth 3:81d1980d45aa 114 #define CMD_ATTR_BASE (0x20)
nsheth 10:49537b1dbbd7 115 /** lcr frequecny */
nsheth 3:81d1980d45aa 116 #define CMD_FREQUENCY (CMD_ATTR_BASE + 3)
nsheth 10:49537b1dbbd7 117 /** lcr integration time */
nsheth 3:81d1980d45aa 118 #define CMD_INTEGRATION (CMD_ATTR_BASE + 4)
nsheth 10:49537b1dbbd7 119 /** dds magnitude */
nsheth 3:81d1980d45aa 120 #define CMD_MAGNITUDE (CMD_ATTR_BASE + 5)
nsheth 10:49537b1dbbd7 121 /** dds offset */
nsheth 3:81d1980d45aa 122 #define CMD_OFFSET (CMD_ATTR_BASE + 6)
nsheth 10:49537b1dbbd7 123 /** dds gain */
nsheth 3:81d1980d45aa 124 #define CMD_DDS_GAIN (CMD_ATTR_BASE + 7)
nsheth 10:49537b1dbbd7 125 /** lcr voltage gain */
nsheth 3:81d1980d45aa 126 #define CMD_VOLTAGE_GAIN (CMD_ATTR_BASE + 8)
nsheth 10:49537b1dbbd7 127 /** lcr current gain */
nsheth 3:81d1980d45aa 128 #define CMD_CURRENT_GAIN (CMD_ATTR_BASE + 9)
nsheth 10:49537b1dbbd7 129 /** lcr average */
nsheth 3:81d1980d45aa 130 #define CMD_AVERAGE (CMD_ATTR_BASE + 10)
nsheth 10:49537b1dbbd7 131 /** lcr measurement delay */
nsheth 3:81d1980d45aa 132 #define CMD_MDELAY (CMD_ATTR_BASE + 11)
nsheth 10:49537b1dbbd7 133 /** lcr trigger delay */
nsheth 3:81d1980d45aa 134 #define CMD_TDELAY (CMD_ATTR_BASE + 12)
nsheth 10:49537b1dbbd7 135 /** lcr trigger count */
nsheth 3:81d1980d45aa 136 #define CMD_TCOUNT (CMD_ATTR_BASE + 13)
nsheth 10:49537b1dbbd7 137 /** Sweep Start */
nsheth 3:81d1980d45aa 138 #define CMD_SWEEP_START (CMD_ATTR_BASE + 16)
nsheth 3:81d1980d45aa 139 /** Sweep End*/
nsheth 3:81d1980d45aa 140 #define CMD_SWEEP_END (CMD_ATTR_BASE + 17)
nsheth 10:49537b1dbbd7 141 /** Sweep Type */
nsheth 3:81d1980d45aa 142 #define CMD_SWEEP_TYPE (CMD_ATTR_BASE + 18)
nsheth 3:81d1980d45aa 143 /** lcr sweep scale log or linear */
nsheth 3:81d1980d45aa 144 #define CMD_SWEEP_SCALE (CMD_ATTR_BASE + 19)
nsheth 10:49537b1dbbd7 145 /** lcr cycles */
nsheth 3:81d1980d45aa 146 #define CMD_CYCLES (CMD_ATTR_BASE + 20)
nsheth 10:49537b1dbbd7 147 /** lcr celsius */
nsheth 3:81d1980d45aa 148 #define CMD_CELSIUS (CMD_ATTR_BASE + 27)
nsheth 10:49537b1dbbd7 149 /** lcr radians */
nsheth 3:81d1980d45aa 150 #define CMD_RADIANS (CMD_ATTR_BASE + 28)
nsheth 10:49537b1dbbd7 151 /** lcr lock */
nsheth 3:81d1980d45aa 152 #define CMD_LOCK (CMD_ATTR_BASE + 29)
nsheth 10:49537b1dbbd7 153 /** lcr display */
nsheth 3:81d1980d45aa 154 #define CMD_DISPLAY (CMD_ATTR_BASE + 33)
nsheth 10:49537b1dbbd7 155 /** lcr sample count */
nsheth 3:81d1980d45aa 156 #define CMD_COUNT (CMD_ATTR_BASE + 34)
nsheth 10:49537b1dbbd7 157 /** lcr correction mode */
nsheth 3:81d1980d45aa 158 #define CMD_CORRECTION_MODE (CMD_ATTR_BASE + 35)
nsheth 10:49537b1dbbd7 159 /** Check ADC and FIFO overflow */
nsheth 3:81d1980d45aa 160 #define CMD_OVERFLOW_CHECK (CMD_ATTR_BASE + 36)
nsheth 3:81d1980d45aa 161 /** DC resistance mode */
nsheth 3:81d1980d45aa 162 #define CMD_RESISTANCE_MODE (CMD_ATTR_BASE + 37)
nsheth 3:81d1980d45aa 163 /** Enable Auto range gain for ADC channels */
nsheth 3:81d1980d45aa 164 #define CMD_ENABLE_AUTORANGE (CMD_ATTR_BASE + 38)
nsheth 3:81d1980d45aa 165 /** Minimum sample clocks */
nsheth 3:81d1980d45aa 166 #define CMD_SAMPLE_CLOCKS (CMD_ATTR_BASE + 39)
nsheth 3:81d1980d45aa 167 /** Check echo mode is enabled or disabled */
nsheth 3:81d1980d45aa 168 #define CMD_ECHO_MODE (CMD_ATTR_BASE + 40)
nsheth 3:81d1980d45aa 169 /** Sets and checks boards revision */
nsheth 3:81d1980d45aa 170 #define CMD_BOARD_REV (CMD_ATTR_BASE + 41)
nsheth 3:81d1980d45aa 171 /** Trigger mode */
nsheth 3:81d1980d45aa 172 #define CMD_TRIGGER_MODE (CMD_ATTR_BASE + 42)
nsheth 10:49537b1dbbd7 173 /** State of behaviour model - only read allowed */
nsheth 3:81d1980d45aa 174 #define CMD_STATE ((CMD_ATTR_BASE + 45) | CMD_READ_BITM)
nsheth 3:81d1980d45aa 175 /** Actual measurement count value */
nsheth 3:81d1980d45aa 176 #define CMD_ACTUAL_COUNT (CMD_ATTR_BASE + 47)
nsheth 3:81d1980d45aa 177 /** Check if vector display mode is enabled */
nsheth 3:81d1980d45aa 178 #define CMD_SELF_TEST_STATUS (CMD_ATTR_BASE + 49)
nsheth 10:49537b1dbbd7 179 /** Unique ID - addr0 - lower 32 , addr 1 upper 32 */
nsheth 3:81d1980d45aa 180 #define CMD_UNIQUE_ID (CMD_ATTR_BASE + 50)
nsheth 3:81d1980d45aa 181 /** Warning Message Type */
nsheth 3:81d1980d45aa 182 #define CMD_WARNING_TYPE (CMD_ATTR_BASE + 51)
nsheth 3:81d1980d45aa 183
nsheth 10:49537b1dbbd7 184 /** Not defined or unsupported command */
nsheth 3:81d1980d45aa 185 #define CMD_NOT_DEFINED 0xFF
nsheth 3:81d1980d45aa 186
nsheth 3:81d1980d45aa 187 /** Bit mask for measure done bit */
nsheth 3:81d1980d45aa 188 #define ADMX200X_STATUS_MEASURE_DONE_BITM 0x80000000
nsheth 3:81d1980d45aa 189 /** Bit mask for done field bits */
nsheth 3:81d1980d45aa 190 #define ADMX200X_STATUS_DONE_BITM 0x40000000
nsheth 3:81d1980d45aa 191 /** Bit mask for status field bits */
nsheth 3:81d1980d45aa 192 #define ADMX200X_STATUS_ERROR_BITM 0x20000000
nsheth 3:81d1980d45aa 193 /** Bit mask for warning field bits */
nsheth 3:81d1980d45aa 194 #define ADMX200X_STATUS_WARN_BITM 0x10000000
nsheth 3:81d1980d45aa 195 /** Bit mask for fifo error */
nsheth 3:81d1980d45aa 196 #define ADMX200X_STATUS_FIFO_ERROR_BITM 0x08000000
nsheth 3:81d1980d45aa 197 /** Bit mask for fifo depth field bits */
nsheth 3:81d1980d45aa 198 #define ADMX200X_STATUS_FIFO_DEPTH_BITM 0x03FF0000
nsheth 3:81d1980d45aa 199 /** Bit mask for command result code field bits */
nsheth 3:81d1980d45aa 200 #define ADMX200X_STATUS_CODE_BITM 0x0000FFFF
nsheth 3:81d1980d45aa 201
nsheth 10:49537b1dbbd7 202 /** Success */
nsheth 3:81d1980d45aa 203 #define ADMX_STATUS_SUCCESS 0
nsheth 10:49537b1dbbd7 204 /** Failed */
nsheth 3:81d1980d45aa 205 #define ADMX_STATUS_FAILED 1
nsheth 10:49537b1dbbd7 206 /** Timeout */
nsheth 3:81d1980d45aa 207 #define ADMX_STATUS_TIMEOUT 2
nsheth 3:81d1980d45aa 208 /** Invalid attribute */
nsheth 3:81d1980d45aa 209 #define ADMX_STATUS_INVALID_ATTRIBUTE 3
nsheth 3:81d1980d45aa 210 /** Attribute value out of range */
nsheth 3:81d1980d45aa 211 #define ADMX_STATUS_ATTR_OUT_OF_RANGE 4
nsheth 10:49537b1dbbd7 212 /** Invalid address of tcommand */
nsheth 3:81d1980d45aa 213 #define ADMX_STATUS_INVALID_ADDRESS 5
nsheth 3:81d1980d45aa 214 /** Uncommitted calibration coeffs */
nsheth 3:81d1980d45aa 215 #define ADMX_STATUS_UNCOMMITED_CAL 6
nsheth 3:81d1980d45aa 216 /** Invalid current gain*/
nsheth 3:81d1980d45aa 217 #define ADMX_STATUS_INVALID_CURRENT_GAIN 7
nsheth 3:81d1980d45aa 218 /** Invalid display mode*/
nsheth 3:81d1980d45aa 219 #define ADMX_STATUS_INVALID_DISPLAY_MODE 8
nsheth 3:81d1980d45aa 220 /** Sweep type not valid */
nsheth 3:81d1980d45aa 221 #define ADMX_STATUS_INVALID_SWEEP_TYPE 9
nsheth 3:81d1980d45aa 222 /** Sweep type not valid in DC mode */
nsheth 3:81d1980d45aa 223 #define ADMX_STATUS_INVALID_DC_SWEEP_TYPE 9
nsheth 3:81d1980d45aa 224 /** Invalid sweep range */
nsheth 3:81d1980d45aa 225 #define ADMX_STATUS_INVALID_SWEEP_RANGE 10
nsheth 3:81d1980d45aa 226 /** Invalid calibration coeff type */
nsheth 3:81d1980d45aa 227 #define ADMX_STATUS_INVALID_CAL_COEFF_TYPE 11
nsheth 3:81d1980d45aa 228 /** System is not ready to take trigger */
nsheth 3:81d1980d45aa 229 #define ADMX_STATUS_TRIGGER_OVERFLOW 12
nsheth 3:81d1980d45aa 230 /** Invalid calibration type */
nsheth 3:81d1980d45aa 231 #define ADMX_STATUS_INVALID_CAL_TYPE 13
nsheth 3:81d1980d45aa 232 /** Invalid calibration gains */
nsheth 3:81d1980d45aa 233 #define ADMX_STATUS_INVALID_GAIN 14
nsheth 10:49537b1dbbd7 234 /** WArning Auto range got disabled in this command */
nsheth 3:81d1980d45aa 235 #define ADMX_STATUS_AUTO_RANGE_DISABLED 15
nsheth 3:81d1980d45aa 236 /** Calibration faild */
nsheth 3:81d1980d45aa 237 #define ADMX_STATUS_CAL_FAILED 15
nsheth 3:81d1980d45aa 238 /** Compensation failed */
nsheth 3:81d1980d45aa 239 #define ADMX_STATUS_COMP_FAILED 15
nsheth 3:81d1980d45aa 240 /** Invalid command for the state */
nsheth 3:81d1980d45aa 241 #define ADMX_STATUS_INVALID_COMMAND_STATE 16
nsheth 3:81d1980d45aa 242 /** Log of zero error */
nsheth 3:81d1980d45aa 243 #define ADMX_STATUS_LOG_ZERO_ERROR 32
nsheth 3:81d1980d45aa 244 /** Sign change for log error */
nsheth 3:81d1980d45aa 245 #define ADMX_STATUS_LOG_SIGN_ERROR 64
nsheth 3:81d1980d45aa 246 /** Voltage ADC saturated error */
nsheth 3:81d1980d45aa 247 #define ADMX_STATUS_VOLT_ADC_ERROR 128
nsheth 3:81d1980d45aa 248 /** Current ADC saturated error */
nsheth 3:81d1980d45aa 249 #define ADMX_STATUS_CURR_ADC_ERROR 256
nsheth 3:81d1980d45aa 250 /** FIFO over/under flow error */
nsheth 3:81d1980d45aa 251 #define ADMX_STATUS_FIFO_ERROR 512
nsheth 3:81d1980d45aa 252 /** Sweep count maximum value exceeded */
nsheth 3:81d1980d45aa 253 #define ADMX_STATUS_COUNT_EXCEEDED 1024
nsheth 3:81d1980d45aa 254
nsheth 3:81d1980d45aa 255 #endif /* __ADMX200X_COMMANDS_H__ */
nsheth 3:81d1980d45aa 256
nsheth 3:81d1980d45aa 257 /**
nsheth 3:81d1980d45aa 258 * @}
nsheth 3:81d1980d45aa 259 */