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_Config.h
Go to the documentation of this file.
1 /*
2  Linear Technology DC2100A Demonstration Board.
3  Driver Configuration Header File for LTC3300-1 High Efficiency Bidirectional Multicell Battery Balancer.
4  This file configures the interface of the LTC3300-1 Driver to the hardware in which it's used.
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: 692 $
35  $Date: 2014-09-08 11:51:35 -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  Driver Configuration Header File for LTC3300-1 High Efficiency Bidirectional Multicell Battery Balancer
69 */
70 
71 #ifndef __LTC3300_CONFIG_H__
72 #define __LTC3300_CONFIG_H__
73 
74 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
75 // Includes
76 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
77 #include "DC2100A.h" // HW definition for Board
78 #include "LTC6804-2.h" // Interface for LTC3300s on DC2100A is through LTC6804-2
79 #include "Error.h" // Errors are reported through Error Handler Task
80 
81 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
82 // Definitions
83 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
84 
85 //! Configures the number of LTC3300-1 ICs in a chain at each logical address.
86 #define LTC3300_CONFIG_NUM_ICS_PER_ADDRESS DC2100A_NUM_LTC3300
87 
88 //! Configures interface through which LTC3300-1 driver module sends SPI bytes to a chain of LTC3300-1 ICs.
89 //! - Parameters
90 //! + address: The logical address for the PCB containing these LTC3300-1 ICs.
91 //! + data_ptr: Pointer to LTC3300-1 bytes to be written via SPI.
92 //! + num_bytes: Number of bytes to be written via SPI.
93 //! + baud_khz: The baud rate of the SPI communication in kHz.
94 //! - Usage Examples
95 //! + If communication is through an LTC6804-2, this macro would call the LTC6804-2 driver's SPI Write function.
96 //! + If communication is direct from the microcontroller, this macro would call the microcontroller's SPI Write function.
97 #define LTC3300_CONFIG_SPI_WRITE(address, data_ptr, num_bytes, baud_khz) \
98  LTC6804_SPI_Write(address, TRUE, TRUE, data_ptr, num_bytes, baud_khz)
99 
100 //! Configures interface through which LTC3300-1 driver module receives SPI bytes from a chain of LTC3300-1 ICs.
101 //! - Parameters
102 //! + address: The logical address for the PCB containing these LTC3300-1 ICs.
103 //! + data_ptr: Pointer to where LTC3300-1 bytes read via SPI will be written.
104 //! + num_bytes: Number of bytes to be read via SPI.
105 //! + baud_khz: The baud rate of the SPI communication in kHz.
106 //! - Usage Examples
107 //! + Example 1: If communication is through an LTC6804-2, this macro would call the LTC6804-2 driver's SPI Read function.
108 //! + Example 2: If communication is direct from the microcontroller, this macro would call the microcontroller's SPI Read function.
109 #define LTC3300_CONFIG_SPI_READ(address, data_ptr, num_bytes, baud_khz) \
110  LTC6804_SPI_Read(address, TRUE, TRUE, data_ptr, num_bytes, baud_khz)
111 
112 //! Configures interface through which LTC3300-1 driver module reports its CRC errors.
113 //! - Parameters
114 //! + address: The logical address for the PCB containing these LTC3300-1 ICs.
115 //! + data_ptr: Pointer to bytes read from LTC3300-1.
116 //! + num_bytes: Number of bytes read from LTC3300-1.
117 //! - Usage Examples
118 //! + Example 1: If DC2100A Error.c/.h code module is defined for a system, framing the data and passing to that error reporting module would be here.
119 //! + Example 2: if stdout is defined for a system, this macro would format the data into a printf() statement.
120 //! + Example 3: If LTC3300-1 CRC errors are to be ignored, this macro could be defined as blank.
121 #define LTC3300_CONFIG_ERROR_CRC(address, ic_num, command, data_ptr, num_bytes) \
122  { \
123  int8 temp_data[ERROR_DATA_SIZE]; \
124  int8 byte_num; \
125  temp_data[0] = address; \
126  temp_data[1] = ic_num; \
127  temp_data[2] = command; \
128  for (byte_num = 3; byte_num < MIN(num_bytes + 2, ERROR_DATA_SIZE); byte_num++) \
129  { \
130  temp_data[byte_num] = data_ptr[byte_num - 2]; \
131  } \
132  Error_Data_Set(ERROR_CODE_LTC3300_CRC, temp_data, num_bytes + 2); \
133  }
134 
135 
136 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
137 // Global Data
138 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
139 
140 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
141 // Global Prototypes
142 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
143 
144 #endif
API Header File for LTC6804-2 Multicell Battery Monitors.