Example program for EVAL-AD4130
Dependencies: tempsensors sdp_k1_sdram
app/app_config.h@2:7b2b268ea49c, 22 months ago (annotated)
- Committer:
- Mahesh Phalke
- Date:
- Wed Jul 20 18:12:00 2022 +0530
- Revision:
- 2:7b2b268ea49c
Initial firmware commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Mahesh Phalke |
2:7b2b268ea49c | 1 | /*************************************************************************//** |
Mahesh Phalke |
2:7b2b268ea49c | 2 | * @file app_config.h |
Mahesh Phalke |
2:7b2b268ea49c | 3 | * @brief Configuration file for AD4130 device applications |
Mahesh Phalke |
2:7b2b268ea49c | 4 | ****************************************************************************** |
Mahesh Phalke |
2:7b2b268ea49c | 5 | * Copyright (c) 2020-2022 Analog Devices, Inc. |
Mahesh Phalke |
2:7b2b268ea49c | 6 | * All rights reserved. |
Mahesh Phalke |
2:7b2b268ea49c | 7 | * |
Mahesh Phalke |
2:7b2b268ea49c | 8 | * This software is proprietary to Analog Devices, Inc. and its licensors. |
Mahesh Phalke |
2:7b2b268ea49c | 9 | * By using this software you agree to the terms of the associated |
Mahesh Phalke |
2:7b2b268ea49c | 10 | * Analog Devices Software License Agreement. |
Mahesh Phalke |
2:7b2b268ea49c | 11 | *****************************************************************************/ |
Mahesh Phalke |
2:7b2b268ea49c | 12 | |
Mahesh Phalke |
2:7b2b268ea49c | 13 | #ifndef _APP_CONFIG_H_ |
Mahesh Phalke |
2:7b2b268ea49c | 14 | #define _APP_CONFIG_H_ |
Mahesh Phalke |
2:7b2b268ea49c | 15 | |
Mahesh Phalke |
2:7b2b268ea49c | 16 | /******************************************************************************/ |
Mahesh Phalke |
2:7b2b268ea49c | 17 | /***************************** Include Files **********************************/ |
Mahesh Phalke |
2:7b2b268ea49c | 18 | /******************************************************************************/ |
Mahesh Phalke |
2:7b2b268ea49c | 19 | |
Mahesh Phalke |
2:7b2b268ea49c | 20 | #include <stdint.h> |
Mahesh Phalke |
2:7b2b268ea49c | 21 | |
Mahesh Phalke |
2:7b2b268ea49c | 22 | /******************************************************************************/ |
Mahesh Phalke |
2:7b2b268ea49c | 23 | /********************** Macros and Constants Definition ***********************/ |
Mahesh Phalke |
2:7b2b268ea49c | 24 | /******************************************************************************/ |
Mahesh Phalke |
2:7b2b268ea49c | 25 | |
Mahesh Phalke |
2:7b2b268ea49c | 26 | /* List of supported platforms */ |
Mahesh Phalke |
2:7b2b268ea49c | 27 | #define MBED_PLATFORM 1 |
Mahesh Phalke |
2:7b2b268ea49c | 28 | |
Mahesh Phalke |
2:7b2b268ea49c | 29 | /* List of data capture modes for AD4130 device */ |
Mahesh Phalke |
2:7b2b268ea49c | 30 | #define BURST_DATA_CAPTURE 0 |
Mahesh Phalke |
2:7b2b268ea49c | 31 | #define CONTINUOUS_DATA_CAPTURE 1 |
Mahesh Phalke |
2:7b2b268ea49c | 32 | #define FIFO_DATA_CAPTURE 2 |
Mahesh Phalke |
2:7b2b268ea49c | 33 | |
Mahesh Phalke |
2:7b2b268ea49c | 34 | /* List of demo mode configurations */ |
Mahesh Phalke |
2:7b2b268ea49c | 35 | #define USER_DEFAULT_CONFIG 0 |
Mahesh Phalke |
2:7b2b268ea49c | 36 | #define RTD_2WIRE_CONFIG 1 |
Mahesh Phalke |
2:7b2b268ea49c | 37 | #define RTD_3WIRE_CONFIG 2 |
Mahesh Phalke |
2:7b2b268ea49c | 38 | #define RTD_4WIRE_CONFIG 3 |
Mahesh Phalke |
2:7b2b268ea49c | 39 | #define THERMISTOR_CONFIG 4 |
Mahesh Phalke |
2:7b2b268ea49c | 40 | #define THERMOCOUPLE_CONFIG 5 |
Mahesh Phalke |
2:7b2b268ea49c | 41 | #define LOADCELL_CONFIG 6 |
Mahesh Phalke |
2:7b2b268ea49c | 42 | #define ECG_CONFIG 7 |
Mahesh Phalke |
2:7b2b268ea49c | 43 | #define NOISE_TEST_CONFIG 8 |
Mahesh Phalke |
2:7b2b268ea49c | 44 | #define POWER_TEST_CONFIG 9 |
Mahesh Phalke |
2:7b2b268ea49c | 45 | |
Mahesh Phalke |
2:7b2b268ea49c | 46 | /* Macros for stringification */ |
Mahesh Phalke |
2:7b2b268ea49c | 47 | #define XSTR(s) #s |
Mahesh Phalke |
2:7b2b268ea49c | 48 | #define STR(s) XSTR(s) |
Mahesh Phalke |
2:7b2b268ea49c | 49 | |
Mahesh Phalke |
2:7b2b268ea49c | 50 | /******************************************************************************/ |
Mahesh Phalke |
2:7b2b268ea49c | 51 | |
Mahesh Phalke |
2:7b2b268ea49c | 52 | /* Name of active device */ |
Mahesh Phalke |
2:7b2b268ea49c | 53 | #define ACTIVE_DEVICE_NAME "ad4130-8" |
Mahesh Phalke |
2:7b2b268ea49c | 54 | |
Mahesh Phalke |
2:7b2b268ea49c | 55 | /* Select the AD4130 package type (required for interrupt source) */ |
Mahesh Phalke |
2:7b2b268ea49c | 56 | #define AD4130_WLCSP_PACKAGE_TYPE |
Mahesh Phalke |
2:7b2b268ea49c | 57 | //#define AD4130_LFCSP_PACKAGE_TYPE |
Mahesh Phalke |
2:7b2b268ea49c | 58 | |
Mahesh Phalke |
2:7b2b268ea49c | 59 | /* Select the active platform (default is Mbed) */ |
Mahesh Phalke |
2:7b2b268ea49c | 60 | #if !defined(ACTIVE_PLATFORM) |
Mahesh Phalke |
2:7b2b268ea49c | 61 | #define ACTIVE_PLATFORM MBED_PLATFORM |
Mahesh Phalke |
2:7b2b268ea49c | 62 | #endif |
Mahesh Phalke |
2:7b2b268ea49c | 63 | |
Mahesh Phalke |
2:7b2b268ea49c | 64 | /* Select the demo mode configuration (default is user config) */ |
Mahesh Phalke |
2:7b2b268ea49c | 65 | #if !defined(ACTIVE_DEMO_MODE_CONFIG) |
Mahesh Phalke |
2:7b2b268ea49c | 66 | #define ACTIVE_DEMO_MODE_CONFIG USER_DEFAULT_CONFIG |
Mahesh Phalke |
2:7b2b268ea49c | 67 | #endif |
Mahesh Phalke |
2:7b2b268ea49c | 68 | |
Mahesh Phalke |
2:7b2b268ea49c | 69 | /* Select the ADC data capture mode (default is CC mode) */ |
Mahesh Phalke |
2:7b2b268ea49c | 70 | #if !defined(DATA_CAPTURE_MODE) |
Mahesh Phalke |
2:7b2b268ea49c | 71 | #define DATA_CAPTURE_MODE CONTINUOUS_DATA_CAPTURE |
Mahesh Phalke |
2:7b2b268ea49c | 72 | #endif |
Mahesh Phalke |
2:7b2b268ea49c | 73 | |
Mahesh Phalke |
2:7b2b268ea49c | 74 | #if (ACTIVE_PLATFORM == MBED_PLATFORM) |
Mahesh Phalke |
2:7b2b268ea49c | 75 | #include "app_config_mbed.h" |
Mahesh Phalke |
2:7b2b268ea49c | 76 | |
Mahesh Phalke |
2:7b2b268ea49c | 77 | #define HW_CARRIER_NAME STR(TARGET_NAME) |
Mahesh Phalke |
2:7b2b268ea49c | 78 | |
Mahesh Phalke |
2:7b2b268ea49c | 79 | /* Redefine the init params structure mapping w.r.t. platform */ |
Mahesh Phalke |
2:7b2b268ea49c | 80 | #define ext_int_extra_init_params mbed_ext_int_extra_init_params |
Mahesh Phalke |
2:7b2b268ea49c | 81 | #define uart_extra_init_params mbed_uart_extra_init_params |
Mahesh Phalke |
2:7b2b268ea49c | 82 | #define spi_extra_init_params mbed_spi_extra_init_params |
Mahesh Phalke |
2:7b2b268ea49c | 83 | #define irq_ops mbed_gpio_irq_ops |
Mahesh Phalke |
2:7b2b268ea49c | 84 | #define gpio_ops mbed_gpio_ops |
Mahesh Phalke |
2:7b2b268ea49c | 85 | #define spi_ops mbed_spi_ops |
Mahesh Phalke |
2:7b2b268ea49c | 86 | #define EXT_INT_ID GPIO_IRQ_ID1 |
Mahesh Phalke |
2:7b2b268ea49c | 87 | #else |
Mahesh Phalke |
2:7b2b268ea49c | 88 | #error "No/Invalid active platform selected" |
Mahesh Phalke |
2:7b2b268ea49c | 89 | #endif |
Mahesh Phalke |
2:7b2b268ea49c | 90 | |
Mahesh Phalke |
2:7b2b268ea49c | 91 | /* TODO - These values must be read from EEPROM of target EVB */ |
Mahesh Phalke |
2:7b2b268ea49c | 92 | #define HW_MEZZANINE_NAME "EVAL-AD4130-8WARDZ" |
Mahesh Phalke |
2:7b2b268ea49c | 93 | #define HW_NAME ACTIVE_DEVICE_NAME |
Mahesh Phalke |
2:7b2b268ea49c | 94 | |
Mahesh Phalke |
2:7b2b268ea49c | 95 | /* Include user config files and params according to active/selected |
Mahesh Phalke |
2:7b2b268ea49c | 96 | * demo mode config */ |
Mahesh Phalke |
2:7b2b268ea49c | 97 | #if (ACTIVE_DEMO_MODE_CONFIG == USER_DEFAULT_CONFIG) |
Mahesh Phalke |
2:7b2b268ea49c | 98 | #include "ad4130_user_config.h" |
Mahesh Phalke |
2:7b2b268ea49c | 99 | #define ad4130_init_params ad4130_user_config_params |
Mahesh Phalke |
2:7b2b268ea49c | 100 | #elif ((ACTIVE_DEMO_MODE_CONFIG == RTD_2WIRE_CONFIG) || \ |
Mahesh Phalke |
2:7b2b268ea49c | 101 | (ACTIVE_DEMO_MODE_CONFIG == RTD_3WIRE_CONFIG) || \ |
Mahesh Phalke |
2:7b2b268ea49c | 102 | (ACTIVE_DEMO_MODE_CONFIG == RTD_4WIRE_CONFIG)) |
Mahesh Phalke |
2:7b2b268ea49c | 103 | #include "ad4130_rtd_config.h" |
Mahesh Phalke |
2:7b2b268ea49c | 104 | #define ad4130_init_params ad4130_rtd_config_params |
Mahesh Phalke |
2:7b2b268ea49c | 105 | #elif (ACTIVE_DEMO_MODE_CONFIG == THERMISTOR_CONFIG) |
Mahesh Phalke |
2:7b2b268ea49c | 106 | #include "ad4130_thermistor_config.h" |
Mahesh Phalke |
2:7b2b268ea49c | 107 | #define ad4130_init_params ad4130_thermistor_config_params |
Mahesh Phalke |
2:7b2b268ea49c | 108 | #elif (ACTIVE_DEMO_MODE_CONFIG == THERMOCOUPLE_CONFIG) |
Mahesh Phalke |
2:7b2b268ea49c | 109 | #include "ad4130_thermocouple_config.h" |
Mahesh Phalke |
2:7b2b268ea49c | 110 | #define ad4130_init_params ad4130_thermocouple_config_params |
Mahesh Phalke |
2:7b2b268ea49c | 111 | #elif (ACTIVE_DEMO_MODE_CONFIG == LOADCELL_CONFIG) |
Mahesh Phalke |
2:7b2b268ea49c | 112 | #include "ad4130_loadcell_config.h" |
Mahesh Phalke |
2:7b2b268ea49c | 113 | #define ad4130_init_params ad4130_loadcell_config_params |
Mahesh Phalke |
2:7b2b268ea49c | 114 | #elif (ACTIVE_DEMO_MODE_CONFIG == ECG_CONFIG) |
Mahesh Phalke |
2:7b2b268ea49c | 115 | #include "ad4130_ecg_config.h" |
Mahesh Phalke |
2:7b2b268ea49c | 116 | #define ad4130_init_params ad4130_ecg_config_params |
Mahesh Phalke |
2:7b2b268ea49c | 117 | #elif (ACTIVE_DEMO_MODE_CONFIG == NOISE_TEST_CONFIG) |
Mahesh Phalke |
2:7b2b268ea49c | 118 | #include "ad4130_noise_test_config.h" |
Mahesh Phalke |
2:7b2b268ea49c | 119 | #define ad4130_init_params ad4130_noise_test_config_params |
Mahesh Phalke |
2:7b2b268ea49c | 120 | #elif (ACTIVE_DEMO_MODE_CONFIG == POWER_TEST_CONFIG) |
Mahesh Phalke |
2:7b2b268ea49c | 121 | #include "ad4130_power_test_config.h" |
Mahesh Phalke |
2:7b2b268ea49c | 122 | #define ad4130_init_params ad4130_power_test_config_params |
Mahesh Phalke |
2:7b2b268ea49c | 123 | #else |
Mahesh Phalke |
2:7b2b268ea49c | 124 | #include "ad4130_user_config.h" |
Mahesh Phalke |
2:7b2b268ea49c | 125 | #define ad4130_init_params ad4130_user_config_params |
Mahesh Phalke |
2:7b2b268ea49c | 126 | #warning "No/Invalid active demo config selected, user config used as default" |
Mahesh Phalke |
2:7b2b268ea49c | 127 | #endif |
Mahesh Phalke |
2:7b2b268ea49c | 128 | |
Mahesh Phalke |
2:7b2b268ea49c | 129 | /* ADC resolution for active device */ |
Mahesh Phalke |
2:7b2b268ea49c | 130 | #define ADC_RESOLUTION 24 |
Mahesh Phalke |
2:7b2b268ea49c | 131 | |
Mahesh Phalke |
2:7b2b268ea49c | 132 | /* Number of ADC presets/setups */ |
Mahesh Phalke |
2:7b2b268ea49c | 133 | #define ADC_PRESETS 7 |
Mahesh Phalke |
2:7b2b268ea49c | 134 | |
Mahesh Phalke |
2:7b2b268ea49c | 135 | /* Number of actually used ADC channels. |
Mahesh Phalke |
2:7b2b268ea49c | 136 | * Note : There can be max 16 channels in the device sequencer but since |
Mahesh Phalke |
2:7b2b268ea49c | 137 | * input pairs can be only 8 or 16, either 8 or 16 channels are exposed |
Mahesh Phalke |
2:7b2b268ea49c | 138 | * out, based on the user selected channel configuration. |
Mahesh Phalke |
2:7b2b268ea49c | 139 | * The auxilary inputs(such as temperature, ref, etc) are not used. |
Mahesh Phalke |
2:7b2b268ea49c | 140 | * */ |
Mahesh Phalke |
2:7b2b268ea49c | 141 | #define ADC_DIFFERENTIAL_CHNS 8 |
Mahesh Phalke |
2:7b2b268ea49c | 142 | #define ADC_PSEUDO_DIFF_CHNS 16 |
Mahesh Phalke |
2:7b2b268ea49c | 143 | |
Mahesh Phalke |
2:7b2b268ea49c | 144 | /* Default ADC reference voltages for each reference source */ |
Mahesh Phalke |
2:7b2b268ea49c | 145 | #define AD4130_REFIN1_VOLTAGE 2.5 |
Mahesh Phalke |
2:7b2b268ea49c | 146 | #define AD4130_REFIN2_VOLTAGE 2.5 |
Mahesh Phalke |
2:7b2b268ea49c | 147 | #define AD4130_AVDD_VOLTAGE 3.3 // 3.3 or 1.8 |
Mahesh Phalke |
2:7b2b268ea49c | 148 | #define AD4170_2_5V_INT_REF_VOLTAGE 2.5 |
Mahesh Phalke |
2:7b2b268ea49c | 149 | #define AD4170_1_25V_INT_REF_VOLTAGE 1.25 |
Mahesh Phalke |
2:7b2b268ea49c | 150 | |
Mahesh Phalke |
2:7b2b268ea49c | 151 | /* ADC max count (full scale value) for unipolar inputs */ |
Mahesh Phalke |
2:7b2b268ea49c | 152 | #define ADC_MAX_COUNT_UNIPOLAR (uint32_t)((1 << ADC_RESOLUTION) - 1) |
Mahesh Phalke |
2:7b2b268ea49c | 153 | |
Mahesh Phalke |
2:7b2b268ea49c | 154 | /* ADC max count (full scale value) for bipolar inputs */ |
Mahesh Phalke |
2:7b2b268ea49c | 155 | #define ADC_MAX_COUNT_BIPOLAR (uint32_t)(1 << (ADC_RESOLUTION-1)) |
Mahesh Phalke |
2:7b2b268ea49c | 156 | |
Mahesh Phalke |
2:7b2b268ea49c | 157 | /****** Macros used to form a VCOM serial number ******/ |
Mahesh Phalke |
2:7b2b268ea49c | 158 | #if !defined(FIRMWARE_NAME) |
Mahesh Phalke |
2:7b2b268ea49c | 159 | #define FIRMWARE_NAME "ad4130_iio_application" |
Mahesh Phalke |
2:7b2b268ea49c | 160 | #endif |
Mahesh Phalke |
2:7b2b268ea49c | 161 | |
Mahesh Phalke |
2:7b2b268ea49c | 162 | #if !defined(DEVICE_NAME) |
Mahesh Phalke |
2:7b2b268ea49c | 163 | #define DEVICE_NAME "DEV_AD4130" |
Mahesh Phalke |
2:7b2b268ea49c | 164 | #endif |
Mahesh Phalke |
2:7b2b268ea49c | 165 | |
Mahesh Phalke |
2:7b2b268ea49c | 166 | #if !defined(PLATFORM_NAME) |
Mahesh Phalke |
2:7b2b268ea49c | 167 | #define PLATFORM_NAME HW_CARRIER_NAME |
Mahesh Phalke |
2:7b2b268ea49c | 168 | #endif |
Mahesh Phalke |
2:7b2b268ea49c | 169 | |
Mahesh Phalke |
2:7b2b268ea49c | 170 | #if !defined(EVB_INTERFACE) |
Mahesh Phalke |
2:7b2b268ea49c | 171 | #define EVB_INTERFACE "ARDUINO" |
Mahesh Phalke |
2:7b2b268ea49c | 172 | #endif |
Mahesh Phalke |
2:7b2b268ea49c | 173 | /******/ |
Mahesh Phalke |
2:7b2b268ea49c | 174 | |
Mahesh Phalke |
2:7b2b268ea49c | 175 | /* Enable the UART/VirtualCOM port connection (default VCOM) */ |
Mahesh Phalke |
2:7b2b268ea49c | 176 | //#define USE_PHY_COM_PORT // Uncomment to select UART |
Mahesh Phalke |
2:7b2b268ea49c | 177 | |
Mahesh Phalke |
2:7b2b268ea49c | 178 | #if !defined(USE_PHY_COM_PORT) |
Mahesh Phalke |
2:7b2b268ea49c | 179 | /* Below USB configurations (VID and PID) are owned and assigned by ADI. |
Mahesh Phalke |
2:7b2b268ea49c | 180 | * If intended to distribute software further, use the VID and PID owned by your |
Mahesh Phalke |
2:7b2b268ea49c | 181 | * organization */ |
Mahesh Phalke |
2:7b2b268ea49c | 182 | #define VIRTUAL_COM_PORT_VID 0x0456 |
Mahesh Phalke |
2:7b2b268ea49c | 183 | #define VIRTUAL_COM_PORT_PID 0xb66c |
Mahesh Phalke |
2:7b2b268ea49c | 184 | /* Serial number string is formed as: application name + device (target) name + platform (host) name + evb interface name */ |
Mahesh Phalke |
2:7b2b268ea49c | 185 | #define VIRTUAL_COM_SERIAL_NUM (FIRMWARE_NAME "_" DEVICE_NAME "_" PLATFORM_NAME "_" EVB_INTERFACE) |
Mahesh Phalke |
2:7b2b268ea49c | 186 | #endif |
Mahesh Phalke |
2:7b2b268ea49c | 187 | |
Mahesh Phalke |
2:7b2b268ea49c | 188 | /* Baud rate for IIO application UART interface */ |
Mahesh Phalke |
2:7b2b268ea49c | 189 | #define IIO_UART_BAUD_RATE (230400) |
Mahesh Phalke |
2:7b2b268ea49c | 190 | |
Mahesh Phalke |
2:7b2b268ea49c | 191 | /* Enable/Disable the use of SDRAM for ADC data capture buffer */ |
Mahesh Phalke |
2:7b2b268ea49c | 192 | //#define USE_SDRAM_CAPTURE_BUFFER // Uncomment to use SDRAM as data buffer |
Mahesh Phalke |
2:7b2b268ea49c | 193 | |
Mahesh Phalke |
2:7b2b268ea49c | 194 | /******************************************************************************/ |
Mahesh Phalke |
2:7b2b268ea49c | 195 | /************************ Public Declarations *********************************/ |
Mahesh Phalke |
2:7b2b268ea49c | 196 | /******************************************************************************/ |
Mahesh Phalke |
2:7b2b268ea49c | 197 | |
Mahesh Phalke |
2:7b2b268ea49c | 198 | extern struct no_os_uart_desc *uart_desc; |
Mahesh Phalke |
2:7b2b268ea49c | 199 | extern struct no_os_gpio_desc *conv_mon_gpio_desc; |
Mahesh Phalke |
2:7b2b268ea49c | 200 | extern struct no_os_spi_init_param spi_init_params; |
Mahesh Phalke |
2:7b2b268ea49c | 201 | |
Mahesh Phalke |
2:7b2b268ea49c | 202 | int32_t init_system(void); |
Mahesh Phalke |
2:7b2b268ea49c | 203 | |
Mahesh Phalke |
2:7b2b268ea49c | 204 | #endif //_APP_CONFIG_H_ |