batteryService on mangOH Red


#1

Hi,

I am having trouble getting API for battery charger working. I have looked at:



(Since batteryClient is dependent on batteryService)

There are some issues on batteryService though, I cannot find /sys/devices/i2c-0/i2c-2/2-0064/power_supply/LTC2942 anywhere. Is this only for the Green board? If so, is there a working API available or should I configure the existing one?

Or do you even need to run anything for battery to charge on Red? Or is it enough to have a chargeable battery connected and board connected to PC for example? Thanks!


#2

If all you want to charge the battery, then pull pin 5 of SW401 high. This will enable charging using battery charger.
Only Single Li-Po battery supported.

Once you connect a battery, you should be able to see the LTC2942 in the /sys/device. For now, I would recommend not using the BatteryService api itself.


#3

Hi @asyal,

Thanks for the answer! Sorry I was probably a little unclear in my question. I would like to run the board on battery (removed the jumper from CN804) and recharge battery when connected to a power source (pin 5 is on). From the docs I also understood that you can recharge using the API, but maybe it is not needed?
And from what power source can you charge it, can you use both CF3 USB and Console USB?

Oh only Li-Po batteries are supported. I have a Li-Ion in use. Maybe this is why I cannot find LTC2942 under /sys/device. According to the batteryService API both Li-Po and Li-Ion batteries are supported, but only Li-Po for the Red I suppose?


#4

Lithium Ion should be ok. Check the specs of bq24296 charger.

Did you plug your battery in and then see that Ltc is not detected?


#5

Yes, could only find the paths:
/sys/devices/i2c-0/i2c-2/2-006b/power_supply/bq24190-charger
/sys/devices/i2c-0/i2c-2/2-006b/power_supply/bq24190-battery

but there is no /sys/devices/i2c-0/i2c-2/2-0064 path available, or any other with LTC2942.
Do you need jumper on CN804 for it to charge though?


#6

Update: Charging battery works when jumper used on CN804, I just misunderstood the docs.
But I can still not find LTC


#7

Do you have the latest git repo?

Do you see the driver loading when you do dmesg?


#8

Which git repo are you referring to? Legato? I have legato 17.09 installed, I guess a newer has just recently become available.

I am not exactly sure what I am looking for in dmesg, but grepped i2c and got this:

[ 0.186113] unmatched machine ID in register_i2c_devices
[ 0.959987] swimcu_i2c_init: start
[ 0.963253] swimcu_i2c_probe: start 1
[ 0.975644] qup_i2c qup_i2c.0: QUP: I2C status flags :0x1343c8, irq:187
[ 0.981931] qup_i2c qup_i2c.0: I2C slave addr:0x3a not connected
[ 1.957881] wm8944_i2c_init
[ 1.957942] wm8944_i2c_probe
[ 1.988310] i2c-core: driver [tabla-i2c-core] using legacy suspend method
[ 1.994079] i2c-core: driver [tabla-i2c-core] using legacy resume method
[ 2.726781] i2c /dev entries driver
[ 16.177079] qup_i2c qup_i2c.0: QUP: I2C status flags :0x1363c8, irq:187
[ 16.182847] qup_i2c qup_i2c.0: I2C slave addr:0x3a not connected
[ 25.566000] i2c i2c-0: Added multiplexed i2c bus 1
[ 25.586052] i2c i2c-0: Added multiplexed i2c bus 2
[ 25.628200] i2c i2c-0: Added multiplexed i2c bus 3
[ 25.653502] i2c i2c-0: Added multiplexed i2c bus 4
[ 114.556600] qup_i2c qup_i2c.0: QUP: I2C status flags :0x1300c8, irq:187
[ 114.562734] qup_i2c qup_i2c.0: I2C slave addr:0x3a not connected
[ 928.615199] qup_i2c qup_i2c.0: QUP: I2C status flags :0x1300c8, irq:187
[ 928.621394] qup_i2c qup_i2c.0: I2C slave addr:0x3a not connected

And it just continues with 0x3a not connected.


#9

Can show result of dmesg?


#10

Attached a file of dmesg
dmesg (32.0 KB)


#11

I built the .sdef file from mangOH git (mangOH_Red.sdef), and just checked it again. Found this:

// Disabled until Release 15 is released due to bug in power supply kernel support
// $MANGOH_ROOT/apps/BatteryService/batteryService

Is there a issue on mangOH red and the PS kernel support?


#12

There is an issue with the kernel, but it should only affect the validity of the data in sysfs. The device should still be present. Can you confirm that the mangOH Red you have says revision 5.0 on the PCB?


#13

Yes @dfrey, it says Revision 5.0 on the PCB.
Could it have something to do that I built it from the mangOH_Red.sdef?

I am using a Varta Microbattery. 2030mAh, 3,7V, 7,5Wh


#14

Does the system power up when you only connect the battery?


#15

Yes, it powers up with only battery connected. And battery also charges.


#16

Hi @asyal and @dfrey,

Do you have any ideas on how to solve this. Tried now on another mangOH Red with WP8548 (same as the other) and cannot find /sys/devices/i2c-0/i2c-2/2-0064/power_supply/LTC2942

When installing batteryService app, and starting. I get error:

Jan 6 17:37:24 | supervisor[3788]/supervisor T=main | app.c CreateFileLink() 1478 | Could not stat file at '/sys/devices/i2c-0/i2c-2/2-0064/power_supply/LTC2942/charge_counter'. No such file or directory Jan 6 17:37:24 | supervisor[3788]/supervisor T=main | app.c CreateFileLink() 1581 | Failed to create link at '/sys/devices/i2c-0/i2c-2/2-0064/power_supply/LTC2942/charge_counter' in app 'batteryService'.

Again, is there perhaps something wrong with the kernel on Revision 14 firmware for this module? Thanks!


#17

I would like to use the battery API, and I am getting the same errors as well. After inserting the battery and ls of the LTC2942 folder, I get the following. Is there no way to find out the charge level?

ls -l /sys/devices/i2c-0/i2c-2/2-0064/power_supply/LTC2942/
-rw-r--r--    1 root     root          4096 Jan  6 00:07 charge_avg
-r--r--r--    1 root     root          4096 Jan  6 00:07 constant_charge_current
lrwxrwxrwx    1 root     root             0 Jan  6 00:07 device -> ../../../2-0064
drwxr-xr-x    2 root     root             0 Jan  6 00:07 power
-r--r--r--    1 root     root          4096 Jan  6 00:07 scope
lrwxrwxrwx    1 root     root             0 Jan  6 00:07 subsystem -> ../../../../../../class/power_supply
-r--r--r--    1 root     root          4096 Jan  6 00:07 temp_alert_min
-rw-r--r--    1 root     root          4096 Jan  6 00:05 uevent
-r--r--r--    1 root     root          4096 Jan  6 00:07 voltage_avg

Thanks


#18

Hi @asyal

Do you perhaps have an idea when this feature would be implemented? It is difficult to create IoT solutions when I cannot run them on battery.

Thanks


#19

Hi Xeset,

At this moment, you will need to rebuild yocto to make LTC driver work with WP76. If you can do so, we can provide you the steps.

Regards,
Ashish


#20

Hey @asyal,

Is this required for the WP85 as well? I can see the module is loaded by running lsmod (it shows 0_ltc294x 5520 0 - Live 0xbf168000 (O)), but Iā€™m still not seeing the device (Failed to create link at '/sys/devices/i2c-0/i2c-2/2-0064/power_supply/LTC2942/charge_counter' in app 'batteryService'.). If this is required I would really appreciate some instructions on how to go about this.

Thanks!