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

Driver File for LTC3300-1 High Efficiency Bidirectional Multicell Battery Balancer. More...

Go to the source code of this file.

Detailed Description

Driver File for LTC3300-1 High Efficiency Bidirectional Multicell Battery Balancer.

Definition in file LTC3300-1.c.

Functions

unsigned int8 ltc3300_crc_calc (int8 *ltc3300_data)
 
BOOLEAN ltc3300_crc_check (int8 *ltc3300_data)
 
void LTC3300_Init (void)
 Initializes the LTC3300-1 code module. More...
 
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 specific logical address. More...
 
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 specific logical address. More...
 
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. More...
 
void LTC3300_Execute (int8 board_num)
 Commands a chain of LTC3300s at a specific logical address to execute their balance commands. More...
 
void LTC3300_Suspend (int8 board_num)
 Commands a chain of LTC3300s at a specific logical address to suspend their balance commands. More...
 
void LTC3300_Watchdog_Kick (void)
 Sends a benign command to all chains of LTC3300s at all logical addresses to reset their watchdog timers. More...
 
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. More...
 
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. More...
 
unsigned int8 ltc3300_crc_calc (int *ltc3300_data)
 
BOOLEAN ltc3300_crc_check (int *ltc3300_data)
 

Macros

#define LTC3300_COMMAND_SIZE   sizeof(int8)
 
#define LTC3300_COMMAND(address, cmd, parity)   ((address << 3) + (cmd <<1) + parity)
 
#define LTC3300_ADDRESS   0x15
 
#define LTC3300_COMMAND_BALANCE_WRITE   LTC3300_COMMAND(LTC3300_ADDRESS, 0x0 ,1)
 
#define LTC3300_COMMAND_BALANCE_READ   LTC3300_COMMAND(LTC3300_ADDRESS, 0x1 ,0)
 
#define LTC3300_COMMAND_STATUS_READ   LTC3300_COMMAND(LTC3300_ADDRESS, 0x2 ,0)
 
#define LTC3300_COMMAND_EXECUTE   LTC3300_COMMAND(LTC3300_ADDRESS, 0x3 ,1)
 
#define LTC3300_COMMAND_SUSPEND   LTC3300_COMMAND(LTC3300_ADDRESS, 0x3 ,0)
 
#define LTC3300_REGISTER_SIZE   sizeof(int16)
 
#define LTC3300_CRC_SIZE   4
 
#define LTC3300_REGISTER_BITS   (LTC3300_REGISTER_SIZE*BITS_PER_BYTE - LTC3300_CRC_SIZE)
 
#define LTC3300_BALANCER_CONTROL_SIZE   2
 
#define LTC3300_BALANCER_CONTROL_MASK   ((1 << LTC3300_BALANCER_CONTROL_SIZE) - 1)
 
#define LTC3300_STATUS_GATE_DRIVE_OK_SIZE   LTC3300_NUM_CELLS
 
#define LTC3300_STATUS_GATE_DRIVE_OK_POSITION   10
 
#define LTC3300_STATUS_GATE_DRIVE_OK_MASK   MASK(LTC3300_STATUS_GATE_DRIVE_OK_SIZE, LTC3300_STATUS_GATE_DRIVE_OK_POSITION)
 
#define LTC3300_STATUS_CELLS_NOT_OV_SIZE   1
 
#define LTC3300_STATUS_CELLS_NOT_OV_POSITION   8
 
#define LTC3300_STATUS_CELLS_NOT_OV_MASK   MASK(LTC3300_STATUS_CELLS_NOT_OV_SIZE, LTC3300_STATUS_CELLS_NOT_OV_POSITION)
 
#define LTC3300_STATUS_STACK_NOT_OV_SIZE   2
 
#define LTC3300_STATUS_STACK_NOT_OV_POSITION   8
 
#define LTC3300_STATUS_STACK_NOT_OV_MASK   MASK(LTC3300_STATUS_STACK_NOT_OV_SIZE, LTC3300_STATUS_STACK_NOT_OV_POSITION)
 
#define LTC3300_STATUS_TEMP_OK_SIZE   1
 
#define LTC3300_STATUS_TEMP_OK_POSITION   7
 
#define LTC3300_STATUS_TEMP_OK_MASK   MASK(LTC3300_STATUS_TEMP_OK_SIZE, LTC3300_STATUS_TEMP_OK_POSITION)
 
#define LTC3300_BAUD_RATE   1000
 

Variables

const unsigned int8 ltc3300_crc_table [1<< BITS_PER_NIBBLE]
 

Function Documentation

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 specific logical address.

Number of ICs in chain is set at compile time by LTC3300_CONFIG_NUM_ICS_PER_ADDRESS. Number of cells controlled by chain = LTC3300_CONFIG_NUM_ICS_PER_ADDRESS * LTC3300_NUM_CELLS.

Returns
void
Parameters
board_numThe logical address for the PCB containing these LTC3300-1 ICs.
balancer_command_ptrPointer to array where Balancer Control Bits read from LTC3300-1 Balancer Command Registers are to be returned.

Definition at line 194 of file LTC3300-1.c.

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 specific logical address.

Number of ICs in chain is set at compile time by LTC3300_CONFIG_NUM_ICS_PER_ADDRESS. Number of cells controlled by chain = LTC3300_CONFIG_NUM_ICS_PER_ADDRESS * LTC3300_NUM_CELLS.

Returns
void
Parameters
board_numThe logical address for the PCB containing these LTC3300-1 ICs.
balancer_command_ptrPointer to array of Balancer Control Bits to write to LTC3300-1 Balancer Command Registers.

Definition at line 151 of file LTC3300-1.c.

void LTC3300_Execute ( int8  board_num)

Commands a chain of LTC3300s at a specific logical address to execute their balance commands.

Returns
void
Parameters
board_numThe logical address for the PCB containing these LTC3300-1 ICs.

Definition at line 320 of file LTC3300-1.c.

void LTC3300_Init ( void  )

Initializes the LTC3300-1 code module.

Returns
void

Definition at line 145 of file LTC3300-1.c.

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.

This function is configured by the num_bytes parameter instead of LTC3300_CONFIG_NUM_ICS_PER_ADDRESS. It is not recommended to use this function. It primarily exists for the DC2100A GUI to display the raw communication to/from the LTC3300s.

Returns
void
Parameters
board_numThe logical address for the PCB containing these LTC3300-1 ICs.
ltc3300_dataPointer to where the raw bytes read from the chain of LTC3300-1 ICs should be stored.
num_bytesThe number of raw bytes to read from the chain of LTC3300-1 ICs.

Definition at line 373 of file LTC3300-1.c.

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.

This function is configured by the num_bytes parameter instead of LTC3300_CONFIG_NUM_ICS_PER_ADDRESS. It is not recommended to use this function. It primarily exists for the DC2100A GUI to display the raw communication to/from the LTC3300s.

Returns
void
Parameters
board_numThe logical address for the PCB containing these LTC3300-1 ICs.
ltc3300_dataPointer to the raw bytes to send to the chain of LTC3300-1 ICs.
num_bytesThe number of raw bytes to send to the chain of LTC3300-1 ICs.

Definition at line 364 of file LTC3300-1.c.

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.

Number of ICs in chain is set at compile time by LTC3300_CONFIG_NUM_ICS_PER_ADDRESS.

Returns
void
Parameters
board_numThe logical address for the PCB containing these LTC3300-1 ICs.
gate_drive_okPointer to array where Gate Drive OK bits read from LTC3300-1 Status Registers are to be returned.
cells_ov_okPointer to array where Cells Overvoltage OK bits read from LTC3300-1 Status Registers are to be returned.
stack_ov_okPointer to array where Stack Overvoltage OK bits read from LTC3300-1 Status Registers are to be returned.
temp_okPointer to array where Temperature OK bits read from LTC3300-1 Status Registers are to be returned.

Definition at line 253 of file LTC3300-1.c.

void LTC3300_Suspend ( int8  board_num)

Commands a chain of LTC3300s at a specific logical address to suspend their balance commands.

Returns
void
Parameters
board_numThe logical address for the PCB containing these LTC3300-1 ICs.

Definition at line 335 of file LTC3300-1.c.

void LTC3300_Watchdog_Kick ( void  )

Sends a benign command to all chains of LTC3300s at all logical addresses to reset their watchdog timers.

Uses the Read Status command as a benign command that resets the watchdog in the LTC3300 without resulting in a balancing action.

Returns
void

Definition at line 350 of file LTC3300-1.c.

Variable Documentation

const unsigned int8 ltc3300_crc_table[1<< BITS_PER_NIBBLE]
Initial value:
= {0x00, 0x13, 0x26, 0x35, 0x4C, 0x5F, 0x6A, 0x79,
0x9B, 0x88, 0xBD, 0xAE, 0xD7, 0xC4, 0xF1, 0xE2}

Definition at line 131 of file LTC3300-1.c.