DC2100A  1.2.0
Bi-Directional Cell Balancer Using the LTC3300-1 and the LTC6804-2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
LTC3300-1.h
Go to the documentation of this file.
1 /*
2  Linear Technology DC2100A Demonstration Board.
3  API Header File to LTC3300-1 High Efficiency Bidirectional Multicell Battery Balancer.
4  All datasheet references in this file refer to Linear Technology Corp. document 33001fa.pdf.
5 
6  @verbatim
7  The LTC3300-1 is a fault-protected controller IC for
8  transformer-based bidirectional active balancing of multicell
9  battery stacks. All associated gate drive circuitry,
10  precision current sensing, fault detection circuitry and a
11  robust serial interface with built-in watchdog timer are
12  integrated.
13  Each LTC3300-1 can balance up to 6 series-connected battery
14  cells with an input common mode voltage up to 36V.
15  Charge from any selected cell can be transferred at high
16  efficiency to or from 12 or more adjacent cells. A unique
17  level-shifting SPI-compatible serial interface enables
18  multiple LTC3300-1 devices to be connected in series,
19  without opto-couplers or isolators, allowing for balancing
20  of every cell in a long string of series-connected batteries.
21  When multiple LTC3300-1 devices are connected in series
22  they can operate simultaneously, permitting all cells in
23  the stack to be balanced concurrently and independently.
24  Fault protection features include readback capability, cyclic
25  redundancy check (CRC) error detection, maximum
26  on-time volt-second clamps, and overvoltage shutoffs.
27  @endverbatim
28 
29  http://www.linear.com/product/LTC3300
30 
31  http://www.linear.com/product/LTC3300#demoboards
32 
33  REVISION HISTORY
34  $Revision: 693 $
35  $Date: 2014-09-08 13:52:04 -0400 (Mon, 08 Sep 2014) $
36 
37  Copyright (c) 2013, Linear Technology Corp.(LTC)
38  All rights reserved.
39 
40  Redistribution and use in source and binary forms, with or without
41  modification, are permitted provided that the following conditions are met:
42 
43  1. Redistributions of source code must retain the above copyright notice, this
44  list of conditions and the following disclaimer.
45  2. Redistributions in binary form must reproduce the above copyright notice,
46  this list of conditions and the following disclaimer in the documentation
47  and/or other materials provided with the distribution.
48 
49  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
50  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
51  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
52  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
53  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
54  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
55  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
56  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
57  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
58  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
59 
60  The views and conclusions contained in the software and documentation are those
61  of the authors and should not be interpreted as representing official policies,
62  either expressed or implied, of Linear Technology Corp.
63 
64 */
65 
66 /*! @file
67  @ingroup LTC3300-1
68  API Header File for LTC3300-1 High Efficiency Bidirectional Multicell Battery Balancer
69 */
70 
71 #ifndef __LTC3300_H__
72 #define __LTC3300_H__
73 
74 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
75 // Includes
76 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
77 #include "Typedefs.h" // Definition of basic data types
78 
79 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
80 // Definitions
81 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
82 
83 //! @name LTC3300-1 Driver Properties
84 //! @{
85 #define LTC3300_NUM_CELLS 6 //!< Number of cells controlled by one LTC3300
86 #define LTC3300_TWD1 750 //!< in ms, min Watchdog Timer Timeout Period WDT Assertion Measured from Last Valid Command Byte (from datasheet page 5)
87 #define LTC3300_V_SUPPLY_VOLTAGE 6500//!< mV per bit, Minimum supply voltage to ensure LTC3300s can communicate.
88 
89 //! @}
90 
91 //! @name Balancer Control Codes
92 //! @{
93 //! Bit definitions for control codes written to LTC3300 Balance Control Registers.
94 //! Balancer Control Codes specified in datasheet Table 5
95 #define LTC3300_BALANCER_CONTROL_CODE_NONE 0x0 //!< Balancing Action: None
96 #define LTC3300_BALANCER_CONTROL_CODE_DISCHARGE_NONSYNC 0x1 //!< Balancing Action: Discharge Cell n (Nonsynchronous)
97 #define LTC3300_BALANCER_CONTROL_CODE_DISCHARGE_SYNC 0x2 //!< Balancing Action: Discharge Cell n (Synchronous)
98 #define LTC3300_BALANCER_CONTROL_CODE_CHARGE 0x3 //!< Balancing Action: Charge Cell n
99 #define LTC3300_BALANCER_NUM_CONTROL_CODES 0x4 //!< Number of Balancing Actions
100 //! @}
101 
102 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
103 // Global Data
104 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
105 
106 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
107 // Global Prototypes
108 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
109 
110 //! Initializes the LTC3300-1 code module.
111 //! @return void
112 void LTC3300_Init(void);
113 
114 //! Writes the balancer control bits for a number of cells controlled by a chain of LTC3300-1 ICs at a specific logical address.
115 //! Number of ICs in chain is set at compile time by LTC3300_CONFIG_NUM_ICS_PER_ADDRESS.
116 //! Number of cells controlled by chain = LTC3300_CONFIG_NUM_ICS_PER_ADDRESS * LTC3300_NUM_CELLS.
117 //! @return void
118 void LTC3300_Command_Write(int8 board_num, //!< The logical address for the PCB containing these LTC3300-1 ICs.
119  int8* balancer_command_ptr //!< Pointer to array of Balancer Control Bits to write to LTC3300-1 Balancer Command Registers.
120  );
121 
122 //! Reads the balancer control bits for a number of cells controlled by a chain of LTC3300-1 ICs at a specific logical address.
123 //! Number of ICs in chain is set at compile time by LTC3300_CONFIG_NUM_ICS_PER_ADDRESS.
124 //! Number of cells controlled by chain = LTC3300_CONFIG_NUM_ICS_PER_ADDRESS * LTC3300_NUM_CELLS.
125 //! @return void
126 BOOLEAN LTC3300_Command_Read(int8 board_num, //!< The logical address for the PCB containing these LTC3300-1 ICs.
127  int8* balancer_command_ptr //!< Pointer to array where Balancer Control Bits read from LTC3300-1 Balancer Command Registers are to be returned.
128  );
129 
130 //! Reads the status bits for a chain of LTC3300-1 ICs at a specific logical address.
131 //! Number of ICs in chain is set at compile time by LTC3300_CONFIG_NUM_ICS_PER_ADDRESS.
132 //! @return void
133 BOOLEAN LTC3300_Status_Read(int8 board_num, //!< The logical address for the PCB containing these LTC3300-1 ICs.
134  int8* gate_drive_ok, //!< Pointer to array where Gate Drive OK bits read from LTC3300-1 Status Registers are to be returned.
135  int8* cells_ov_ok, //!< Pointer to array where Cells Overvoltage OK bits read from LTC3300-1 Status Registers are to be returned.
136  int8* stack_ov_ok, //!< Pointer to array where Stack Overvoltage OK bits read from LTC3300-1 Status Registers are to be returned.
137  int8* temp_ok //!< Pointer to array where Temperature OK bits read from LTC3300-1 Status Registers are to be returned.
138  );
139 
140 //! Commands a chain of LTC3300s at a specific logical address to execute their balance commands.
141 //! @return void
142 void LTC3300_Execute(int8 board_num //!< The logical address for the PCB containing these LTC3300-1 ICs.
143  );
144 
145 //! Commands a chain of LTC3300s at a specific logical address to suspend their balance commands.
146 //! @return void
147 void LTC3300_Suspend(int8 board_num //!< The logical address for the PCB containing these LTC3300-1 ICs.
148  );
149 
150 //! Sends a benign command to all chains of LTC3300s at all logical addresses to reset their watchdog timers.
151 //! Uses the Read Status command as a benign command that resets the watchdog in the LTC3300 without resulting in a balancing action.
152 //! @return void
153 void LTC3300_Watchdog_Kick(void);
154 
155 //! Sends a raw string of bytes to a chain of LTC3300s at a specific logical address.
156 //! This function is configured by the num_bytes parameter instead of LTC3300_CONFIG_NUM_ICS_PER_ADDRESS.
157 //! It is not recommended to use this function. It primarily exists for the DC2100A GUI to display the raw communication to/from the LTC3300s.
158 //! @return void
159 void LTC3300_Raw_Write(int8 board_num, //!< The logical address for the PCB containing these LTC3300-1 ICs.
160  int8* ltc3300_data, //!< Pointer to the raw bytes to send to the chain of LTC3300-1 ICs.
161  int8 num_bytes //!< The number of raw bytes to send to the chain of LTC3300-1 ICs.
162  );
163 
164 //! Receives a raw string of bytes from a chain of LTC3300s at a specific logical address.
165 //! This function is configured by the num_bytes parameter instead of LTC3300_CONFIG_NUM_ICS_PER_ADDRESS.
166 //! It is not recommended to use this function. It primarily exists for the DC2100A GUI to display the raw communication to/from the LTC3300s.
167 //! @return void
168 void LTC3300_Raw_Read(int8 board_num, //!< The logical address for the PCB containing these LTC3300-1 ICs.
169  int8* ltc3300_data, //!< Pointer to where the raw bytes read from the chain of LTC3300-1 ICs should be stored.
170  int8 num_bytes //!< The number of raw bytes to read from the chain of LTC3300-1 ICs.
171  );
172 
173 #endif
BOOLEAN LTC3300_Command_Read(int8 board_num, int8 *balancer_command_ptr)
Reads the balancer control bits for a number of cells controlled by a chain of LTC3300-1 ICs at a spe...
Definition: LTC3300-1.c:194
void LTC3300_Watchdog_Kick(void)
Sends a benign command to all chains of LTC3300s at all logical addresses to reset their watchdog tim...
Definition: LTC3300-1.c:350
void LTC3300_Execute(int8 board_num)
Commands a chain of LTC3300s at a specific logical address to execute their balance commands...
Definition: LTC3300-1.c:320
void LTC3300_Raw_Write(int8 board_num, int8 *ltc3300_data, int8 num_bytes)
Sends a raw string of bytes to a chain of LTC3300s at a specific logical address. ...
Definition: LTC3300-1.c:364
void LTC3300_Init(void)
Initializes the LTC3300-1 code module.
Definition: LTC3300-1.c:145
BOOLEAN LTC3300_Status_Read(int8 board_num, int8 *gate_drive_ok, int8 *cells_ov_ok, int8 *stack_ov_ok, int8 *temp_ok)
Reads the status bits for a chain of LTC3300-1 ICs at a specific logical address. ...
Definition: LTC3300-1.c:253
void LTC3300_Raw_Read(int8 board_num, int8 *ltc3300_data, int8 num_bytes)
Receives a raw string of bytes from a chain of LTC3300s at a specific logical address.
Definition: LTC3300-1.c:373
void LTC3300_Command_Write(int8 board_num, int8 *balancer_command_ptr)
Writes the balancer control bits for a number of cells controlled by a chain of LTC3300-1 ICs at a sp...
Definition: LTC3300-1.c:151
void LTC3300_Suspend(int8 board_num)
Commands a chain of LTC3300s at a specific logical address to suspend their balance commands...
Definition: LTC3300-1.c:335