MSP430UltrasonicLibrary  02_20_00_15
ussSwLibCalibration.h
Go to the documentation of this file.
1 #ifndef _USSSWLIBCALIBRATION_H_
2 #define _USSSWLIBCALIBRATION_H_
3 
4 //#############################################################################
5 //
10 //
11 // Group: MSP
12 // Target Device: Banshee
13 //
14 // (C) Copyright 2015, Texas Instruments, Inc.
15 //#############################################################################
16 // TI Release: __PRODUCT_NAME__
17 // Release Date: __PACKAGE_RELEASE_DATE__
18 //#############################################################################
19 
20 
21 //*****************************************************************************
22 // includes
23 //*****************************************************************************
24 #include <msp430.h>
25 #include <stdint.h>
26 #include <stdbool.h>
27 #include "ussSwLib.h"
28 #include <math.h>
34 
35 
36 
37 //*****************************************************************************
40 //*****************************************************************************
41 
42 #ifdef __cplusplus
43 
44 extern "C" {
45 #endif
46 
47 //*****************************************************************************
48 // defines
49 //*****************************************************************************
50 
51 // Number of iterations used for averaging = 2^(RESONATOR_CALIB_ITERATION_COUNT)
52 // If RESONATOR_CALIB_ITERATION_COUNT == 0, Number of iterations used for
53 // averaging = 1.
54 // If RESONATOR_CALIB_ITERATION_COUNT == 1, Number of iterations used for
55 // averaging = 2
56 //
57 // Minimum value = 0
58 // Maximum value = 10
59 #define RESONATOR_CALIB_ITERATION_COUNT 2
60 
61 // Number of ACLK cycles to monitor SAPH ASQCLK.
62 // Minimum value = 1
63 // Maximum value = 3000
64 #define RESONATOR_CALIB_MONITORING_ACLK 550
65 
66 
67 #define AGC_LOOP_MAX_ITERATIONS 5
68 #define AGC_LOOP_SETTLING 3
69 #define ADC_MINIMUM_GAIN_SETTING USS_Capture_Gain_Range_minus_6_5
70 #define AGC_GAIN_TABLE_SIZE (47*2)
71 #define AGC_INDEX_OFFSET 17
72 #define AGC_MIN_DIFFERENCE 1.0
73 
74 
75 // Advanced / Derived parameters
76 // Number of ACLK cycles need to guarantee MSP will go to LPM
77 // minimum = 2 (recommended)
78 // maximum = 20
79 #define RESONATOR_CALIB_MONITORING_ACLK_MIN_COUNT 4
80 
81 #define PLL_68_MHZ_TEMP_CONST (uint64_t)((uint64_t)68000000* \
82  (uint64_t)RESONATOR_CALIB_MONITORING_ACLK)
83 #define PLL_69_MHZ_TEMP_CONST (uint64_t)((uint64_t)69000000* \
84  (uint64_t)RESONATOR_CALIB_MONITORING_ACLK)
85 #define PLL_70_MHZ_TEMP_CONST (uint64_t)((uint64_t)70000000* \
86  (uint64_t)RESONATOR_CALIB_MONITORING_ACLK)
87 #define PLL_71_MHZ_TEMP_CONST (uint64_t)((uint64_t)71000000* \
88  (uint64_t)RESONATOR_CALIB_MONITORING_ACLK)
89 #define PLL_72_MHZ_TEMP_CONST (uint64_t)((uint64_t)72000000* \
90  (uint64_t)RESONATOR_CALIB_MONITORING_ACLK)
91 #define PLL_73_MHZ_TEMP_CONST (uint64_t)((uint64_t)73000000* \
92  (uint64_t)RESONATOR_CALIB_MONITORING_ACLK)
93 #define PLL_74_MHZ_TEMP_CONST (uint64_t)((uint64_t)74000000* \
94  (uint64_t)RESONATOR_CALIB_MONITORING_ACLK)
95 #define PLL_75_MHZ_TEMP_CONST (uint64_t)((uint64_t)75000000* \
96  (uint64_t)RESONATOR_CALIB_MONITORING_ACLK)
97 #define PLL_76_MHZ_TEMP_CONST (uint64_t)((uint64_t)76000000* \
98  (uint64_t)RESONATOR_CALIB_MONITORING_ACLK)
99 #define PLL_77_MHZ_TEMP_CONST (uint64_t)((uint64_t)77000000* \
100  (uint64_t)RESONATOR_CALIB_MONITORING_ACLK)
101 #define PLL_78_MHZ_TEMP_CONST (uint64_t)((uint64_t)78000000* \
102  (uint64_t)RESONATOR_CALIB_MONITORING_ACLK)
103 #define PLL_79_MHZ_TEMP_CONST (uint64_t)((uint64_t)79000000* \
104  (uint64_t)RESONATOR_CALIB_MONITORING_ACLK)
105 #define PLL_80_MHZ_TEMP_CONST (uint64_t)((uint64_t)80000000* \
106  (uint64_t)RESONATOR_CALIB_MONITORING_ACLK)
107 
108 #define ABSTOF_DTOF_MAX_ITERATIONS 64999
109 
110 //*****************************************************************************
111 // typedefs
112 //*****************************************************************************
113 
114 
115 //*****************************************************************************
116 // globals
117 //*****************************************************************************
118 // Contains pairs of (USS Capture Gain setting,the corresponding dB value)
120 {
121  17,-6.5,
122  18,-5.5,
123  19,-4.6,
124  20,-4.1,
125  21,-3.3,
126  22,-2.3,
127  23,-1.4,
128  24,-0.8,
129  25,0.1,
130  26,1,
131  27,1.9,
132  28,2.6,
133  29,3.5,
134  30,4.4,
135  31,5.2,
136  32,6,
137  33,6.8,
138  34,7.7,
139  35,8.7,
140  36,9,
141  37,9.8,
142  38,10.7,
143  39,11.7,
144  40,12.2,
145  41,13,
146  42,13.9,
147  43,14.9,
148  44,15.5,
149  45,16.3,
150  46,17.2,
151  47,18.2,
152  48,18.8,
153  49,19.6,
154  50,20.5,
155  51,21.5,
156  52,22,
157  53,22.8,
158  54,23.6,
159  55,24.6,
160  56,25,
161  57,25.8,
162  58,26.7,
163  59,27.7,
164  60,28.1,
165  61,28.9,
166  62,29.9,
167  63,30.8
168 };
169 
170 //*****************************************************************************
171 // the function prototypes
172 //*****************************************************************************
173 static float USS_findAGCIndex(int8_t leftIndex, int8_t rightIndex, float tempGain);
174 
175 #ifdef __cplusplus
176 }
177 #endif // extern "C"
178 
179 
180 #endif // end of _USSSWLIBCALIBRATION_H_ definition
#define AGC_GAIN_TABLE_SIZE
Definition: ussSwLibCalibration.h:70
float USS_findAGCIndex(int8_t leftIndex, int8_t rightIndex, float tempGain)
Definition: ussSwLibCalibration.c:221
Contains all USS SW Library enums, structs, macros, function and global variables definitions...
const float gUSSGainLookUp[AGC_GAIN_TABLE_SIZE]
Definition: ussSwLibCalibration.h:119
© Copyright 1995-2018, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale