Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Re: Rombox: won't charge when batteries are dead

Re: Rombox: won't charge when batteries are dead

From: Magnus Holmgren <lear_at_algonet.se>
Date: Tue, 15 Jul 2003 13:30:02 +0200

Magnus Holmgren wrote:

> There's a reason for having power_init that late: the registers it uses
> aren't fully set up until after mpeg_init has been called (at least not
> on a player). When it was placed earlier (after adc_init, IIRC), the
> initial setup of the power history was wrong, and it would take about 30
> minutes before the battery meter showed the correct value.
>
> So, just moving power_init might not help. Maybe it can be fixed by
> moving some initializations, or maybe it is simply a matter of time.

It turned out to be quite simple, once I spent a minute or two
understanding what happens in adc.c. It is a matter of time: power_init
must be called at least 80 ms after adc_init returns, otherwise it will
get incorrect data.

Each tick adc.c reads one of 8 possible values and triggers conversion
of the next. Battery power is the 7:th value, but it could be a full
tick after adc_init returns until the first conversion takes place, thus
the need to wait 80 ms (8 ticks).

I tried putting power_init after button_init, and after a sleep(8). It
still worked.

-- 
Magnus Holmgren
Received on 2003-07-15

Page template was last modified "Sat Sep 18 20:21:06 2021" The Rockbox Crew -- Privacy Policy