Skip to contentSkip to conversation

bq2415x_charger.c: battery is discharged (fast, 224mA) when it should be charged

DISCUSSION Pavel Machek 2 participants 5 messages Feb 1, 2015

lore
Share & tools
lore
#0 lore raw

Hi!

I connected N900 with full battery using USB. For some reason, charge limit was set to 100mA, battery was "full" and was discharging:

root at n900:/my/tui/ofone# ./tefone
Ready.
Battery 4.017 V 4.039 V 81 % 0 % 0 / 0 / 2056 mAh Full -242.224 / 550 / 100 mA

I adjusted the current limit, but got no change, battery is still discharging, fast:

root at n900:/my/tui/ofone# echo 500 > /sys/class/power_supply/bq24150a-0/current_limit root at n900:/my/tui/ofone# ./tefone
Ready.

Battery  3.994 V  4.034 V  78 %  0 %  0 / 0 / 2056 mAh  Full   -251.506 / 550 / 500  mA
Battery  4.0 V  4.037 V  79 %  0 %  0 / 0 / 2056 mAh  Full   -223.125 / 550 / 500  mA
Battery  4.005 V  4.037 V  79 %  0 %  0 / 0 / 2056 mAh  Full   -224.91 / 550 / 500  mA
Battery  3.994 V  4.037 V  78 %  0 %  0 / 0 / 2056 mAh  Full   -224.91 / 550 / 500  mA
Battery  4.023 V  4.037 V  81 %  0 %  0 / 0 / 2056 mAh  Full   -224.91 / 550 / 500  mA
Battery  4.011 V  4.037 V  80 %  0 %  0 / 0 / 2056 mAh  Full   -224.91 / 550 / 500  mA
Battery  3.994 V  4.031 V  78 %  0 %  0 / 0 / 2056 mAh  Full   -256.504 / 550 / 500  mA
Battery  3.994 V  4.029 V  78 %  0 %  0 / 0 / 2056 mAh  Full   -224.017 / 550 / 500  mA
Battery  3.988 V  4.029 V  77 %  0 %  0 / 0 / 2056 mAh  Full   -224.731 / 550 / 500  mA
Battery  4.005 V  4.023 V  79 %  0 %  0 / 0 / 2056 mAh  Full   -223.66 / 550 / 500  mA

I'm getting a lot of

[  208.037719] bq27x00-battery 2-0055: battery is not calibrated! ignoring capacity values
[  238.038024] bq27x00-battery 2-0055: battery is not calibrated! ignoring capacity values

messages, that's why all the 0s in battery information dump.

Any ideas?

Thanks,
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#1 lore raw

Hello,

Quoted 6 lines · On Sunday 01 February 2015 10:47:02 Pavel Machek wrote:

Hi!

I connected N900 with full battery using USB. For some reason, charge limit was set to 100mA, battery was "full" and was discharging:

Make sure you have loaded some usb gadget. Without it battery charging via dedicated wallcharger (and probably also usb host charger) does not working. g_nokia should be OK.

Try also compiling kernel with CONFIG_USB_GADGET_VBUS_DRAW=500

Also for charger autodetection you need to have loaded isp1704_charer.ko module (or compiled into kernel).

And make sure that isp1704_charger is loaded before module bq2415x_charger (there is some probe defer, no idea if it works as excepted).

Quoted 10 lines

root at n900:/my/tui/ofone# ./tefone
Ready.
Battery 4.017 V 4.039 V 81 % 0 % 0 / 0 / 2056 mAh Full -242.224 / 550 / 100 mA

I adjusted the current limit, but got no change, battery is still discharging, fast:

root at n900:/my/tui/ofone# echo 500 >
/sys/class/power_supply/bq24150a-0/current_limit

You can try to write "host" to sysfs entry "mode". Another value is "dedicated" for wallchargers.

Quoted 18 lines

root at n900:/my/tui/ofone# ./tefone
Ready.
Battery 3.994 V 4.034 V 78 % 0 % 0 / 0 / 2056 mAh Full -251.506 / 550 / 500 mA Battery 4.0 V 4.037 V 79 % 0 %

0 / 0 / 2056 mAh  Full   -223.125 / 550 / 500  mA Battery 
4.005 V  4.037 V  79 %  0 %  0 / 0 / 2056 mAh  Full   -224.91

/ 550 / 500 mA Battery 3.994 V 4.037 V 78 % 0 % 0 / 0 /
2056 mAh Full -224.91 / 550 / 500 mA Battery 4.023 V
4.037 V 81 % 0 % 0 / 0 / 2056 mAh Full -224.91 / 550 /
500 mA Battery 4.011 V 4.037 V 80 % 0 % 0 / 0 / 2056
mAh Full -224.91 / 550 / 500 mA Battery 3.994 V 4.031 V
78 % 0 % 0 / 0 / 2056 mAh Full -256.504 / 550 / 500 mA
Battery 3.994 V 4.029 V 78 % 0 % 0 / 0 / 2056 mAh Full
-224.017 / 550 / 500 mA Battery 3.988 V 4.029 V 77 % 0
% 0 / 0 / 2056 mAh Full -224.731 / 550 / 500 mA Battery
4.005 V 4.023 V 79 % 0 % 0 / 0 / 2056 mAh Full -223.66
/ 550 / 500 mA

Quoted 7 lines

I'm getting a lot of

[  208.037719] bq27x00-battery 2-0055: battery is not

calibrated! ignoring capacity values [ 238.038024] bq27x00-battery 2-0055: battery is not calibrated! ignoring capacity values

Message is print every time when somebody try to read those properties. I think that printing it only one time should be enough. Change to WARN_ONCE?

Also design capacity from bq27x00_battery is incorrect (2056) on all N900 devices. It comes from some EEPROM memory stored in N900 and without HW hacking it is not possible to rewrite.

I would suggest to add support for bq27x00_battery module to do not report design capacity. Maybe in N900 DT file can be property which tell driver to ignore it.

Quoted 6 lines

messages, that's why all the 0s in battery information dump.

Any ideas?

Thanks,
Pavel

Signature · 9 lines
Pali Roh?r
pali.rohar at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150201/d652accd/attachment.sig>
#2 lore raw

Hi!

Quoted 11 lines · Pali Roh?r
Quoted 6 lines · On Sunday 01 February 2015 10:47:02 Pavel Machek wrote:

Hi!

I connected N900 with full battery using USB. For some reason, charge limit was set to 100mA, battery was "full" and was discharging:

Make sure you have loaded some usb gadget. Without it battery charging via dedicated wallcharger (and probably also usb host charger) does not working. g_nokia should be OK.

I had that loaded (was running from root over USB at the moment.)

Quoted 8 lines

Try also compiling kernel with CONFIG_USB_GADGET_VBUS_DRAW=500

Also for charger autodetection you need to have loaded isp1704_charer.ko module (or compiled into kernel).

And make sure that isp1704_charger is loaded before module bq2415x_charger (there is some probe defer, no idea if it works as excepted).

It seems bq2415x_charger is the problem: it all started working when I did echo reset > mode...

Best regards,
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#3 lore raw
Quoted 22 lines · Pavel Machek

Hi!

Quoted 11 lines · Pali Roh?r
Quoted 6 lines · On Sunday 01 February 2015 10:47:02 Pavel Machek wrote:

Hi!

I connected N900 with full battery using USB. For some reason, charge limit was set to 100mA, battery was "full" and was discharging:

Make sure you have loaded some usb gadget. Without it battery charging via dedicated wallcharger (and probably also usb host charger) does not working. g_nokia should be OK.

I had that loaded (was running from root over USB at the moment.)

Quoted 5 lines

Try also compiling kernel with CONFIG_USB_GADGET_VBUS_DRAW=500

Also for charger autodetection you need to have loaded isp1704_charer.ko module (or compiled into kernel).

Quoted 6 lines
Quoted 3 lines

And make sure that isp1704_charger is loaded before module bq2415x_charger (there is some probe defer, no idea if it works as excepted).

It seems bq2415x_charger is the problem: it all started working when I did echo reset > mode...

It does not switch from "Full" to "Charging", and it does not seem to switch from "Charging" to "Full", either...:

root at n900:/my/tui/ofone# ./tefone
Ready.

Battery  4.152 V  4.161 V  95 %  0 %  0 / 0 / 2056 mAh  Charging   40.876 / 650 / 500  mA
Battery  4.152 V  4.161 V  95 %  0 %  0 / 0 / 2056 mAh  Charging   48.195 / 650 / 500  mA
Battery  4.152 V  4.164 V  95 %  0 %  0 / 0 / 2056 mAh  Charging   43.554 / 650 / 500  mA
Battery  4.14 V  4.164 V  94 %  0 %  0 / 0 / 2056 mAh  Charging   40.162 / 650 / 500  mA
Battery  4.158 V  4.172 V  95 %  0 %  0 / 0 / 2056 mAh  Charging   54.621 / 650 / 500  mA
Battery  4.158 V  4.175 V  95 %  0 %  0 / 0 / 2056 mAh  Charging   33.736 / 650 / 500  mA
aHello, world
Battery  4.164 V  4.175 V  96 %  0 %  0 / 0 / 2056 mAh  Charging   2.142 / 650 / 500  mA
Battery  4.164 V  4.177 V  96 %  0 %  0 / 0 / 2056 mAh  Charging   19.992 / 650 / 500  mA
Battery  4.158 V  4.177 V  95 %  0 %  0 / 0 / 2056 mAh  Charging   18.207 / 650 / 500  mA
Battery  4.158 V  4.177 V  95 %  0 %  0 / 0 / 2056 mAh  Charging   17.493 / 650 / 500  mA
Battery  4.164 V  4.177 V  96 %  0 %  0 / 0 / 2056 mAh  Charging   16.243 / 650 / 500  mA
Battery  4.158 V  4.177 V  95 %  0 %  0 / 0 / 2056 mAh  Charging   16.243 / 650 / 500  mA
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#4 lore raw
In reply to Pavel Machek
Quoted 26 lines · Pavel Machek

Hi!

I connected N900 with full battery using USB. For some reason, charge limit was set to 100mA, battery was "full" and was discharging:

root at n900:/my/tui/ofone# ./tefone
Ready.
Battery 4.017 V 4.039 V 81 % 0 % 0 / 0 / 2056 mAh Full -242.224 / 550 / 100 mA

I adjusted the current limit, but got no change, battery is still discharging, fast:

root at n900:/my/tui/ofone# echo 500 > /sys/class/power_supply/bq24150a-0/current_limit root at n900:/my/tui/ofone# ./tefone
Ready.

Battery  3.994 V  4.034 V  78 %  0 %  0 / 0 / 2056 mAh  Full   -251.506 / 550 / 500  mA
Battery  4.0 V  4.037 V  79 %  0 %  0 / 0 / 2056 mAh  Full   -223.125 / 550 / 500  mA
Battery  4.005 V  4.037 V  79 %  0 %  0 / 0 / 2056 mAh  Full   -224.91 / 550 / 500  mA
Battery  3.994 V  4.037 V  78 %  0 %  0 / 0 / 2056 mAh  Full   -224.91 / 550 / 500  mA
Battery  4.023 V  4.037 V  81 %  0 %  0 / 0 / 2056 mAh  Full   -224.91 / 550 / 500  mA
Battery  4.011 V  4.037 V  80 %  0 %  0 / 0 / 2056 mAh  Full   -224.91 / 550 / 500  mA
Battery  3.994 V  4.031 V  78 %  0 %  0 / 0 / 2056 mAh  Full   -256.504 / 550 / 500  mA
Battery  3.994 V  4.029 V  78 %  0 %  0 / 0 / 2056 mAh  Full   -224.017 / 550 / 500  mA
Battery  3.988 V  4.029 V  77 %  0 %  0 / 0 / 2056 mAh  Full   -224.731 / 550 / 500  mA
Battery  4.005 V  4.023 V  79 %  0 %  0 / 0 / 2056 mAh  Full   -223.66 / 550 / 500  mA
Quoted 8 lines

I'm getting a lot of

[  208.037719] bq27x00-battery 2-0055: battery is not calibrated! ignoring capacity values
[  238.038024] bq27x00-battery 2-0055: battery is not calibrated! ignoring capacity values

messages, that's why all the 0s in battery information dump.

Any ideas?

Reset kicked the charger back into the charging mode:

root at n900:/sys/class/power_supply/bq24150a-0# echo reset > mode root at n900:/sys/class/power_supply/bq24150a-0# cat mode auto (host)
root at n900:/sys/class/power_supply/bq24150a-0#

Battery  4.017 V  4.037 V  81 %  0 %  0 / 0 / 2056 mAh  Charging -109.42 / 650 / 500  mA
Battery  4.017 V  4.039 V  81 %  0 %  0 / 0 / 2056 mAh  Charging -103.173 / 650 / 500  mA

...and discharge current reduced. I tried adjusting current limit, but it still discharges at 100mA (with screen on).

USB extension cable was probably part of a problem. It works better with n900 plugged in directly into the PC.

(But it still will not terminate the charge:

Battery  4.158 V  4.177 V  95 %  0 %  0 / 0 / 2056 mAh  Charging   13.03 / 650 / 500  mA
Battery  4.164 V  4.177 V  96 %  0 %  0 / 0 / 2056 mAh  Charging   13.03 / 650 / 500  mA
Battery  4.164 V  4.177 V  96 %  0 %  0 / 0 / 2056 mAh  Charging   10.888 / 650 / 500  mA
Battery  4.164 V  4.177 V  96 %  0 %  0 / 0 / 2056 mAh  Charging   1.249 / 650 / 500  mA
Battery  4.164 V  4.177 V  96 %  0 %  0 / 0 / 2056 mAh  Charging   10.353 / 650 / 500  mA
Battery  4.158 V  4.177 V  95 %  0 %  0 / 0 / 2056 mAh  Charging   9.639 / 650 / 500  mA
Battery  4.164 V  4.177 V  96 %  0 %  0 / 0 / 2056 mAh  Charging   10.71 / 650 / 500  mA
Battery  4.164 V  4.177 V  96 %  0 %  0 / 0 / 2056 mAh  Charging   7.497 / 650 / 500  mA
Battery  4.158 V  4.177 V  95 %  0 %  0 / 0 / 2056 mAh  Charging   9.639 / 650 / 500  mA
Battery  4.164 V  4.177 V  96 %  0 %  0 / 0 / 2056 mAh  Charging   6.247 / 650 / 500  mA
Battery  4.164 V  4.177 V  96 %  0 %  0 / 0 / 2056 mAh  Charging   5.533 / 650 / 500  mA
Battery  4.164 V  4.177 V  96 %  0 %  0 / 0 / 2056 mAh  Charging   4.284 / 650 / 500  mA
Battery  4.164 V  4.177 V  96 %  0 %  0 / 0 / 2056 mAh  Charging   4.284 / 650 / 500  mA
Battery  4.164 V  4.177 V  96 %  0 %  0 / 0 / 2056 mAh  Charging   3.927 / 650 / 500  mA

)

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html