| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

LTC4261.h
Go to the documentation of this file.
1 /*!
2 LTC4261: Negative Voltage Hot Swap Controller with ADC and I2C Monitoring
3
4 @verbatim
5
6 The LTC4261/LTC4261-2 negative voltage Hot SwapTM controller allows a board
7 to be safely inserted and removed from a live backplane. Using an external
8 N-channel pass transistor, the board supply voltage can be ramped at an
9 adjustable rate. The devices feature independently adjustable inrush current
10 and overcurrent limits to minimize stresses on the pass transistor during
11 start-up, input step and output short conditions. The LTC4261 defaults
12 to latch-off while the LTC4261-2 defaults to auto-retry on overcurrent faults.
13
14 I2C DATA FORMAT (MSB FIRST):
15
16 Data Out:
17 Byte #1 Byte #2 Byte #3
18
19 START SA6 SA5 SA4 SA3 SA2 SA1 SA0 W SACK C7 C6 C5 C4 C3 C2 C1 C0 SACK D7 D6 D5 D4 D3 D2 D1 D0 SACK STOP
20
21 Data In:
22 Byte #1 Byte #2 Byte #3
23
24 START SA6 SA5 SA4 SA3 SA2 SA1 SA0 W SACK C7 C6 C5 C4 C3 C2 C1 C0 SACK Repeat Start SA6 SA5 SA4 SA3 SA2 SA1 SA0 R SACK
25
26 Byte #4 Byte #5
27 MSB LSB
28 D15 D14 D13 D12 D11 D10 D9 D8 MACK D7 D6 D5 D4 D3 D2 D1 D0 MNACK STOP
29
30 START : I2C Start
31 Repeat Start: I2C Repeat Start
32 STOP : I2C Stop
33 SAx : I2C Address
34 SACK : I2C Slave Generated Acknowledge (Active Low)
35 MACK : I2C Master Generated Acknowledge (Active Low)
36 MNACK : I2C Master Generated Not Acknowledge
37 W : I2C Write (0)
38 R : I2C Read (1)
39 Cx : Command Code
40 Dx : Data Bits
41 X : Don't care
42
43 Example Code:
44
45 Read ADIN and Current Values
46
47 ack |= LTC4261_read_10_bits(LTC4261_I2C_Address, LTC4261_SENSE_MSB_REG, &current_code); // reads current sense ADC
48 ack |= LTC4261_read_10_bits(LTC4261_I2C_Address, LTC4261_ADIN_MSB_REG, &adin_code); // reads ADIN ADC
49 ack |= LTC4261_read_10_bits(LTC4261_I2C_Address, LTC4261_ADIN2_MSB_REG, &adin2_code); // reads ADIN2 ADC
50
51 //convert codes to voltage and current values
52 current = LTC4261_code_to_current(current_code, resitor, current_lsb);
53 adin_voltage = LTC4261_ADIN_code_to_voltage(adin_code, adin_lsb, resisive_ratio);
54 adin2_voltage = LTC4261_ADIN_code_to_voltage(adin2_code, adin_lsb, resisive_ratio);
55
56 @endverbatim
57
58 http://www.linear.com/product/LTC4261
59
60 http://www.linear.com/product/LTC4261#demoboards
61
62
63 Copyright 2018(c) Analog Devices, Inc.
64
65 All rights reserved.
66
67 Redistribution and use in source and binary forms, with or without
68 modification, are permitted provided that the following conditions are met:
69 - Redistributions of source code must retain the above copyright
70 notice, this list of conditions and the following disclaimer.
71 - Redistributions in binary form must reproduce the above copyright
72 notice, this list of conditions and the following disclaimer in
73 the documentation and/or other materials provided with the
74 distribution.
75 - Neither the name of Analog Devices, Inc. nor the names of its
76 contributors may be used to endorse or promote products derived
77 from this software without specific prior written permission.
78 - The use of this software may or may not infringe the patent rights
79 of one or more patent holders. This license does not release you
80 from the requirement that you obtain separate licenses from these
81 patent holders to use this software.
82 - Use of the software either in source or binary form, must be run
83 on or directly connected to an Analog Devices Inc. component.
84
85 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
86 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
87 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
88 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
89 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
90 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
91 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
92 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
93 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
94 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
95 */
96
97 /*! @file
98 @ingroup LTC4261
99 Header for LTC4261: Negative Voltage Hot Swap Controllers with ADC and I2C Monitoring
100 */
101
102 #ifndef LTC4261_H
103 #define LTC4261_H
104
105 #include <Wire.h>
106
107 //! @name LTC4261 Address Assignment
108 //! @{
109 #define LTC4261_I2C_Address 0x10
110 // #define LTC4261_I2C_Address 0x11
111 // #define LTC4261_I2C_Address 0x12
112 // #define LTC4261_I2C_Address 0x13
113 // #define LTC4261_I2C_Address 0x14
114 // #define LTC4261_I2C_Address 0x15
115 // #define LTC4261_I2C_Address 0x16
116 // #define LTC4261_I2C_Address 0x17
117 #define LTC4261_I2C_ALERT_RESPONSE 0x0C
118 #define LTC4261_I2C_MASS_WRITE 0x3E
119 //!@}
120
121 /*! @name LTC4261 Register Addresses
122 @{ */
123 // Register Addresses
124 #define LTC4261_STATUS_REG 0x00
125 #define LTC4261_FAULT_REG 0x01
126 #define LTC4261_ALERT_REG 0x02
127 #define LTC4261_CONTROL_REG 0x03
128 #define LTC4261_SENSE_MSB_REG 0x04
129 #define LTC4261_SENSE_LSB_REG 0x05
130 #define LTC4261_ADIN2_MSB_REG 0x06
131 #define LTC4261_ADIN2_LSB_REG 0x07
132 #define LTC4261_ADIN_MSB_REG 0x08
133 #define LTC4261_ADIN_LSB_REG 0x09
134 //!@}
135
136 /*! @name Command Codes
137 @{ */
138 #define LTC4261_PGIO_POWER_GOODX 0x00
139 #define LTC4261_PGIO_POWER_GOOD 0x80
140 #define LTC4261_PGIO_GENERAL_PURPOSE_OUTPUT 0x40
141 #define LTC4261_PGIO_GENERAL_PURPOSE_INPUT 0xC0
142
143 #define LTC4261_TEST_MODE_ENABLE 0x20
144 #define LTC4261_TEST_MODE_DISABLE 0xDF
145
146 #define LTC4261_POWER_BAD_AUTO_RETRY_ENABLE 0x10
147 #define LTC4261_POWER_BAD_AUTO_RETRY_DISABLE 0xEF
148
149 #define LTC4261_FET_ON 0x08
150 #define LTC4261_FET_OFF 0xF7
151
152 #define LTC4261_OVERCURRENT_AUTO_RETRY_ENABLE 0x04
153 #define LTC4261_OVERCURRENT_AUTO_RETRY_DISABLE 0xFB
154
155 #define LTC4261_UNDERVOLTAGE_AUTO_RETRY_ENABLE 0x02
156 #define LTC4261_UNDERVOLTAGE_AUTO_RETRY_DISABLE 0xFD
157
158 #define LTC4261_OVERVOLTAGE_AUTO_RETRY_ENABLE 0x01
159 #define LTC4261_OVERVOLTAGE_AUTO_RETRY_DISABLE 0xFE
160 //!@}
161
162 /*! @name Fault Codes
163 @{ */
164 #define LTC4261_EXTERNAL_FAULT 0x80
165 #define LTC4261_PGIO_INPUT_HIGH 0x40
166 #define LTC4261_FET_SHORT_FAULT 0x20
167 #define LTC4261_EN_STATE_CHANGE 0x10
168 #define LTC4261_POWER_BAD_FAULT 0x08
169 #define LTC4261_OVERCURRENT_FAULT 0x04
170 #define LTC4261_UNDERVOLTAGE_FAULT 0x02
171 #define LTC4261_OVERVOLTAGE_FAULT 0x01
172 //!@}
173
174 /*! @name Alert Codes
175 @{ */
176 #define LTC4261_EXTERNAL_FAULT_ENABLE 0x80
177 #define LTC4261_EXTERNAL_FAULT_DISABLE 0x7F
178 #define LTC4261_PGIO_OUTPUT_ENABLE 0x40
179 #define LTC4261_PGIO_OUTPUT_DISABLE 0xBF
180 #define LTC4261_FET_SHORT_ENABLE 0x20
181 #define LTC4261_FET_SHORT_DISABLE 0xDF
182 #define LTC4261_EN_STATE_ENABLE 0x10
183 #define LTC4261_EN_STATE_DISABLE 0xEF
184 #define LTC4261_POWER_BAD_ENABLE 0x08
185 #define LTC4261_POWER_BAD_DISABLE 0xF7
186 #define LTC4261_OVERCURRENT_ENABLE 0x04
187 #define LTC4261_OVERCURRENT_DISABLE 0xFB
188 #define LTC4261_UNDERVOLTAGE_ENABLE 0x02
189 #define LTC4261_UNDERVOLTAGE_DISABLE 0xFD
190 #define LTC4261_OVERVOLTAGE_ENABLE 0x01
191 #define LTC4261_OVERVOLTAGE_DISABLE 0xFE
192 //!@}
193
194 //! Write an 8-bit code to the LTC4261.
195 //! @return The function returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
196 int8_t LTC4261_write(uint8_t i2c_address, //!< I2C Address for the LTC4261
197 uint8_t command, //!< The "command byte" for the LTC4261 that corresponds to register address
198 uint8_t code //!< Value that will be written to the register
199 );
200
201 //! Reads an 8-bit adc_code from LTC4261
202 //! @return The function returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
203 int8_t LTC4261_read(uint8_t i2c_address, //!< I2C Address for the LTC4261
204 uint8_t command, //!< The "command byte" for the LTC4261 that corresponds to register address
205 uint8_t *code //!< Value that will be read from the register
206 );
207
208 //! Reads a 10-bit adc_code from LTC4261
209 //! @return The function returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
210 int8_t LTC4261_read_10_bits(uint8_t i2c_address, //!< I2C Address for the LTC4261
211 uint8_t adc_command, //!< The "command byte" for the LTC4261 that corresponds to register address
212 uint16_t *adc_code //!< Value that will be read from the register.
213 );
214
215 //! SMBus Alert Response Protocol: Sends an alert response command and releases /ALERT pin. LTC4261 responds with its address
216 //! @return The function returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
217 int8_t LTC4261_ARA(uint8_t alert_response_address, //!< the Alert Response Address on the I2C bus
218 uint8_t *i2c_address //!< the address of the alert source
219 );
220
221 //! Calculate the LTC4261 ADIN voltage
222 //! @return Returns the ADIN Voltage in Volts
223 float LTC4261_ADIN_code_to_voltage(uint16_t adc_code, //!< The ADC value
224 float LTC4261_ADIN_lsb, //!< ADIN lsb weight
225 float resistor_divider_ratio //!< the ratio that the voltages have been divided down
226 );
227 //! Calculate the LTC4261 current with a sense resistor
228 //! @return The LTC4261 sense current
229 float LTC4261_code_to_current(uint16_t adc_code, //!< The ADC value
230 float resistor, //!< The resistor value
231 float LTC4261_DELTA_SENSE_lsb //!< Delta sense lsb weight
232 );
233 #endif // LTC4261_H
i2c_address
uint8_t i2c_address
adc_command
static uint8_t adc_command
Definition: DC2071AA.ino:111
LTC4261_read_10_bits
int8_t LTC4261_read_10_bits(uint8_t i2c_address, uint8_t adc_command, uint16_t *adc_code)
Reads a 10-bit adc_code from LTC4261.
Definition: LTC4261.cpp:91
resistor
const float resistor
resistor value on demo board
Definition: DC1496BB.ino:116
LTC4261_read
int8_t LTC4261_read(uint8_t i2c_address, uint8_t command, uint8_t *code)
Reads an 8-bit adc_code from LTC4261.
Definition: LTC4261.cpp:82
LTC4261_ARA
int8_t LTC4261_ARA(uint8_t alert_response_address, uint8_t *i2c_address)
SMBus Alert Response Protocol: Sends an alert response command and releases /ALERT pin...
Definition: LTC4261.cpp:102
LTC4261_ADIN_code_to_voltage
float LTC4261_ADIN_code_to_voltage(uint16_t adc_code, float LTC4261_ADIN_lsb, float resistor_divider_ratio)
Calculate the LTC4261 ADIN voltage.
Definition: LTC4261.cpp:110
LTC4261_write
int8_t LTC4261_write(uint8_t i2c_address, uint8_t command, uint8_t code)
Write an 8-bit code to the LTC4261.
Definition: LTC4261.cpp:73
adc_code
static uint32_t adc_code
Definition: DC2071AA.ino:113
LTC4261_code_to_current
float LTC4261_code_to_current(uint16_t adc_code, float resistor, float LTC4261_DELTA_SENSE_lsb)
Calculate the LTC4261 current with a sense resistor.
Definition: LTC4261.cpp:119