| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

LTC2970.h
Go to the documentation of this file.
1 /*!
2 LTC2970: Dual I2C Power Supply Monitor and Margining Controller
3
4 @verbatim
5
6 The LTC2970 is a dual-channel power supply monitor and margining controller.
7 It has monitors two voltage and two current channels using an on-board, highly-accurate 14-bit delta-sigma ADC.
8 It can monitor for overvoltage and over-current faults on both channels, and assert ALERT when a fault is detected.
9 Two independent DAC outputs can control each power regulator for accurate voltage margining.
10 It has an I2C/SMBus interface to read and write the on-board configuration and status registers.
11
12 @endverbatim
13
14 http://www.linear.com/product/LTC2970
15
16 http://www.linear.com/demo/#demoboards
17
18
19 Copyright 2018(c) Analog Devices, Inc.
20
21 All rights reserved.
22
23 Redistribution and use in source and binary forms, with or without
24 modification, are permitted provided that the following conditions are met:
25 - Redistributions of source code must retain the above copyright
26 notice, this list of conditions and the following disclaimer.
27 - Redistributions in binary form must reproduce the above copyright
28 notice, this list of conditions and the following disclaimer in
29 the documentation and/or other materials provided with the
30 distribution.
31 - Neither the name of Analog Devices, Inc. nor the names of its
32 contributors may be used to endorse or promote products derived
33 from this software without specific prior written permission.
34 - The use of this software may or may not infringe the patent rights
35 of one or more patent holders. This license does not release you
36 from the requirement that you obtain separate licenses from these
37 patent holders to use this software.
38 - Use of the software either in source or binary form, must be run
39 on or directly connected to an Analog Devices Inc. component.
40
41 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
42 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
43 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
44 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
45 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
46 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
47 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
48 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
49 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
50 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51 */
52
53 //! @ingroup Power_System_Management
54 //! @{
55 //! @defgroup LTC2970 LTC2970: Dual I2C Power Supply Monitor and Margining Controller
56 //! @}
57
58 /*! @file
59 @ingroup LTC2970
60 Header for LTC2970: Dual I2C Power Supply Monitor and Margining Controller
61
62 */
63
64 #include <Arduino.h>
65 #include "LT_SMBusNoPec.h"
66
67 #ifndef LTC2970_h
68 #define LTC2970_h
69
70 /*DEVICE I2C ADDRESSES (7-bit)*/
71 // GLOBAL ADDRESS
72 #define LTC2970_I2C_GLOBAL_ADDRESS 0x5B
73 #define LTC2970_I2C_ARA_ADDRESS 0x0C
74
75 /********************************************************************************/
76 //! @name LTC2970 command address definitions
77 //! NOTE: commands prefixed with LTC2970_1_ are for the LTC2970-1 only
78
79 #define LTC2970_FAULT 0x00
80 // 0x01
81 // ...
82 // 0x07
83 #define LTC2970_FAULT_EN 0x08
84 // 0x09
85 #define LTC2970_FAULT_LA_INDEX 0x10
86 #define LTC2970_FAULT_LA 0x11
87 // 0x12
88 // ...
89 // 0x16
90 #define LTC2970_IO 0x17
91 #define LTC2970_ADC_MON 0x18
92 // 0x19
93 // ...
94 // 0x1E
95 #define LTC2970_1_SYNC 0x1F
96 // 0x20
97 // ...
98 // 0x27
99 #define LTC2970_VDD_ADC 0x28
100 #define LTC2970_VDD_OV 0x29
101 #define LTC2970_VDD_UV 0x2A
102 // 0x2B
103 // ...
104 // 0x37
105 #define LTC2970_V12_ADC 0x38
106 #define LTC2970_V12_OV 0x39
107 #define LTC2970_V12_UV 0x3A
108 // 0x3B
109 // ...
110 // 0x3F
111 #define LTC2970_CH0_A_ADC 0x40
112 #define LTC2970_CH0_A_OV 0x41
113 #define LTC2970_CH0_A_UV 0x42
114 #define LTC2970_CH0_A_SERVO 0x43
115 #define LTC2970_CH0_A_IDAC 0x44
116 #define LTC2970_1_CH0_A_IDAC_TRACK 0x45
117 #define LTC2970_1_CH0_A_DELAY_TRACK 0x46
118 // 0x47
119 #define LTC2970_CH0_B_ADC 0x48
120 #define LTC2970_CH0_B_OV 0x49
121 #define LTC2970_CH0_B_UV 0x4A
122 // 0x4B
123 // ...
124 // 0x4F
125 #define LTC2970_CH1_A_ADC 0x50
126 #define LTC2970_CH1_A_OV 0x51
127 #define LTC2970_CH1_A_UV 0x52
128 #define LTC2970_CH1_A_SERVO 0x53
129 #define LTC2970_CH1_A_IDAC 0x54
130 #define LTC2970_1_CH1_A_IDAC_TRACK 0x55
131 #define LTC2970_1_CH1_A_DELAY_TRACK 0x56
132 // 0x55
133 // ...
134 // 0x57
135 #define LTC2970_CH1_B_ADC 0x58
136 #define LTC2970_CH1_B_OV 0x59
137 #define LTC2970_CH1_B_UV 0x5A
138 // 0x5B
139 // ...
140 // 0x67
141 #define LTC2970_TEMP_ADC 0x68
142
143 //! @}
144
145
146
147 ///////////////////////////////////// FUNCTIONS /////////////////////////////////
148
149 //! Set GPIO_n high
150 //! @return void
151 void ltc2970_gpio_up(LT_SMBus *smbus, uint8_t ltc2970_i2c_address, int gpio_number);
152
153
154 //! Set GPIO_n low
155 //! @return void
156 void ltc2970_gpio_down(LT_SMBus *smbus, uint8_t ltc2970_i2c_address, int gpio_number);
157
158 //! Disconnect a DAC from its channel
159 //! @return void
160 void ltc2970_dac_disconnect(LT_SMBus *smbus, uint8_t ltc2970_i2c_address, int dac_number);
161
162 //! Unceremoniously connect DAC0 to the control node
163 //! no attempt to equalize voltages
164 //! @return void
165 void ltc2970_hard_connect_dac(LT_SMBus *smbus, uint8_t ltc2970_i2c_address, int dac_number, uint8_t dac_value_8);
166
167 //! soft-connect DACn to its controlled node
168 //! @return int
169 int ltc2970_soft_connect_dac(LT_SMBus *smbus, uint8_t ltc2970_i2c_address, int dac_number);
170
171 //! Servo once to a given ADC value
172 //! @return void
173 void ltc2970_servo_to_adc_val(LT_SMBus *smbus, uint8_t ltc2970_i2c_address, int channel_number, uint16_t code);
174
175 //! Prints die temperature on the LTC2970
176 //! @return void
177 void ltc2970_print_die_temp (LT_SMBus *smbus, uint8_t ltc2970_i2c_address);
178
179 //! Read FAULT, FAULT_LA, and FAULT_LA_INDEX registers
180 //! print the results
181 //! @return void
182 void ltc2970_read_faults(LT_SMBus *smbus, uint8_t ltc2970_i2c_address);
183
184
185
186 #endif
ltc2970_read_faults
void ltc2970_read_faults(LT_SMBus *smbus, uint8_t ltc2970_i2c_address)
Read FAULT, FAULT_LA, and FAULT_LA_INDEX registers print the results.
Definition: LTC2970.cpp:289
ltc2970_print_die_temp
void ltc2970_print_die_temp(LT_SMBus *smbus, uint8_t ltc2970_i2c_address)
Prints die temperature on the LTC2970.
Definition: LTC2970.cpp:265
ltc2970_servo_to_adc_val
void ltc2970_servo_to_adc_val(LT_SMBus *smbus, uint8_t ltc2970_i2c_address, int channel_number, uint16_t code)
Servo once to a given ADC value.
Definition: LTC2970.cpp:227
ltc2970_soft_connect_dac
int ltc2970_soft_connect_dac(LT_SMBus *smbus, uint8_t ltc2970_i2c_address, int dac_number)
soft-connect DACn to its controlled node
Definition: LTC2970.cpp:114
smbus
LT_SMBusGroup * smbus
Definition: retention.ino:139
LT_SMBus
Definition: LT_SMBus.h:61
ltc2970_hard_connect_dac
void ltc2970_hard_connect_dac(LT_SMBus *smbus, uint8_t ltc2970_i2c_address, int dac_number, uint8_t dac_value_8)
Unceremoniously connect DAC0 to the control node no attempt to equalize voltages. ...
Definition: LTC2970.cpp:82
ltc2970_i2c_address
static uint8_t ltc2970_i2c_address
Definition: DC2467.ino:69
ltc2970_gpio_up
void ltc2970_gpio_up(LT_SMBus *smbus, uint8_t ltc2970_i2c_address, int gpio_number)
Set GPIO_n high.
Definition: LTC2970.cpp:5
ltc2970_dac_disconnect
void ltc2970_dac_disconnect(LT_SMBus *smbus, uint8_t ltc2970_i2c_address, int dac_number)
Disconnect a DAC from its channel.
Definition: LTC2970.cpp:51
ltc2970_gpio_down
void ltc2970_gpio_down(LT_SMBus *smbus, uint8_t ltc2970_i2c_address, int gpio_number)
Set GPIO_n low.
Definition: LTC2970.cpp:28
LT_SMBusNoPec.h
LTC SMBus Support: Implementation for a shared SMBus layer.