| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

Functions | Variables
DC1651A.ino File Reference
Battery Management System (BMS) » LTC6803-1: Multicell Battery Monitor

Linear Technology DC1651A Demonstration Board. More...

## Detailed Description

Linear Technology DC1651A Demonstration Board.

LTC6803-1: Battery stack monitor

    NOTES
     Setup:
       Set the terminal baud rate to 115200 and select the newline terminator.
       Ensure all jumpers on the demo board are installed in their default positions from the factory.
       Refer to Demo Manual DC1651.

     Menu Entry 1: Write Configuration
       Writes the configuration register of the LTC6803s on the stack. This command can be used to turn on
       the reference and shorten ADC conversion Times.

     Menu Entry 2: Read Configuration
       Reads the configuration register of the LTC6803, the read configuration can differ from the written configuration.
       The GPIO pins will reflect the state of the pin

     Menu Entry 3: Start Cell voltage conversion
        Starts a LTC6803 cell channel adc conversion.

     Menu Entry 4: Read cell voltages
        Reads the LTC6803 cell voltage registers and prints the results to the serial port.

     Menu Entry 5: Start Auxiliary voltage conversion
        Starts a LTC6803 Temp channel adc conversion.

     Menu Entry 6: Read Auxiliary voltages
        Reads the LTC6803 Temp registers and prints the Temp voltages to the serial port.

     Menu Entry 7: Start cell voltage measurement loop
        The command will continuously measure the LTC6803 cell voltages and print the results to the serial port.
        The loop can be exited by sending the MCU a 'm' character over the serial link.

    USER INPUT DATA FORMAT:
     decimal : 1024
     hex     : 0x400
     octal   : 02000  (leading 0)
     binary  : B10000000000
     float   : 1024.0

http://www.linear.com/product/LTC6803-1

http://www.linear.com/product/LTC6803-1#demoboards

Copyright 2018(c) Analog Devices, Inc.

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
- The use of this software may or may not infringe the patent rights of one or more patent holders. This license does not release you from the requirement that you obtain separate licenses from these patent holders to use this software.
- Use of the software either in source or binary form, must be run on or directly connected to an Analog Devices Inc. component.

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Copyright 2015 Linear Technology Corp. (LTC)

Definition in file DC1651A.ino.

Go to the source code of this file.

## Functions
static void | setup ()
| Inititializes hardware and variables. More...
static void | loop ()
| main loop More...
static void | run_command (uint32_t cmd)
| More...
static void | init_cfg ()
| Initializes the configuration array. More...
static void | print_menu ()
| Prints the main menu. More...
static void | print_cells ()
| Prints cell coltage codes to the serial port. More...
static void | print_temp ()
| Prints GPIO voltage codes and Vref2 voltage code onto the serial port. More...
static void | print_config ()
| Prints the configuration data that is going to be written to the LTC6803 to the serial port. More...
static void | print_rxconfig ()
| Prints the configuration data that was read back from the LTC6803 to the serial port. More...
static void | serial_print_hex (uint8_t data)
| Prints Data in a Hex Format. More...

## Variables
const uint8_t | TOTAL_IC = 1
| number of ICs in the daisy chain More...
static uint16_t | cell_codes [TOTAL_IC][12]
| The cell codes will be stored in the cell_codes[][12] array in the following format: More...
static uint16_t | temp_codes [TOTAL_IC][3]
| The Temp codes will be stored in the temp_codes[][3] array in the following format: More...
static uint8_t | tx_cfg [TOTAL_IC][6]
| The tx_cfg[][6] stores the LTC6803 configuration data that is going to be written to the LTC6803 ICs on the daisy chain. More...
static uint8_t | rx_cfg [TOTAL_IC][7]
| the rx_cfg[][8] array stores the data that is read back from a LTC6803-1 daisy chain. More...

## Function Documentation

## ◆ init_cfg()

static void init_cfg | ( |  | ) |
| static

Initializes the configuration array.

Definition at line 303 of file DC1651A.ino.

## ◆ loop()

static void loop | ( | void |  | ) |
| static

main loop

Definition at line 160 of file DC1651A.ino.

## ◆ print_cells()

static void print_cells | ( |  | ) |
| static

Prints cell coltage codes to the serial port.

Definition at line 337 of file DC1651A.ino.

## ◆ print_config()

static void print_config | ( |  | ) |
| static

Prints the configuration data that is going to be written to the LTC6803 to the serial port.

Definition at line 384 of file DC1651A.ino.

## ◆ print_menu()

static void print_menu | ( | void |  | ) |
| static

Prints the main menu.

Definition at line 319 of file DC1651A.ino.

## ◆ print_rxconfig()

static void print_rxconfig | ( | void |  | ) |
| static

Prints the configuration data that was read back from the LTC6803 to the serial port.

Definition at line 418 of file DC1651A.ino.

## ◆ print_temp()

static void print_temp | ( |  | ) |
| static

Prints GPIO voltage codes and Vref2 voltage code onto the serial port.

Definition at line 360 of file DC1651A.ino.

## ◆ run_command()

static void run_command | ( | uint32_t | cmd | ) |
| static

executes the user inputted command

Menu Entry 1: Write Configuration
Writes the configuration register of the LTC6803. This command can be used to turn on the reference and increase the speed of the ADC conversions.

Menu Entry 2: Read Configuration
Reads the configuration register of the LTC6803, the read configuration can differ from the written configuration. The GPIO pins will reflect the state of the pin

Menu Entry 3: Start Cell voltage conversion
Starts a LTC6803 cell channel adc conversion.

Menu Entry 4: Read cell voltages
Reads the LTC6803 cell voltage registers and prints the results to the serial port.

Menu Entry 5: Start Temp voltage conversion
Starts a LTC6803 Temp channel adc conversion.

Menu Entry 6: Read Temp voltages
Reads the LTC6803 axiliary registers and prints the GPIO voltages to the serial port.

Menu Entry 7: Start cell voltage measurement loop
The command will continuously measure the LTC6803 cell voltages and print the results to the serial port. The loop can be exited by sending the MCU a 'm' character over the serial link.

Definition at line 201 of file DC1651A.ino.

## ◆ serial_print_hex()

static void serial_print_hex | ( | uint8_t | data | ) |
| static

Prints Data in a Hex Format.

Definition at line 446 of file DC1651A.ino.

## ◆ setup()

static void setup | ( | void |  | ) |
| static

Inititializes hardware and variables.

Definition at line 150 of file DC1651A.ino.

## Variable Documentation

## ◆ cell_codes

uint16_t cell_codes[TOTAL_IC][12]
| static

The cell codes will be stored in the cell_codes[][12] array in the following format:

cell_codes[0][0] | cell_codes[0][1] | cell_codes[0][2] | ..... | cell_codes[0][11] | cell_codes[1][0] | cell_codes[1][1] | .....
--- | --- | --- | --- | --- | --- | --- | ---
IC1 Cell 1 | IC1 Cell 2 | IC1 Cell 3 | ..... | IC1 Cell 12 | IC2 Cell 1 | IC2 Cell 2 | .....

Definition at line 108 of file DC1651A.ino.

## ◆ rx_cfg

uint8_t rx_cfg[TOTAL_IC][7]
| static

the rx_cfg[][8] array stores the data that is read back from a LTC6803-1 daisy chain.

The configuration data for each IC is stored in blocks of 7 bytes. Below is an table illustrating the array organization:

rx_config[0][0] | rx_config[0][1] | rx_config[0][2] | rx_config[0][3] | rx_config[0][4] | rx_config[0][5] | rx_config[0][6] | rx_config[1][0] | rx_config[1][1] | .....
--- | --- | --- | --- | --- | --- | --- | --- | --- | ---
IC1 CFGR0 | IC1 CFGR1 | IC1 CFGR2 | IC1 CFGR3 | IC1 CFGR4 | IC1 CFGR5 | IC1 PEC | IC2 CFGR0 | IC2 CFGR1 | .....

Definition at line 138 of file DC1651A.ino.

## ◆ temp_codes

uint16_t temp_codes[TOTAL_IC][3]
| static

The Temp codes will be stored in the temp_codes[][3] array in the following format:

temp_codes[0][0] | temp_codes[0][1] | temp_codes[0][2] | temp_codes[1][0] | temp_codes[1][1] | .....
--- | --- | --- | --- | --- | ---
IC1 Temp1 | IC1 Temp2 | IC1 ITemp | IC2 Temp1 | IC2 Temp2 | .....

Definition at line 117 of file DC1651A.ino.

## ◆ TOTAL_IC

const uint8_t TOTAL_IC = 1

number of ICs in the daisy chain

Definition at line 100 of file DC1651A.ino.

## ◆ tx_cfg

uint8_t tx_cfg[TOTAL_IC][6]
| static

The tx_cfg[][6] stores the LTC6803 configuration data that is going to be written to the LTC6803 ICs on the daisy chain.

The LTC6803 configuration data that will be written should be stored in blocks of 6 bytes. The array should have the following format:

tx_cfg[0][0] | tx_cfg[0][1] | tx_cfg[0][2] | tx_cfg[0][3] | tx_cfg[0][4] | tx_cfg[0][5] | tx_cfg[1][0] | tx_cfg[1][1] | tx_cfg[1][2] | .....
--- | --- | --- | --- | --- | --- | --- | --- | --- | ---
IC1 CFGR0 | IC1 CFGR1 | IC1 CFGR2 | IC1 CFGR3 | IC1 CFGR4 | IC1 CFGR5 | IC2 CFGR0 | IC2 CFGR1 | IC2 CFGR2 | .....

Definition at line 126 of file DC1651A.ino.