![]() |
Linduino
1.3.0
Linear Technology Arduino-Compatible Demonstration Board
|
LTC3335: Nanopower Buck-Boost DC/DC with Integrated Coulomb Counter. More...
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:
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 | |
#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 |
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.
Definition at line 268 of file LTC3335.cpp.
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.
Definition at line 409 of file LTC3335.cpp.
int8_t LTC3335_Get_Alarms | ( | LTC3335_ALARM_TYPE * | alarms | ) |
Gets the alarms active from the LTC3335.
alarms | Bitmap containing the LTC3335 active alarms. |
Definition at line 225 of file LTC3335.cpp.
int8_t LTC3335_Get_Counter_Test_Current | ( | uint16_t * | microamps | ) |
Gets the battery current in uA.
microamps | Pointer to where current will be returned. |
Definition at line 431 of file LTC3335.cpp.
int8_t LTC3335_Get_Discharged_Capacity | ( | uint32_t * | discharged_capacity | ) |
Gets the discharged capacity from the battery in mAs.
discharged_capacity | Pointer to where discharged capacity will be returned. |
Definition at line 306 of file LTC3335.cpp.
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.
vbat | Battery voltage used to select software correction factor. |
Definition at line 354 of file LTC3335_Correction_Tables.cpp.
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
Definition at line 162 of file LTC3335.cpp.
int8_t LTC3335_Reset_Counter_Test_Current | ( | void | ) |
Resets the number of edges and the amount of time stored for the Counter Test feature.
Definition at line 396 of file LTC3335.cpp.
int8_t LTC3335_Set_Counter_Test | ( | boolean | enabled | ) |
Enables/Disables the LTC3335 Counter Test feature.
enabled | TRUE to enable Counter Test feature, FALSE to disable Counter Test feature. |
Definition at line 360 of file LTC3335.cpp.
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.
enabled | TRUE to enable software control of output voltage, FALSE to disable software control (output voltage set by pins 3-5). |
voltage | The output voltage setting if software control is enabled. |
Definition at line 206 of file LTC3335.cpp.
#define LTC3335_BAUD_RATE 400 |
#define LTC3335_IPEAK_MA 100 |
#define LTC3335_IQ (680e-9) |
#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.
#define LTC3335_PRESCALER (LTC3335_PRESCALER_MAX - NBITS( (uint32_t)(1L*LTC3335_CAPACITY*SEC_PER_HR/LTC3335_RANGE(LTC3335_PRESCALER_MAX)) ) ) |
#define LTC3335_PRESCALER_MAX 15 |
#define LTC3335_RANGE | ( | p | ) | ((uint32_t)(255LL * LTC3335_RESOLUTION(p) * ((1LL << 16) + LTC3335_CORRECTION_FACTOR_TYP) / (1L << 16))) |
#define LTC3335_RESOLUTION | ( | p | ) | ((uint32_t)(LTC3335_IPEAK_MA * LTC3335_TFS * (1LL << (42 - 1 - p)) / 255 + 0.5)) |
#define LTC3335_TFS (11.74e-6) |
#define LTC3335_TIMER_COUNTS_PER_IQ_MAS ((uint32_t)(LTC3335_TIMER_COUNTS_PER_SEC/(LTC3335_IQ * MA_PER_A))) |