| |
- __builtin__.object
-
- LTC3350
- ltc_dc590b_interface
- exceptions.Exception(exceptions.BaseException)
-
- LTC3350_APIException
class LTC3350(__builtin__.object) |
|
API for the LTC3350 High Current Supercapacitor Backup Controller and System Monitor.
Each bit field is read and written as an attribute of the class instance.
Bit fields are changed in place with a read-modify-write algorithm to avoid clearing adjacent data in shared registers.
Presets (enumerations) and formats (transformation functions to real-word units) are applied in both directions for interactive use, but can be disabled. |
|
Methods defined here:
- __init__(self, read_function, write_function=None, verbose=False)
- The user must supply appropriate functions to read from and write to the I2C/SMBus hardware.
read_function should take arguments (addr_7bit, command_code) and return contents of LTC3350 register at command_code.
write_function should take arguments (addr_7bit, command_code, data) and write data to LTC3350 register at command_code.
Set verbose argument to True to enable printing of intermediate results of masking, shifting and data transformation operations.
- __repr__(self)
- __setattr__(self, name, value)
- Override attribute storage mechanism to prevent writes to mis-spelled bit fields.
- __str__(self)
- create_format(self, format_name, format_function, unformat_function, signed=False, description=None)
- Create a new format definition or modify an existing definition.
format_function should take a single argument of integer raw data from the register and return a version of the data scaled to appropriate units.
unformat_function should take a single argument of data in real units and return an integer version of the data scaled to the register LSB weight.
If the data is signed in two's-complement format, set signed=True.
After creating format, use set_active_format method to make the new format active.
- disable_presets_and_formats(self)
- Remove all presets and formats.
Read and write data will be passed through unmodified, except for masking and shifting.
The dictionary of presets and formats is shared between all instances of the class and any other instances will reflect this change.
This is permanent for the duration of the Python session.
- get_active_format(self, bf_name)
- Returns string name of format currently active for field bf_name.
- get_constant(self, constant)
- Gets the constants found in the datasheet used by the formatters to convert from real world values to digital value and back.
- list_constants(self)
- Returns a dictionary of constants found in the datasheet used by the formatters to convert from real world values to digital value and back.
- set_active_format(self, bf_name, format_name, force=False)
- Changes currently active format for field bf_name to format_name.
If format_name is not in list of allowed_formats, set force argument to True to disable check.
- set_constant(self, constant, value)
- Sets the constants found in the datasheet used by the formatters to convert from real world values to digital value and back.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- alarm_cap_lo
- Capacitance low alarm (1 bit, Read Only)
- alarm_cap_ov
- Capacitor overvoltage alarm (1 bit, Read Only)
- alarm_cap_uv
- Capacitor undervoltage alarm (1 bit, Read Only)
- alarm_dtemp_cold
- Die temperature cold alarm (1 bit, Read Only)
- alarm_dtemp_hot
- Die temperature hot alarm (1 bit, Read Only)
- alarm_esr_hi
- ESR high alarm (1 bit, Read Only)
- alarm_gpi_ov
- GPI overvoltage alarm (1 bit, Read Only)
- alarm_gpi_uv
- GPI undervoltage alarm (1 bit, Read Only)
- alarm_ichg_uc
- Charge undercurrent alarm (1 bit, Read Only)
- alarm_iin_oc
- Input overcurrent alarm (1 bit, Read Only)
- alarm_reg
- Alarms Register: A one in any bit in the register indicates its respective alarm has triggered. All bits are active high.
- alarm_vcap_ov
- VCAP overvoltage alarm (1 bit, Read Only)
- alarm_vcap_uv
- VCAP undervoltage alarm (1 bit, Read Only)
- alarm_vin_ov
- VIN overvoltage alarm (1 bit, Read Only)
- alarm_vin_uv
- VIN undervoltage alarm (1 bit, Read Only)
- alarm_vout_ov
- VOUT overvoltage alarm (1 bit, Read Only)
- alarm_vout_uv
- VOUT undervoltage alarm (1 bit, Read Only)
- cap_esr_per
- Capacitance and ESR Measurement Period: This register sets the period of repeated capacitance and ESR measurements. Each LSB represents 10 seconds. Capacitance and ESR measurements will not repeat if this register is zero. (16 bits, R/W)
Format: cap_per
- cap_lo_lvl
- Capacitance Low Level: This is an alarm threshold for the measured stack capacitance. If enabled, if the measured stack capacitance is less than this level it will trigger an alarm and an SMBALERT. When ctl_cap_scale is set to 1, capacitance is 3.36uF * RT/RTST per LSB. When ctl_cap_scale is set to 0 it is 336uF * RT/RTST per LSB. (16 bits, R/W)
Format: cap
- cap_ov_lvl
- Capacitor Overvoltage Level: This is an alarm threshold for each individual capacitor in the stack. If enabled, any capacitor voltage rising above this level will trigger an alarm and an SMBALERT. 183.5uV per LSB (16 bits, R/W)
Format: cell
- cap_uv_lvl
- Capacitor Undervoltage Level: This is an alarm threshold for each individual capacitor voltage in the stack. If enabled, any capacitor voltage falling below this level will trigger an alarm and an SMBALERT. 183.5uV per LSB. (16 bits, R/W)
Format: cell
- chrg_bal
- The capacitor manager is balancing (1 bit, Read Only)
- chrg_cappg
- The capacitor voltage is above power good threshold (1 bit, Read Only)
- chrg_ci
- The charger is in constant current mode (1 bit, Read Only)
- chrg_cv
- The charger is in constant voltage mode (1 bit, Read Only)
- chrg_dis
- The charger is temporarily disabled for capacitance measurement (1 bit, Read Only)
- chrg_input_ilim
- The charger is in input current limit (1 bit, Read Only)
- chrg_pfo
- Input voltage is below PFI threshold (1 bit, Read Only)
- chrg_shnt
- The capacitor manager is shunting (1 bit, Read Only)
- chrg_status
- Charger Status Register: This register provides real time status information about the state of the charger system. Each bit is active high.
- chrg_stepdown
- The synchronous controller is in step-down mode (charging) (1 bit, Read Only)
- chrg_stepup
- The synchronous controller is in step-up mode (backup) (1 bit, Read Only)
- chrg_uvlo
- The charger is in under voltage lockout (1 bit, Read Only)
- clr_alarms
- Clear Alarms Register: This register is used to clear alarms caused by exceeding a programmed limit. Writing a one to any bit in this register will cause its respective alarm to be cleared. The one written to this register is automatically cleared when its respective alarm is cleared.
- clr_cap_lo
- Clear capacitance low alarm (1 bit, R/W)
- clr_cap_ov
- Clear capacitor overvoltage alarm (1 bit, R/W)
- clr_cap_uv
- Clear capacitor undervoltage alarm (1 bit, R/W)
- clr_dtemp_cold
- Clear die temperature cold alarm (1 bit, R/W)
- clr_dtemp_hot
- Clear die temperature hot alarm (1 bit, R/W)
- clr_esr_hi
- Clear ESR high alarm (1 bit, R/W)
- clr_gpi_ov
- Clear GPI overvoltage alarm (1 bit, R/W)
- clr_gpi_uv
- Clear GPI undervoltage alarm (1 bit, R/W)
- clr_ichg_uc
- Clear charge undercurrent alarm (1 bit, R/W)
- clr_iin_oc
- Clear input overcurrent alarm (1 bit, R/W)
- clr_vcap_ov
- Clear VCAP overvoltage alarm (1 bit, R/W)
- clr_vcap_uv
- Clear VCAP undervoltage alarm (1 bit, R/W)
- clr_vin_ov
- Clear VIN overvoltage alarm (1 bit, R/W)
- clr_vin_uv
- Clear VIN undervoltage alarm (1 bit, R/W)
- clr_vout_ov
- Clear VOUT overvoltage alarm (1 bit, R/W)
- clr_vout_uv
- Clear VOUT undervoltage alarm (1 bit, R/W)
- ctl_cap_scale
- Increases capacitor measurement resolution by 100x, this is used when measuring smaller capacitors. (1 bit, R/W)
Preset 'small': 1
Preset 'large': 0
- ctl_gpi_buffer_en
- A one in this bit location enables the input buffer on the GPI pin. With a zero in this location the GPI pin is measured without the buffer. (1 bit, R/W)
- ctl_reg
- Control Register: Several Control Functions are grouped into this register.
- ctl_stop_capesr
- Stops an active capacitance/ESR measurement. (1 bit, R/W)
Preset 'stop': 1
- ctl_strt_capesr
- Begin a capacitance and ESR measurement when possible; this bit clears itself once a cycle begins. (1 bit, R/W)
Preset 'start': 1
- dtemp_cold_lvl
- Die Temperature Cold Level: This is an alarm threshold for the die temperature. If enabled, the die temperature falling below this level will trigger an alarm and an SMBALERT. Temperature = 0.028C per LSB - 251.4C (16 bits, R/W)
Format: dtemp
- dtemp_hot_lvl
- Die Temperature Hot Level: This is an alarm threshold for the die temperature. If enabled, the die temperature rising above this level will trigger an alarm and an SMBALERT. Temperature = 0.028C per LSB - 251.4C (16 bits, R/W)
Format: dtemp
- esr_hi_lvl
- ESR High Level: This is an alarm threshold for the measured stack ESR. If enabled, a measurement of stack ESR exceeding this level will trigger an alarm and an SMBALERT. RSNSC/64 per LSB. (16 bits, R/W)
Format: esr
- gpi_ov_lvl
- General Purpose Input Overvoltage Level: This is an alarm threshold for the GPI pin. If enabled, the voltage rising above this level will trigger an alarm and an SMBALERT. 183.5uV per LSB (16 bits, R/W)
Format: cell
- gpi_uv_lvl
- General Purpose Input Undervoltage Level: This is an alarm threshold for the GPI pin. If enabled, the voltage falling below this level will trigger an alarm and an SMBALERT. 183.5uV per LSB (16 bits, R/W)
Format: cell
- ichg_uc_lvl
- Charge Undercurrent Level: This is an alarm threshold for the charge current. If enabled, the current falling below this level will trigger an alarm and an SMBALERT. 1.983uV/RSNSC per LSB (16 bits, R/W)
Format: icharge
- iin_oc_lvl
- Input Overcurrent Level: This is an alarm threshold for the input current. If enabled, the current rising above this level will trigger an alarm and an SMBALERT. 1.983uV/RSNSI per LSB (16 bits, R/W)
Format: iin
- meas_cap
- Measured capacitor stack capacitance value. When ctl_cap_scale is set to 1, capacitance is 3.36uF * RT/RTST per LSB. When ctl_cap_scale is set to 0 it is 336uF * RT/RTST per LSB. (16 bits, Read Only)
Format: cap
Format: cap_zs
- meas_dtemp
- Measured die temperature. Temperature = 0.028C per LSB - 251.4C (16 bits, Read Only)
Format: dtemp
Format: adc
- meas_esr
- Measured capacitor stack equivalent series resistance (ESR) value. RSNSC/64 per LSB (16 bits, Read Only)
Format: esr
- meas_gpi
- Measurement of GPI pin voltage. 183.5uV per LSB (16 bits, Read Only)
Format: NTCS0402E3103FLT
Format: cell
- meas_ichg
- Measured Charge Current. 1.983uV/RSNSC per LSB (16 bits, Read Only)
Format: icharge
Format: adc
- meas_iin
- Measured Input Current. 1.983uV/RSNSI per LSB (16 bits, Read Only)
Format: iin
Format: adc
- meas_vcap
- Measured Capacitor Stack Voltage. 1.476mV per LSB. (16 bits, Read Only)
Format: vcap
Format: adc
- meas_vcap1
- Measured voltage between the CAP1 and CAPRTN pins. 183.5uV per LSB (16 bits, Read Only)
Format: cell
- meas_vcap2
- Measured voltage between the CAP2 and CAP1 pins. 183.5uV per LSB (16 bits, Read Only)
Format: cell
- meas_vcap3
- Measured voltage between the CAP3 and CAP2 pins. 183.5uV per LSB (16 bits, Read Only)
Format: cell
- meas_vcap4
- Measured voltage between the CAP4 and CAP3 pins. 183.5uV per LSB (16 bits, Read Only)
Format: cell
- meas_vin
- Measured Input Voltage. 2.21mV per LSB (16 bits, Read Only)
Format: vin
Format: adc
- meas_vout
- Measured Output Voltage. 2.21mV per LSB. (16 bits, Read Only)
Format: vout
Format: adc
- mon_cap_done
- Capacitance measurement has completed (1 bit, Read Only)
- mon_cap_failed
- The last attempted capacitance measurement was unable to complete (1 bit, Read Only)
- mon_capesr_active
- Capacitance/ESR measurement is in progress (1 bit, Read Only)
- mon_capesr_pending
- Waiting for satisfactory conditions to begin a capacitance/ESR measurement (1 bit, Read Only)
- mon_capesr_scheduled
- Waiting programmed time to begin a capacitance/ESR measurement (1 bit, Read Only)
- mon_esr_done
- ESR Measurement has completed (1 bit, Read Only)
- mon_esr_failed
- The last attempted ESR measurement was unable to complete (1 bit, Read Only)
- mon_power_failed
- This bit is set when VIN falls below the PFI threshold or the charger is unable to charge. It is cleared only when power returns and the charger is able to charge. (1 bit, Read Only)
- mon_power_returned
- This bit is set when the input is above the PFI threshold and the charger is able to charge. It is cleared only when mon_power_failed is set. (1 bit, Read Only)
- mon_status
- Monitor Status: This register provides real time status information about the state of the monitoring system. Each bit is active high.
- msk_alarms
- Mask Alarms Register: Writing a one to any bit in the Mask Alarms Register enables its respective alarm to trigger an SMBALERT.
- msk_cap_lo
- Enable capacitance low alarm (1 bit, R/W)
- msk_cap_ov
- Enable capacitor over voltage alarm (1 bit, R/W)
- msk_cap_uv
- Enable capacitor undervoltage alarm (1 bit, R/W)
- msk_dtemp_cold
- Enable die temperature cold alarm (1 bit, R/W)
- msk_dtemp_hot
- Enable die temperature hot alarm (1 bit, R/W)
- msk_esr_hi
- Enable ESR high alarm (1 bit, R/W)
- msk_gpi_ov
- Enable GPI overvoltage alarm (1 bit, R/W)
- msk_gpi_uv
- Enable GPI undervoltage alarm (1 bit, R/W)
- msk_ichg_uc
- Enable charge undercurrent alarm (1 bit, R/W)
- msk_iin_oc
- Enable input overcurrent alarm (1 bit, R/W)
- msk_mon_cap_done
- Set the SMBALERT when there is a rising edge on mon_cap_done (1 bit, R/W)
- msk_mon_cap_failed
- Set the SMBALERT when there is a rising edge on mon_cap_failed (1 bit, R/W)
- msk_mon_capesr_active
- Set the SMBALERT when there is a rising edge on mon_capesr_active (1 bit, R/W)
- msk_mon_capesr_pending
- Set the SMBALERT when there is a rising edge on mon_capesr_pending (1 bit, R/W)
- msk_mon_capesr_scheduled
- Set the SMBALERT when there is a rising edge on mon_capesr_scheduled (1 bit, R/W)
- msk_mon_esr_done
- Set the SMBALERT when there is a rising edge on mon_esr_done (1 bit, R/W)
- msk_mon_esr_failed
- Set the SMBALERT when there is a rising edge on mon_esr_failed (1 bit, R/W)
- msk_mon_power_failed
- Set the SMBALERT when there is a rising edge on mon_power_failed (1 bit, R/W)
- msk_mon_power_returned
- Set the SMBALERT when there is a rising edge on mon_power_returned (1 bit, R/W)
- msk_mon_status
- Mask Monitor Status Register: Writing a one to any bit in this register enables a rising edge of its respective bit in the mon_status register to trigger an SMBALERT.
- msk_vcap_ov
- Enable VCAP overvoltage alarm (1 bit, R/W)
- msk_vcap_uv
- Enable VCAP undervoltage alarm (1 bit, R/W)
- msk_vin_ov
- Enable VIN overvoltage alarm (1 bit, R/W)
- msk_vin_uv
- Enable VIN undervoltage alarm (1 bit, R/W)
- msk_vout_ov
- Enable VOUT overvoltage alarm (1 bit, R/W)
- msk_vout_uv
- Enable VOUT undervoltage alarm (1 bit, R/W)
- num_caps
- Number of Capacitors. This register shows the state of the CAP_SLCT1, CAP_SLCT0 pins. The value read in this register is the number of capacitors programmed minus one. (2 bits, Read Only)
- num_caps_CMD
- vcap_ov_lvl
- VCAP Overvoltage Level: This is an alarm threshold for the capacitor stack voltage. If enabled, the voltage rising above this level will trigger an alarm and an SMBALERT. 1.476mV per LSB (16 bits, R/W)
Format: vcap
- vcap_uv_lvl
- VCAP Undervoltage Level: This is an alarm threshold for the capacitor stack voltage. If enabled, the voltage falling below this level will trigger an alarm and an SMBALERT. 1.476mV per LSB (16 bits, R/W)
Format: vcap
- vcapfb_dac
- VCAP Regulation Reference: This register is used to program the capacitor voltage feedback loop's reference voltage. Only bits 3:0 are active. CAPFBREF = 37.5mV * vcapfb_dac + 637.5mV (4 bits, R/W)
Format: vcapfb_dac_format
- vcapfb_dac_CMD
- vin_ov_lvl
- VIN Overvoltage Level: This is an alarm threshold for the input voltage. If enabled, the voltage rising above this level will trigger an alarm and an SMBALERT. 2.21mV per LSB (16 bits, R/W)
Format: vin
- vin_uv_lvl
- VIN Undervoltage Level: This is an alarm threshold for the input voltage. If enabled, the voltage falling below this level will trigger an alarm and an SMBALERT. 2.21mV per LSB (16 bits, R/W)
Format: vin
- vout_ov_lvl
- VOUT Overvoltage Level: This is an alarm threshold for the output voltage. If enabled, the voltage rising above this level will trigger an alarm and an SMBALERT. 2.21mV per LSB (16 bits, R/W)
Format: vout
- vout_uv_lvl
- VOUT Undervoltage Level: This is an alarm threshold for the output voltage. If enabled, the voltage falling below this level will trigger an alarm and an SMBALERT. 2.21mV per LSB (16 bits, R/W)
Format: vout
- vshunt
- Shunt Voltage Register: This register programs the shunt voltage for each capacitor in the stack. The charger will limit current and the active shunts will shunt current to prevent this voltage from being exceeded. As a capacitor voltage nears this level, the charge current will be reduced. This should be programmed higher than the intended final balanced individual capacitor voltage. Setting this register to 0x0000 disables the shunt. 183.5uV per LSB. (16 bits, R/W)
Format: cell
|
class ltc_dc590b_interface(__builtin__.object) |
|
Python Communication Interface for DC590B / Linduino.
Provides the following SMBus protocols with optional PEC (Packet Error Checking) CRC:
ReadWord
WriteWord
ReadByte
WriteByte
ReceiveByte
SendByte
AlertResponse
PEC implementation untested.
Requires PySerial. |
|
Methods defined here:
- __init__(self, serial_port, PEC=False, **kwargs)
- Provide serial port of attached Linear Technology DC590 I2C interface board or DC2026B Linduno board programmed with DC590 emulator sketch. kwargs will be passed to PySerial init unless serial_port is already configured.
- alert_response(self)
- SMBus Send Byte Protocol.
Packet Error Checking controlled by class init.
Slave device address specified in 7-bit format.
Returns None if no response to ARA, otherwise the 7-bit device address provided by the slave.
Returns transmit device address placed in the 7 most significant bits of the byte. The returned LSB will be zero in this implementation (Write address).
- read_byte(self, addr_7bit, command_code)
- SMBus Read Byte Protocol.
Packet Error Checking controlled by class init.
Slave device address specified in 7-bit format.
Returns 8-bit data from slave.
- read_word(self, addr_7bit, command_code)
- SMBus Read Word Protocol.
Packet Error Checking controlled by class init.
Slave device address specified in 7-bit format.
Returns 16-bit data from slave.
- receive_byte(self, addr_7bit)
- SMBus Receive Byte Protocol.
Packet Error Checking controlled by class init.
Slave device address specified in 7-bit format.
Returns 8-bit data from slave.
- send_byte(self, addr_7bit, data8)
- SMBus Send Byte Protocol.
Packet Error Checking controlled by class init.
Slave device address specified in 7-bit format.
Returns None.
- write_byte(self, addr_7bit, command_code, data8)
- SMBus Write Byte Protocol.
Packet Error Checking controlled by class init.
Slave device address specified in 7-bit format.
Returns None.
- write_word(self, addr_7bit, command_code, data16)
- SMBus Write Word Protocol.
Packet Error Checking controlled by class init.
Slave device address specified in 7-bit format.
Returns None.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
| |