Battery management from User space

Started by kbenni, January 16, 2014, 02:37:47 PM

Previous topic - Next topic

kbenni

Hi.
Im developping an application on olinuxino nano. I have problems with battery charging.
How can I get information about battery charging and voltage from user space?
I found that it is possible to configure battery handling in power_prep.c, but how can i acces these functions from program?
thanks

lambda

The battery voltage is available as channel 7 of the LRADC.

AFAIK currently there is no driver for controlling the actual
charging. You schould be able to enable/disable charging via
/dev/mem, but the right thing to do would be writting a proper
kernel driver.

HTH,
Harald

f2zubac

Hello

Search Google for 'raspberry usb ups' or similar key word.
There are project acting as 'usb ups' appliances which can provide a lot of infos via GPIO or similar interfaces.

Sincerely

Dragan Zubac

kbenni

#3
I searched a litte bit, but i cant find any LRADC driver, or even power management driver.
They realy doesnt exist or can somebody help to me.
I found some attemps of porting imx28 LRADC driver to imx23 but they are not completed.
I need it for kernel 3.12.1

to Zubac: I dont understand, why i need to search about ups ups? imx23 has battery charge circuit and everything for baterry management

lambda

The LRADC driver is called mxs-lradc and is in staging. In the
kernel source tree you should find it in
drivers/staging/iio/adc/mxs-lradc.c

There have been some recent improvements, but everything you
need should work in 3.12 - I'm using it in my projects all the
time and am familiar with the code, so if you need some
yet unsupportet feature: Feel free to ask. (I won't backport
new features to 3.12 though ...)

You are right that the power managment driver is still missing.
I don't know if somebody is working on that already - probably
not. Maybe you can write one? (For kernel development you will
want to switch to very new kernels.)

HTH,
Harald

f2zubac

Hello

Yes,imx233 has LiPo charger and battery socket,but how to do the following :

1. How to be alerted when you battery is 'dying' ?
2. How to be alerted when the board power switch from power to battery and vice verse ?
3. How to monitor battery voltage and have a chance to react in time ?

Sincerely

Dragan Zubac

lambda

Quote from: f2zubac on January 25, 2014, 09:17:15 PM
3. How to monitor battery voltage and have a chance to react in time ?

The battery voltage is available as channel 7 of the LRADC.