Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board

LTC3335: Nanopower Buck-Boost DC/DC with Integrated Coulomb Counter. More...

Detailed Description

LTC3335: Nanopower Buck-Boost DC/DC with Integrated Coulomb Counter.

This header file contains the API to the LTC3335 driver. A minimal set of functions were declared to allow access to the features of the part while abstracting away from the register transactions.

The LTC®3335 is a high efficiency, low quiescent current
(680nA) buck-boost DC/DC converter with an integrated
precision coulomb counter which monitors accumulated
battery discharge in long life battery powered applications.
The buck-boost can operate down to 1.8V on its input and
provides eight pin-selectable output voltages with up to
50mA of output current.

The coulomb counter stores the accumulated battery discharge
in an internal register accessible via an I2C interface.
The LTC3335 features a programmable discharge alarm
threshold. When the threshold is reached, an interrupt is
generated at the IRQ pin.

To accommodate a wide range of battery types and sizes,
the peak input current can be selected from as low as 5mA
to as high as 250mA and the full-scale coulomb counter
has a programmable range of 32,768:1.

http://www.linear.com/product/LTC3335

http://www.linear.com/product/LTC3335#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.

API Header File for LTC3335: Nanopower Buck-Boost DC/DC with Integrated Coulomb Counter

Definition in file LTC3335.h.

Go to the source code of this file.

Data Structures

struct  LTC3335_ALARM_TYPE
 The alarm conditions which cause the LTC3335 to activate the /INT pin. More...
 

Functions

int8_t LTC3335_Init (void)
 Verify that battery capacity isn't so gigantic that it would overflow a 32 bit number. More...
 
int8_t LTC3335_Set_Voltage (boolean enabled, LTC3335_OUTPUT_VOLTAGE_TYPE voltage)
 Enables/Disables software control of the LTC3335 output voltage. More...
 
int8_t LTC3335_Get_Alarms (LTC3335_ALARM_TYPE *alarms)
 Gets the alarms active from the LTC3335. More...
 
int8_t LTC3335_Clear_Int (LTC3335_ALARM_TYPE *alarms)
 Sends the command to clear the INT condition. More...
 
int8_t LTC3335_Set_Counter_Test (boolean enabled)
 Enables/Disables the LTC3335 Counter Test feature. More...
 
int8_t LTC3335_Get_Discharged_Capacity (uint32_t *discharged_capacity)
 Gets the discharged capacity from the battery in mAs. More...
 
int8_t LTC3335_Get_Counter_Test_Current (uint16_t *microamps)
 Gets the battery current in uA. More...
 
int8_t LTC3335_Reset_Counter_Test_Current (void)
 Resets the number of edges and the amount of time stored for the Counter Test feature. More...
 
void LTC3335_Counter_Test_Current_Task (void)
 Task that must be run periodically, for the edges and time to be stored for the LTC3335 Counter Test feature. More...
 
int16_t LTC3335_Get_Software_Correction_Factor (uint16_t vbat)
 Returns the software correction factor for a specified LTC3335_IPEAK_CONFIGURATION, LTC3335_OUTPUT_VOLTAGE, and battery voltage. More...
 

Macros

#define LTC3335_TIMER_COUNTS_PER_IQ_MAS   ((uint32_t)(LTC3335_TIMER_COUNTS_PER_SEC/(LTC3335_IQ * MA_PER_A)))
 counts for iq current to accumulate to 1 mAs More...
 
#define LTC3335_MIN_CURRENT_TASK_RATE   ((1LL << LTC3335_COUNTER_SIZE) * 2 * LTC3335_TFS)
 LTC3335_Counter_Test_Current_Task() must be called often more often than this rate for hardware counter to not overflow. More...
 
#define LTC3335_IPEAK_MA   100
 mA = 100mA, used in calculations of coulomb count and current. More...
 
#define LTC3335_PRESCALER   (LTC3335_PRESCALER_MAX - NBITS( (uint32_t)(1L*LTC3335_CAPACITY*SEC_PER_HR/LTC3335_RANGE(LTC3335_PRESCALER_MAX)) ) )
 Macro to select the optimal prescaler for the specified battery capacity at compile time. More...
 
#define LTC3335_RANGE(p)   ((uint32_t)(255LL * LTC3335_RESOLUTION(p) * ((1LL << 16) + LTC3335_CORRECTION_FACTOR_TYP) / (1L << 16)))
 Macro to retrieve the LTC3335 coulomb count range with a given prescaler. More...
 
#define LTC3335_RESOLUTION(p)   ((uint32_t)(LTC3335_IPEAK_MA * LTC3335_TFS * (1LL << (42 - 1 - p)) / 255 + 0.5))
 Macro to retrieve the LTC3335 coulomb count resolution with a given prescaler. More...
 
LTC3335 Driver Properties
#define LTC3335_BAUD_RATE   400
 in kHz, Max Clock Operating Frequency (fSCL from datasheet page 5) More...
 
#define LTC3335_PRESCALER_MAX   15
 the maximum prescaler that be selected for the LTC3335. More...
 
#define LTC3335_TFS   (11.74e-6)
 in s, full scale ON time from page 15 of datasheet. More...
 
#define LTC3335_IQ   (680e-9)
 in A, Input Quiescent Current from page 1 of datasheet. More...
 

Voltage Settings

Options available for setting output voltage via I2C.

#define LTC3335_OUTPUT_VOLTAGE_1_8V   0
 
#define LTC3335_OUTPUT_VOLTAGE_2_5V   1
 
#define LTC3335_OUTPUT_VOLTAGE_2_8V   2
 
#define LTC3335_OUTPUT_VOLTAGE_3_0V   3
 
#define LTC3335_OUTPUT_VOLTAGE_3_3V   4
 
#define LTC3335_OUTPUT_VOLTAGE_3_6V   5
 
#define LTC3335_OUTPUT_VOLTAGE_4_5V   6
 
#define LTC3335_OUTPUT_VOLTAGE_5_0V   7
 
#define LTC3335_NUM_OUTPUT_VOLTAGES   8
 
enum  LTC3335_OUTPUT_VOLTAGE_TYPE
 

IPeak Settings

Options available for IPeak setting.

NOTE! This can not be set via I2C. It can only be set with resistors on pins 13-15 of the LTC3335, along with the an appropriately sized inductor. In order to translate accumulator values to coulombs, and Counter Test results to amps, this setting must be known.

#define LTC3335_IPEAK_CONFIGURATION_5MA   0
 
#define LTC3335_IPEAK_CONFIGURATION_10MA   1
 
#define LTC3335_IPEAK_CONFIGURATION_15MA   2
 
#define LTC3335_IPEAK_CONFIGURATION_25MA   3
 
#define LTC3335_IPEAK_CONFIGURATION_50MA   4
 
#define LTC3335_IPEAK_CONFIGURATION_100MA   5
 
#define LTC3335_IPEAK_CONFIGURATION_150MA   6
 
#define LTC3335_IPEAK_CONFIGURATION_250MA   7
 
#define LTC3335_NUM_IPEAK   8
 
enum  LTC3335_IPEAK_CONFIGURATION_TYPE
 

Function Documentation

◆ LTC3335_Clear_Int()

int8_t LTC3335_Clear_Int ( LTC3335_ALARM_TYPE alarms)

Sends the command to clear the INT condition.

NOTE! Additional registers are rewritten in order for the INT condition to be reset.

Returns
0 if the LTC3335 communication was successful.

Definition at line 268 of file LTC3335.cpp.

◆ LTC3335_Counter_Test_Current_Task()

void LTC3335_Counter_Test_Current_Task ( void  )

Task that must be run periodically, for the edges and time to be stored for the LTC3335 Counter Test feature.

Returns
TRUE if the LTC3335 communication was successful.

Definition at line 409 of file LTC3335.cpp.

◆ LTC3335_Get_Alarms()

int8_t LTC3335_Get_Alarms ( LTC3335_ALARM_TYPE alarms)

Gets the alarms active from the LTC3335.

Returns
0 if the LTC3335 communication was successful.
Parameters
alarmsBitmap containing the LTC3335 active alarms.

Definition at line 225 of file LTC3335.cpp.

◆ LTC3335_Get_Counter_Test_Current()

int8_t LTC3335_Get_Counter_Test_Current ( uint16_t *  microamps)

Gets the battery current in uA.

Returns
0 if the LTC3335 communication was successful.
Parameters
microampsPointer to where current will be returned.

Definition at line 431 of file LTC3335.cpp.

◆ LTC3335_Get_Discharged_Capacity()

int8_t LTC3335_Get_Discharged_Capacity ( uint32_t *  discharged_capacity)

Gets the discharged capacity from the battery in mAs.

Returns
0 if the LTC3335 communication was successful.
Parameters
discharged_capacityPointer to where discharged capacity will be returned.

Definition at line 306 of file LTC3335.cpp.

◆ LTC3335_Get_Software_Correction_Factor()

int16_t LTC3335_Get_Software_Correction_Factor ( uint16_t  vbat)

Returns the software correction factor for a specified LTC3335_IPEAK_CONFIGURATION, LTC3335_OUTPUT_VOLTAGE, and battery voltage.

Note! - These corrections factors are only valid at room temperature and for the recommended Coilcraft LPS5030-xxxMRB inductor.

Returns
TRUE if the LTC3335 communication was successful.
Parameters
vbatBattery voltage used to select software correction factor.

Definition at line 354 of file LTC3335_Correction_Tables.cpp.

◆ LTC3335_Init()

int8_t LTC3335_Init ( void  )

Verify that battery capacity isn't so gigantic that it would overflow a 32 bit number.

Verify that capacity resolution isn't so tiny that half bits in units of mAs result in 1% discretization error. Initializes the LTC3335 driver, setting the prescaler, output voltage, and alarm threshold selected in LTC3335_Confg.h

Returns
0 if the init was successful.

Definition at line 162 of file LTC3335.cpp.

◆ LTC3335_Reset_Counter_Test_Current()

int8_t LTC3335_Reset_Counter_Test_Current ( void  )

Resets the number of edges and the amount of time stored for the Counter Test feature.

Returns
TRUE if the LTC3335 communication was successful.

Definition at line 396 of file LTC3335.cpp.

◆ LTC3335_Set_Counter_Test()

int8_t LTC3335_Set_Counter_Test ( boolean  enabled)

Enables/Disables the LTC3335 Counter Test feature.

Returns
0 if the LTC3335 communication was successful.
Parameters
enabledTRUE to enable Counter Test feature, FALSE to disable Counter Test feature.

Definition at line 360 of file LTC3335.cpp.

◆ LTC3335_Set_Voltage()

int8_t LTC3335_Set_Voltage ( boolean  enabled,
LTC3335_OUTPUT_VOLTAGE_TYPE  voltage 
)

Enables/Disables software control of the LTC3335 output voltage.

If software control is enabled, the voltage is set to the specified setting.

Returns
0 if the LTC3335 communication was successful.
Parameters
enabledTRUE to enable software control of output voltage, FALSE to disable software control (output voltage set by pins 3-5).
voltageThe output voltage setting if software control is enabled.

Definition at line 206 of file LTC3335.cpp.

Macro Definition Documentation

◆ LTC3335_BAUD_RATE

#define LTC3335_BAUD_RATE   400

in kHz, Max Clock Operating Frequency (fSCL from datasheet page 5)

Definition at line 111 of file LTC3335.h.

◆ LTC3335_IPEAK_CONFIGURATION_100MA

#define LTC3335_IPEAK_CONFIGURATION_100MA   5

Definition at line 145 of file LTC3335.h.

◆ LTC3335_IPEAK_CONFIGURATION_10MA

#define LTC3335_IPEAK_CONFIGURATION_10MA   1

Definition at line 141 of file LTC3335.h.

◆ LTC3335_IPEAK_CONFIGURATION_150MA

#define LTC3335_IPEAK_CONFIGURATION_150MA   6

Definition at line 146 of file LTC3335.h.

◆ LTC3335_IPEAK_CONFIGURATION_15MA

#define LTC3335_IPEAK_CONFIGURATION_15MA   2

Definition at line 142 of file LTC3335.h.

◆ LTC3335_IPEAK_CONFIGURATION_250MA

#define LTC3335_IPEAK_CONFIGURATION_250MA   7

Definition at line 147 of file LTC3335.h.

◆ LTC3335_IPEAK_CONFIGURATION_25MA

#define LTC3335_IPEAK_CONFIGURATION_25MA   3

Definition at line 143 of file LTC3335.h.

◆ LTC3335_IPEAK_CONFIGURATION_50MA

#define LTC3335_IPEAK_CONFIGURATION_50MA   4

Definition at line 144 of file LTC3335.h.

◆ LTC3335_IPEAK_CONFIGURATION_5MA

#define LTC3335_IPEAK_CONFIGURATION_5MA   0

Definition at line 140 of file LTC3335.h.

◆ LTC3335_IPEAK_MA

#define LTC3335_IPEAK_MA   100

mA = 100mA, used in calculations of coulomb count and current.

Definition at line 178 of file LTC3335.h.

◆ LTC3335_IQ

#define LTC3335_IQ   (680e-9)

in A, Input Quiescent Current from page 1 of datasheet.

Definition at line 114 of file LTC3335.h.

◆ LTC3335_MIN_CURRENT_TASK_RATE

#define LTC3335_MIN_CURRENT_TASK_RATE   ((1LL << LTC3335_COUNTER_SIZE) * 2 * LTC3335_TFS)

LTC3335_Counter_Test_Current_Task() must be called often more often than this rate for hardware counter to not overflow.

Definition at line 164 of file LTC3335.h.

◆ LTC3335_NUM_IPEAK

#define LTC3335_NUM_IPEAK   8

Definition at line 148 of file LTC3335.h.

◆ LTC3335_NUM_OUTPUT_VOLTAGES

#define LTC3335_NUM_OUTPUT_VOLTAGES   8

Definition at line 129 of file LTC3335.h.

◆ LTC3335_OUTPUT_VOLTAGE_1_8V

#define LTC3335_OUTPUT_VOLTAGE_1_8V   0

Definition at line 121 of file LTC3335.h.

◆ LTC3335_OUTPUT_VOLTAGE_2_5V

#define LTC3335_OUTPUT_VOLTAGE_2_5V   1

Definition at line 122 of file LTC3335.h.

◆ LTC3335_OUTPUT_VOLTAGE_2_8V

#define LTC3335_OUTPUT_VOLTAGE_2_8V   2

Definition at line 123 of file LTC3335.h.

◆ LTC3335_OUTPUT_VOLTAGE_3_0V

#define LTC3335_OUTPUT_VOLTAGE_3_0V   3

Definition at line 124 of file LTC3335.h.

◆ LTC3335_OUTPUT_VOLTAGE_3_3V

#define LTC3335_OUTPUT_VOLTAGE_3_3V   4

Definition at line 125 of file LTC3335.h.

◆ LTC3335_OUTPUT_VOLTAGE_3_6V

#define LTC3335_OUTPUT_VOLTAGE_3_6V   5

Definition at line 126 of file LTC3335.h.

◆ LTC3335_OUTPUT_VOLTAGE_4_5V

#define LTC3335_OUTPUT_VOLTAGE_4_5V   6

Definition at line 127 of file LTC3335.h.

◆ LTC3335_OUTPUT_VOLTAGE_5_0V

#define LTC3335_OUTPUT_VOLTAGE_5_0V   7

Definition at line 128 of file LTC3335.h.

◆ LTC3335_PRESCALER

#define LTC3335_PRESCALER   (LTC3335_PRESCALER_MAX - NBITS( (uint32_t)(1L*LTC3335_CAPACITY*SEC_PER_HR/LTC3335_RANGE(LTC3335_PRESCALER_MAX)) ) )

Macro to select the optimal prescaler for the specified battery capacity at compile time.

Definition at line 188 of file LTC3335.h.

◆ LTC3335_PRESCALER_MAX

#define LTC3335_PRESCALER_MAX   15

the maximum prescaler that be selected for the LTC3335.

Definition at line 112 of file LTC3335.h.

◆ LTC3335_RANGE

#define LTC3335_RANGE (   p)    ((uint32_t)(255LL * LTC3335_RESOLUTION(p) * ((1LL << 16) + LTC3335_CORRECTION_FACTOR_TYP) / (1L << 16)))

Macro to retrieve the LTC3335 coulomb count range with a given prescaler.

Definition at line 192 of file LTC3335.h.

◆ LTC3335_RESOLUTION

#define LTC3335_RESOLUTION (   p)    ((uint32_t)(LTC3335_IPEAK_MA * LTC3335_TFS * (1LL << (42 - 1 - p)) / 255 + 0.5))

Macro to retrieve the LTC3335 coulomb count resolution with a given prescaler.

Definition at line 198 of file LTC3335.h.

◆ LTC3335_TFS

#define LTC3335_TFS   (11.74e-6)

in s, full scale ON time from page 15 of datasheet.

Definition at line 113 of file LTC3335.h.

◆ LTC3335_TIMER_COUNTS_PER_IQ_MAS

#define LTC3335_TIMER_COUNTS_PER_IQ_MAS   ((uint32_t)(LTC3335_TIMER_COUNTS_PER_SEC/(LTC3335_IQ * MA_PER_A)))

counts for iq current to accumulate to 1 mAs

Definition at line 161 of file LTC3335.h.

Enumeration Type Documentation

◆ LTC3335_IPEAK_CONFIGURATION_TYPE

Definition at line 139 of file LTC3335.h.

◆ LTC3335_OUTPUT_VOLTAGE_TYPE

Definition at line 120 of file LTC3335.h.