I found out that recharging the battery through the iMX283 PMU takes much more than expected, so I put a current meter in series with my LiPo battery and now I'm trying to measure the charge current in different situations.
Discharge current is around 280mA - 320mA when no 5V power source is active.
I modified the kernel driver for our custom board to use a charge current limit of 300mA and I can see debug messages when 5V is connected, that show the current actually ramp up to 300mA:
Battery charger: setting max chargecurrent to: 300mA
When I boot from battery power, then attach the 5V source, the charge current is around 210mA
When I boot from 5V power, I can see the charge current riseup to around 310mA
Removing the 5V source and then putting it back on does not change the above figures. So I think something happens during the "boot_prep" stage that influences how the kernel driver handles the charge current.
I went on and tried to do a register dump in the above two cases, but I don't get any significative difference, or at least I can't see it. Here are the two dumps:
- Boot from battery, then connected 5V (charge current stops at 210mA)
root@pwm-term ~$ ./memtool 80044000 60
Reading 0x60 count starting at address 0x80044000
0x80044000: 00278548 00278548 00278548 00278548
0x80044010: 00024513 00024513 00024513 00024513
0x80044020: 00000040 00000040 00000040 00000040
0x80044030: 00000318 00000318 00000318 00000318
0x80044040: 0002041E 0002041E 0002041E 0002041E
0x80044050: 0000270C 0000270C 0000270C 0000270C
0x80044060: 00002608 00002608 00002608 00002608
0x80044070: 00000230 00000230 00000230 00000230
0x80044080: A0C00001 A0C00001 A0C00001 A0C00001
0x80044090: 00000000 00000000 00000000 00000000
0x800440A0: 0000305F 0000305F 0000305F 0000305F
0x800440B0: 00167021 00167021 00167021 00167021
0x800440C0: 03078A2E 03078A2E 03078A2E 03078A2E
0x800440D0: 00000700 00000700 00000700 00000700
0x800440E0: 01F90E0F 01F90E0F 01F90E0F 01F90E0F
0x800440F0: 00000000 00000000 00000000 00000000
0x80044100: 00000000 00000000 00000000 00000000
0x80044110: 00000000 00000000 00000000 00000000
0x80044120: 00000080 00000080 00000080 00000080
0x80044130: 0000000E 0000000E 0000000E 0000000E
0x80044140: 00000000 00000000 00000000 00000000
0x80044150: 04000000 04000000 04000000 04000000
0x80044160: 84000400 84000400 84000400 84000400
0x80044170: 00000000 00000000 00000000 00000000
- Boot from 5V (charge current reaches 310mA):
root@pwm-term ~$ ./memtool 80044000 60
Reading 0x60 count starting at address 0x80044000
0x80044000: 00278548 00278548 00278548 00278548
0x80044010: 04024513 04024513 04024513 04024513
0x80044020: 00000040 00000040 00000040 00000040
0x80044030: 00000318 00000318 00000318 00000318
0x80044040: 0002041E 0002041E 0002041E 0002041E
0x80044050: 0000270C 0000270C 0000270C 0000270C
0x80044060: 00002608 00002608 00002608 00002608
0x80044070: 00000230 00000230 00000230 00000230
0x80044080: A0C00001 A0C00001 A0C00001 A0C00001
0x80044090: 00000000 00000000 00000000 00000000
0x800440A0: 0000305F 0000305F 0000305F 0000305F
0x800440B0: 00167021 00167021 00167021 00167021
0x800440C0: 20078A2E 20078A2E 20078A2E 20078A2E
0x800440D0: 00000600 00000600 00000600 00000600
0x800440E0: 02050E0F 02050E0F 02050E0F 02050E0F
0x800440F0: 00000000 00000000 00000000 00000000
0x80044100: 3E770000 3E770000 3E770000 3E770000
0x80044110: 00000000 00000000 00000000 00000000
0x80044120: 00000080 00000080 00000080 00000080
0x80044130: 0000000E 0000000E 0000000E 0000000E
0x80044140: 00000000 00000000 00000000 00000000
0x80044150: 04000000 04000000 04000000 04000000
0x80044160: 84000400 84000400 84000400 84000400
0x80044170: 00000000 00000000 00000000 00000000
The first difference is 0x80044010: 00024513 <> 04024513 which is a different VBUSDROOP_TRSH settings (4.3V against 4.5V)
Then 0x800440C0: 03078A2E <> 20078A2E which is simply the power up source (PSWITCH for battery boot, VDD5V for 5V boot)
0x800440E0 is the battery voltage, which of course is different
0x80044100: 3E770000 means that the reset unlock key has been written
0x800440D0 is somewhat mysterious, as no documentation is provided to decode the DC/DC internal status.
I found this to be 00000600 or 00000400 or 00000700, but without any relation to the boot source.
So the question is:
Why do I get a different charge current, lower than expected, if I boot from the battery?
What other registers, other than the HW_POWER group, should I check?
I am using the 2.6.35.3_1.1.0 release, with some patches to support our custom board.
I am providing 5V power through the USB connection.
The battery charge level and voltage is around the same when I perform these tests and is not related to the problem.
I always get around 100mA less charge current then I expected, when booting off the battery and applying 5V later on, after kernel initializes.
Suggestions?
Thanks,
Paolo