Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board

Analog Devices DC2515 Demonstration Board. More...

Detailed Description

Analog Devices DC2515 Demonstration Board.

LTC6810: 6-Channel Battery Stack Monitors

*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.
*
*USER INPUT DATA FORMAT:
* decimal : 1024
* hex     : 0x400
* octal   : 02000  (leading 0)
* binary  : B10000000000
* float   : 1024.0
*

https://www.analog.com/en/products/ltc6810-1.html

Copyright 2019(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.

Definition in file DC2515.ino.

Go to the source code of this file.

Functions

static void measurement_loop (uint8_t datalog_en)
 
More...
 
static void print_menu (void)
 
More...
 
static void print_wrconfig (void)
 
More...
 
static void print_rxconfig (void)
 
More...
 
static void print_cells (uint8_t datalog_en)
 
More...
 
static void print_aux (uint8_t datalog_en)
 
More...
 
static void print_stat (void)
 
More...
 
static void print_sumofcells (void)
 
More...
 
static void print_svolt (uint8_t datalog_en)
 
More...
 
static void check_mux_fail (void)
 
More...
 
static void print_selftest_errors (uint8_t adc_reg,int8_t error)
 
More...
 
static void print_digital_redundancy_errors (uint8_t adc_reg,int8_t error)
 
More...
 
static void print_open_wires (void)
 
More...
 
static void print_pec_error_count (void)
 
More...
 
static int8_t select_s_pin (void)
 
More...
 
static void print_wrpwm (void)
 
More...
 
static void print_rxpwm (void)
 
More...
 
static void print_wrcomm (void)
 

/prints data which is written on COMM register onto the serial port More...

 
static void print_rxcomm (void)
 
More...
 
static void print_sid (void)
 
More...
 
static void reverse_isospi_direction (void)
 
More...
 
static void check_mute_bit (void)
 
More...
 
static void print_conv_time (uint32_t conv_time)
 
More...
 
static void check_error (int error)
 
More...
 
static void serial_print_text (char data[])
 
More...
 
static void serial_print_hex (uint8_t data)
 
More...
 
char read_hex (void)
 
More...
 
char get_char (void)
 
More...
 
static void setup ()
 
More...
 
static void loop ()
 
More...
 
static void run_command (uint32_t cmd)
 
More...
 

Macros

#define ENABLED   1
 
#define DISABLED   0
 
#define DATALOG_ENABLED   1
 
#define DATALOG_DISABLED   0
 

Variables

const uint8_t TOTAL_IC = 2
 Number of ICs in the daisy chain. More...
 
const uint8_t ADC_OPT = ADC_OPT_DISABLED
 ADC Mode option bit. More...
 
const uint8_t ADC_CONVERSION_MODE = MD_7KHZ_3KHZ
 ADC Mode. More...
 
const uint8_t ADC_DCP = DCP_DISABLED
 Discharge Permitted. More...
 
const uint8_t CELL_CH_TO_CONVERT = CELL_CH_ALL
 Channel Selection for ADC conversion. More...
 
const uint8_t AUX_CH_TO_CONVERT = AUX_CH_ALL
 Channel Selection for ADC conversion. More...
 
const uint8_t STAT_CH_TO_CONVERT = STAT_CH_ALL
 Channel Selection for ADC conversion. More...
 
const uint8_t SEL_ALL_REG = REG_ALL
 Register Selection. More...
 
const uint8_t SEL_REG_A = REG_1
 Register Selection. More...
 
const uint8_t SEL_REG_B = REG_2
 Register Selection. More...
 
const uint16_t OV_THRESHOLD = 41000
 Over voltage threshold ADC Code. More...
 
const uint16_t UV_THRESHOLD = 30000
 Under voltage threshold ADC Code. More...
 
const uint16_t MEASUREMENT_LOOP_TIME = 500
 Loop Time in milliseconds(ms) More...
 
const uint8_t WRITE_CONFIG = DISABLED
 This is to ENABLED or DISABLED writing into to configuration registers in a continuous loop. More...
 
const uint8_t READ_CONFIG = DISABLED
 This is to ENABLED or DISABLED reading the configuration registers in a continuous loop. More...
 
const uint8_t MEASURE_CELL = ENABLED
 This is to ENABLED or DISABLED measuring the cell voltages in a continuous loop. More...
 
const uint8_t MEASURE_AUX = DISABLED
 This is to ENABLED or DISABLED reading the auxiliary registers in a continuous loop. More...
 
const uint8_t MEASURE_STAT = DISABLED
 This is to ENABLED or DISABLED reading the status registers in a continuous loop. More...
 
const uint8_t PRINT_PEC = DISABLED
 This is to ENABLED or DISABLED printing the PEC Error Count in a continuous loop. More...
 
cell_asic BMS_IC [TOTAL_IC]
 Global Battery Variable. More...
 
bool ISOSPI_DIR =BMS_IC[0].isospi_reverse
 
bool ADCOPT = false
 ADC Mode option bit. More...
 
bool REFON = true
 Reference Powered Up Bit. More...
 
bool GPIOBITS [4] = {false,true,true,true}
 GPIO Pin Control // Gpio 1,2,3,4. More...
 
static uint16_t UV =UV_THRESHOLD
 Under voltage Comparison Voltage. More...
 
static uint16_t OV =OV_THRESHOLD
 Over voltage Comparison Voltage. More...
 
bool DCCBITS [6] = {false,false,false,false,false,false}
 Discharge cell switch //Dcc 1,2,3,4,5,6. More...
 
bool DCCBIT_0 = false
 Discharge cell switch //Dcc 0 // For discharging optional 7th cell. More...
 
bool MCAL = false
 Enable Multi-Calibration. More...
 
bool EN_DTMEN = true
 Enable Discharge timer monitor. More...
 
bool DIS_RED = false
 Disable Digital Redundancy Check. More...
 
bool FDRF = false
 Force digital Redundancy Failure. More...
 
bool SCONV = true
 Enable Cell Measurement Redundancy using S Pin. More...
 
bool DCTOBITS [4] = {true,false,true,false}
 Discharge Time Out Value //Dcto 0,1,2,3 // Programed for 4 min. More...
 
char hex_digits [16]
 
More...
 
char hex_to_byte_buffer [5]
 
More...
 
char byte_to_hex_buffer [3]
 
More...
 

Function Documentation

◆ check_error()

static void check_error ( int  error)
static


Function to check error flag and print PEC error message

Returns
void

Definition at line 1233 of file DC2515.ino.

◆ check_mute_bit()

static void check_mute_bit ( void  )
static


Function to check the Mute bit in the Status Register

Returns
void

Definition at line 1206 of file DC2515.ino.

◆ check_mux_fail()

static void check_mux_fail ( void  )
static


Function to check the MUX fail bit in the Status Register

Returns
void

Definition at line 943 of file DC2515.ino.

◆ get_char()

char get_char ( void  )


Read a command from the serial port

Returns
char

Definition at line 1308 of file DC2515.ino.

◆ loop()

static void loop ( void  )
static


main loop

Returns
void

Definition at line 201 of file DC2515.ino.

◆ measurement_loop()

static void measurement_loop ( uint8_t  datalog_en)
static


For writing/reading configuration data or measuring cell voltages or reading aux register or reading status register in a continuous loop

Returns
void

Definition at line 628 of file DC2515.ino.

◆ print_aux()

static void print_aux ( uint8_t  datalog_en)
static


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

Returns
void

Definition at line 812 of file DC2515.ino.

◆ print_cells()

static void print_cells ( uint8_t  datalog_en)
static


Prints cell voltage codes to the serial port

Returns
void

Definition at line 777 of file DC2515.ino.

◆ print_conv_time()

static void print_conv_time ( uint32_t  conv_time)
static


Function to print the Conversion Time

Returns
void

Definition at line 1220 of file DC2515.ino.

◆ print_digital_redundancy_errors()

static void print_digital_redundancy_errors ( uint8_t  adc_reg,
int8_t  error 
)
static


Prints Errors Detected during Digital Redundancy test

Returns
void

Definition at line 983 of file DC2515.ino.

◆ print_menu()

static void print_menu ( void  )
static


Prints the main menu

Returns
void

Definition at line 702 of file DC2515.ino.

◆ print_open_wires()

static void print_open_wires ( void  )
static


Prints Open wire test results to the serial port

Returns
void

Definition at line 1002 of file DC2515.ino.

◆ print_pec_error_count()

static void print_pec_error_count ( void  )
static


Function to print the number of PEC Errors

Returns
void

Definition at line 1026 of file DC2515.ino.

◆ print_rxcomm()

static void print_rxcomm ( void  )
static


Prints received data from COMM register onto the serial port

Returns
void

Definition at line 1137 of file DC2515.ino.

◆ print_rxconfig()

static void print_rxconfig ( void  )
static


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

Returns
void

Definition at line 753 of file DC2515.ino.

◆ print_rxpwm()

static void print_rxpwm ( void  )
static


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

Returns
void

Definition at line 1085 of file DC2515.ino.

◆ print_selftest_errors()

static void print_selftest_errors ( uint8_t  adc_reg,
int8_t  error 
)
static


Prints Errors Detected during self test

Returns
void

Definition at line 961 of file DC2515.ino.

◆ print_sid()

static void print_sid ( void  )
static


Prints Serial ID to the serial port.

Returns
void

Definition at line 1162 of file DC2515.ino.

◆ print_stat()

static void print_stat ( void  )
static


Prints Status voltage codes and Vref2 voltage code onto the serial port

Returns
void

Definition at line 853 of file DC2515.ino.

◆ print_sumofcells()

static void print_sumofcells ( void  )
static


Prints Status voltage codes for SOC onto the serial port

Returns
void

Definition at line 888 of file DC2515.ino.

◆ print_svolt()

static void print_svolt ( uint8_t  datalog_en)
static


Prints S voltage codes to the serial port

Returns
void

Definition at line 905 of file DC2515.ino.

◆ print_wrcomm()

static void print_wrcomm ( void  )
static


/prints data which is written on COMM register onto the serial port

Returns
void

Definition at line 1109 of file DC2515.ino.

◆ print_wrconfig()

static void print_wrconfig ( void  )
static


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

Returns
void

Definition at line 725 of file DC2515.ino.

◆ print_wrpwm()

static void print_wrpwm ( void  )
static


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

Returns
void

Definition at line 1057 of file DC2515.ino.

◆ read_hex()

char read_hex ( void  )


Read 2 hex characters from the serial buffer and convert them to a byte

Returns
char data Read Data

Definition at line 1293 of file DC2515.ino.

◆ reverse_isospi_direction()

static void reverse_isospi_direction ( void  )
static


Function to reverse the direction of ISOSPI communication when the ICs are connected in daisy chain

Returns
void

Definition at line 1191 of file DC2515.ino.

◆ run_command()

static void run_command ( uint32_t  cmd)
static


executes the user command

Returns
void

Definition at line 216 of file DC2515.ino.

◆ select_s_pin()

static int8_t select_s_pin ( void  )
static


Function to select the S pin for discharge

Returns
void

Definition at line 1042 of file DC2515.ino.

◆ serial_print_hex()

static void serial_print_hex ( uint8_t  data)
static


Function to print in HEX form

Returns
void

Definition at line 1254 of file DC2515.ino.

◆ serial_print_text()

static void serial_print_text ( char  data[])
static


Function to print text on serial monitor

Returns
void

Definition at line 1245 of file DC2515.ino.

◆ setup()

static void setup ( void  )
static


Initializes hardware and variables

Returns
void

Definition at line 182 of file DC2515.ino.

Macro Definition Documentation

◆ DATALOG_DISABLED

#define DATALOG_DISABLED   0

Definition at line 84 of file DC2515.ino.

◆ DATALOG_ENABLED

#define DATALOG_ENABLED   1

Definition at line 83 of file DC2515.ino.

◆ DISABLED

#define DISABLED   0

Definition at line 82 of file DC2515.ino.

◆ ENABLED

#define ENABLED   1

Definition at line 81 of file DC2515.ino.

Variable Documentation

◆ ADC_CONVERSION_MODE

const uint8_t ADC_CONVERSION_MODE = MD_7KHZ_3KHZ

ADC Mode.

Definition at line 124 of file DC2515.ino.

◆ ADC_DCP

const uint8_t ADC_DCP = DCP_DISABLED

Discharge Permitted.

Definition at line 125 of file DC2515.ino.

◆ ADC_OPT

const uint8_t ADC_OPT = ADC_OPT_DISABLED

ADC Mode option bit.

Definition at line 123 of file DC2515.ino.

◆ ADCOPT

bool ADCOPT = false

ADC Mode option bit.

Definition at line 163 of file DC2515.ino.

◆ AUX_CH_TO_CONVERT

const uint8_t AUX_CH_TO_CONVERT = AUX_CH_ALL

Channel Selection for ADC conversion.

Definition at line 127 of file DC2515.ino.

◆ BMS_IC

Global Battery Variable.

Definition at line 156 of file DC2515.ino.

◆ byte_to_hex_buffer

char byte_to_hex_buffer[3]
Initial value:
=
{
'\0','\0','\0'
}


Buffer for ASCII hex to byte conversion

Definition at line 1284 of file DC2515.ino.

◆ CELL_CH_TO_CONVERT

const uint8_t CELL_CH_TO_CONVERT = CELL_CH_ALL

Channel Selection for ADC conversion.

Definition at line 126 of file DC2515.ino.

◆ DCCBIT_0

bool DCCBIT_0 = false

Discharge cell switch //Dcc 0 // For discharging optional 7th cell.

Definition at line 169 of file DC2515.ino.

◆ DCCBITS

bool DCCBITS[6] = {false,false,false,false,false,false}

Discharge cell switch //Dcc 1,2,3,4,5,6.

Definition at line 168 of file DC2515.ino.

◆ DCTOBITS

bool DCTOBITS[4] = {true,false,true,false}

Discharge Time Out Value //Dcto 0,1,2,3 // Programed for 4 min.

Definition at line 175 of file DC2515.ino.

◆ DIS_RED

bool DIS_RED = false

Disable Digital Redundancy Check.

Definition at line 172 of file DC2515.ino.

◆ EN_DTMEN

bool EN_DTMEN = true

Enable Discharge timer monitor.

Definition at line 171 of file DC2515.ino.

◆ FDRF

bool FDRF = false

Force digital Redundancy Failure.

Definition at line 173 of file DC2515.ino.

◆ GPIOBITS

bool GPIOBITS[4] = {false,true,true,true}

GPIO Pin Control // Gpio 1,2,3,4.

Definition at line 165 of file DC2515.ino.

◆ hex_digits

char hex_digits[16]
Initial value:
=
{
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
}


Hex conversion constants

Definition at line 1268 of file DC2515.ino.

◆ hex_to_byte_buffer

char hex_to_byte_buffer[5]
Initial value:
=
{
'0', 'x', '0', '0', '\0'
}


Global Variables

Definition at line 1276 of file DC2515.ino.

◆ ISOSPI_DIR

bool ISOSPI_DIR =BMS_IC[0].isospi_reverse

Definition at line 158 of file DC2515.ino.

◆ MCAL

bool MCAL = false

Enable Multi-Calibration.

Definition at line 170 of file DC2515.ino.

◆ MEASURE_AUX

const uint8_t MEASURE_AUX = DISABLED

This is to ENABLED or DISABLED reading the auxiliary registers in a continuous loop.

Definition at line 143 of file DC2515.ino.

◆ MEASURE_CELL

const uint8_t MEASURE_CELL = ENABLED

This is to ENABLED or DISABLED measuring the cell voltages in a continuous loop.

Definition at line 142 of file DC2515.ino.

◆ MEASURE_STAT

const uint8_t MEASURE_STAT = DISABLED

This is to ENABLED or DISABLED reading the status registers in a continuous loop.

Definition at line 144 of file DC2515.ino.

◆ MEASUREMENT_LOOP_TIME

const uint16_t MEASUREMENT_LOOP_TIME = 500

Loop Time in milliseconds(ms)

Definition at line 137 of file DC2515.ino.

◆ OV

uint16_t OV =OV_THRESHOLD
static

Over voltage Comparison Voltage.

Definition at line 167 of file DC2515.ino.

◆ OV_THRESHOLD

const uint16_t OV_THRESHOLD = 41000

Over voltage threshold ADC Code.

LSB = 0.0001 —(4.1V)

Definition at line 134 of file DC2515.ino.

◆ PRINT_PEC

const uint8_t PRINT_PEC = DISABLED

This is to ENABLED or DISABLED printing the PEC Error Count in a continuous loop.

Definition at line 145 of file DC2515.ino.

◆ READ_CONFIG

const uint8_t READ_CONFIG = DISABLED

This is to ENABLED or DISABLED reading the configuration registers in a continuous loop.

Definition at line 141 of file DC2515.ino.

◆ REFON

bool REFON = true

Reference Powered Up Bit.

Definition at line 164 of file DC2515.ino.

◆ SCONV

bool SCONV = true

Enable Cell Measurement Redundancy using S Pin.

Definition at line 174 of file DC2515.ino.

◆ SEL_ALL_REG

const uint8_t SEL_ALL_REG = REG_ALL

Register Selection.

Definition at line 129 of file DC2515.ino.

◆ SEL_REG_A

const uint8_t SEL_REG_A = REG_1

Register Selection.

Definition at line 130 of file DC2515.ino.

◆ SEL_REG_B

const uint8_t SEL_REG_B = REG_2

Register Selection.

Definition at line 131 of file DC2515.ino.

◆ STAT_CH_TO_CONVERT

const uint8_t STAT_CH_TO_CONVERT = STAT_CH_ALL

Channel Selection for ADC conversion.

Definition at line 128 of file DC2515.ino.

◆ TOTAL_IC

const uint8_t TOTAL_IC = 2

Number of ICs in the daisy chain.

Definition at line 120 of file DC2515.ino.

◆ UV

uint16_t UV =UV_THRESHOLD
static

Under voltage Comparison Voltage.

Definition at line 166 of file DC2515.ino.

◆ UV_THRESHOLD

const uint16_t UV_THRESHOLD = 30000

Under voltage threshold ADC Code.

LSB = 0.0001 —(1V)

Definition at line 135 of file DC2515.ino.

◆ WRITE_CONFIG

const uint8_t WRITE_CONFIG = DISABLED

This is to ENABLED or DISABLED writing into to configuration registers in a continuous loop.

Definition at line 140 of file DC2515.ino.