imx7s obtaining battery charge state from BC3770 via userspace

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

imx7s obtaining battery charge state from BC3770 via userspace

815 Views
edwardtyrrell
Senior Contributor I

Hello,

Is there a way to obtain the BC3770's battery charge state from user-space on an imx7 ( warp7 based build )? I need to be able to feedback to the user the current state of the battery e.g. charged - still charging. Upower returns nothing usable ( it states that it's not even running on battery when it is ).

Daemon:
daemon-version: 0.9.14
can-suspend: yes
can-hibernate no
on-battery: no
on-low-battery: no
lid-is-closed: no
lid-is-present: no
is-docked: no

Thanks

Labels (5)
0 Kudos
3 Replies

578 Views
texierp
Contributor III

Hi edwardtyrrell‌,

Have you found any solutions regarding this topic ?
I am also interested but no more information in the data-sheet (http://www.nxp.com/assets/documents/data/en/data-sheets/MC32BC3770.pdf)

Thanks

Pierre-Jean

0 Kudos

578 Views
edwardtyrrell
Senior Contributor I

Hi, 

Yes in a way.. There doesn't seem to be any specific way but I2C does work. 

root@Warp7:~# i2cdump -y -r 0x00-0x0D 0 0x49 b
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00: 10 00 00 03 b8 ff 02 02 08 2f 08 4c 05 0f ?..??.???/?L??

Using the I2C command above it will dump out the register set contained within the BC3770's PDF.

The 'DONE' bit in only flagged within the interrupt register once and disappears after the first read so you need to catch it as there's not a lot else that states the battery has finished charging. One other trap is the I2C bus gets disabled to save power when running on battery so you won't get the I2C output mentioned above with the USB charging lead not connected. Also the I2C device addresses are >> 1 bit because the r/w bit sits at bit 0 making the BC3770 0x49 instead of 0x92/0x93. I'm going to use a cross-compiled C app to read the I2C bus directly to monitor the BC3770 plus flick a few LEDs etc.

Hope this helps,

Ed.

578 Views
art
NXP Employee
NXP Employee

Typically, a battery returns its status through some I2C-like control interface. Check what I2C devices are available in the system.


Have a great day,
Artur

0 Kudos