Hey Fred,
Here are some answers to your questions:
1. I have attached a LiPo battery from a Pentax camera that has a built-in
10K thermistor and I put a 75k resistor across the T signal and ground on
the pocketbeagle. I also added a 10 uF electrolytic cap between Vbatt and
ground on the pocketbeagle per the tps65217 datasheet.
2. You can use the i2c utilities to get/set values. For example to read
CHGCONFIG2 and then reconfigure it for a 4.2v charge level
i2cget -y -f 0 0x24 0x5
i2cset -y -f 0 0x24 0x5 0xB0
3. I also added all the relevant registers to a python script I found in
pehrtree's beaglebone-snippets
<https://github.com/pehrtree/beaglebone_snippets> github repostory. My
version is attached here. A typical output is shown below. You can see
that all looks good on my pocketbeagle and as I type this, it is happily
sucking down around 690 mA from a lab USB power supply (which makes sense
based on readings I've made w/o a battery - ~180-200 mA for the
pocketbeagle and attached USB WiFi dongle + 500 mA for battery charge
current).
debian@beaglebone:~$ python powerstatus.py
Querying Beaglebone Black Power Management IC on i2c-0 device 0x24
On battery power only? 0
Charging Battery? 1
PPATH: r[0x1]=0x3f
USB Input current bit 0 = 1
USB Input current bit 1 = 1
AC Input current bit 0 = 1
AC Input current bit 1 = 1
USB Power Path enable = 1
AC Power Path enable = 1
USB current-sink = 0
AC current-sink = 0
STATUS: r[0xa]=0x84
Push Button = 0
USB Power = 1
AC Power = 0
CFGCONFIG0: r[0x3]=0x8
Temp sense error = 0
Pre-charge Timedout = 0
Charge Timedout = 0
Active (charging) = 1
Charge Termination Current = 0
Thermal Suspend = 0
DPPM Reduction = 0
Thermal Regulation = 0
CFGCONFIG1: r[0x4]=0xb1
Charger Enable = 1
Suspend Charge = 0
Charge Termination = 0
Charger Reset = 0
NTC Type = 1
Safety Timer = 1
Safety Timer 0 = 0
Safety Timer 1 = 1
CFGCONFIG2: r[0x5]=0xb0
Charger Voltage Bit 0 = 1
Charger Voltage Bit 1 = 1
Precharge Voltage = 0
Dynamic Timer = 1
CFGCONFIG3: r[0x6]=0xb2
Temperature Range = 0
Term current factor bit 0 = 1
Term current factor bit 1 = 0
Precharge Time = 0
DPPM Threshold bit 0 = 1
DPPM Threshold bit 1 = 1
Charge Current bit 0 = 0
Charge Current bit 1 = 1
PGOOD: r[0xc]=0x7f
LDO2 power-good = 1
LDO1 power-good = 1
DCDC3 power-good = 1
DCDC2 power-good = 1
DCDC1 power-good = 1
LDO4 power-good = 1
LDO3 power-good = 1
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/beagleboard/3cc303b2-2a41-4d58-ac7b-983f373e5f12%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
#!/usr/bin/python
## Read some values from the PMIC and print out what we find
### example i2cget -y -f 0 0x24 0x3
import subprocess
I2C_DEVICE = 0
CHIP_ADDRESS = 0x24
# register addresses we are interested in
PPATH = 0x1
CHGCONFIG0 = 0x3
CHGCONFIG1 = 0x4
CHGCONFIG2 = 0x5
CHGCONFIG3 = 0x6
STATUS = 0xA
PGOOD = 0xC
# some bitmasks
STATUS_AC = 1<<3
STATUS_USB = 1<<2
CHGCONFIG0_ACTIVE = 1<<3 # we are charging the battery
# these labels are interpreted from the TPS65217 datasheet
PPATH_LABELS = ["USB Input current bit 0", "USB Input current bit 1", "AC Input current bit 0", "AC Input current bit 1", "USB Power Path enable", "AC Power Path enable", "USB current-sink", "AC current-sink"]
CHG0_LABELS = ["Temp sense error","Pre-charge Timedout","Charge Timedout","Active (charging)","Charge Termination Current","Thermal Suspend", "DPPM Reduction","Thermal Regulation"]
CHG1_LABELS = ["Charger Enable", "Suspend Charge", "Charge Termination", "Charger Reset", "NTC Type", "Safety Timer", "Safety Timer 0", "Safety Timer 1"]
CHG2_LABELS = [None, None, None, None, "Charger Voltage Bit 0", "Charger Voltage Bit 1", "Precharge Voltage", "Dynamic Timer"]
CHG3_LABELS = ["Temperature Range", "Term current factor bit 0", "Term current factor bit 1", "Precharge Time", "DPPM Threshold bit 0", "DPPM Threshold bit 1", "Charge Current bit 0", "Charge Current bit 1"]
STATUS_LABELS=["Push Button",None,"USB Power", "AC Power"]# skip the rest
PGOOD_LABELS=["LDO2 power-good","LDO1 power-good","DCDC3 power-good","DCDC2 power-good","DCDC1 power-good", "LDO4 power-good","LDO3 power-good"]
# get the I2C register, strip off \n and cast to int from hex
# -y means non-interactive mode (just do it!)
# -f forces the connection
def query(reg=0):
return int(subprocess.check_output(["i2cget","-y" ,"-f", str(I2C_DEVICE), str(CHIP_ADDRESS), str(reg)]).strip(),16)
# display value of each bit in the register, along with its label
def describe_bits(val,labels):
for x in range(0,len(labels)):
if(not labels[x]): # skip None labels
continue
msk = 1<<x
print "%s = %d"%(labels[x],(val&msk)!=0)
# query a register, print out value breakdown
def show_reg(reg,title,labels):
val = query(reg)
print
print "%s: r[0x%x]=0x%x\r\n"%(title,reg,val)
describe_bits(val,labels)
print
# specific helpers
def onBattery():
return query(STATUS) & (STATUS_AC | STATUS_USB) == 0
def charging():
return query(CHGCONFIG0) & (CHGCONFIG0_ACTIVE) !=0
if __name__ == "__main__":
print "Querying Beaglebone Black Power Management IC on i2c-%s device 0x%x"%(I2C_DEVICE, CHIP_ADDRESS)
print "On battery power only? %d\r\n"%onBattery()
print "Charging Battery? %d\r\n"%charging()
show_reg(PPATH,"PPATH",PPATH_LABELS)
show_reg(STATUS,"STATUS",STATUS_LABELS)
show_reg(CHGCONFIG0,"CFGCONFIG0",CHG0_LABELS)
show_reg(CHGCONFIG1,"CFGCONFIG1",CHG1_LABELS)
show_reg(CHGCONFIG2,"CFGCONFIG2",CHG2_LABELS)
show_reg(CHGCONFIG3,"CFGCONFIG3",CHG3_LABELS)
show_reg(PGOOD,"PGOOD",PGOOD_LABELS)