The Nokia N900 is a annoying beast when charging. Coupled by the physically
weak and electrically weak Micro USB port, this has been difficult to charge.
The main reason why there are so many problems with N900 charging is that
it's trying to be very considerate. Drawing 1 ampere on USB is a big no-no,
this is way out of spec. However how would the N900 know what it was plugged
into? You plug it into a wall versus a PC. If it drew 1A from a PC that
could only support the specced 500mA because it thought was a wall charger,
it could potentially fry something. Hence it goes through a complicated
set of rules to detect what you hooked it up to.
Here's my take on how this works.
There are three charging systems:
proper wallcharger
(D+/D- shorted - "dumb" charger),
host charge (USB of a PC or other host, needs to negotiate max current draw),
a "dump" charger (slow charge)
(wall charger or host charge without D+/D- shorted or even connected).
The "dump" charger should not be used as it will not charge the phone. At 100
milliamp max, it tends to not even use that high to stay below the threshold,
and background power use will consume most of that 100mA of current.
Charging Algoritm
If n900 is booted (battery has charge and phone is on)
- check to see if wall charger
- if wallcharger, start fastcharge
- if not wallcharger, negotiate power with USB host
- if host says go for it, go charge at rate that host says is OK
- if host says nothing, go to slow charge (which is pointless while on)
If battery is flat or n900 is off / not booted
- Check to see if wall charger
- If it is a wallcharger,
- Try to draw full current and charge battery.
- If internal USB voltage does stay at 5V,continue charging
- if it does not stay above some threshold, stop and sleep.
This is a precaution, to make sure we don't start a fire.
- If data pins are not shorted, stop and sleep.
This is also a precaution, since the CPU is not on to negotiate a USB link,
it has to assume that it's hooked up to a 100mA port to not fry
anything. At 100mA it's too low to do anything either.
Note: if the charger is crappy or usb does not have a clean connection, it will never charge. And the phone needs to be "on" to negotiate non-wallchargers.
If battery has some charge and someone tries to turn on
- the N900 will try to boot, one of the first thing it will do is to get out of fast charge mode - because now that the kernel is loaded it has the capability to detect the port. This action will kill boot if you don't have external power and the battery is discharged.
- if enough power to finish booting and plugged into USB
- check for wall charger
- if wall charger, go back into fast charge mode
- if not wall charger, negotiate max power usage with host
- if not enough power to finish booting,shutdown (note, battery voltage may recover a bit, tricking the n900 to think it can boot, and sometimes this
ends up in an endless loop.)
Notice the battery can never be charged if you don't have a good wall charger
or weak USB.