N900 Software BME

This page is to bring together efforts and links for those working on understanding BME - the battery managment entity.

This is required to implement user friendly Host Mode

BME is divided into three parts.

  • Kernel driver that handles all of the low-level interaction with the hardware.
  • hald-addon-bme - an add-on process for HAL that reports status.
  • bme_RX-51 - Process started early in boot, with watchdogs to reboot the device if it malfunctions.


The kernel driver is split over several files.

http://mxr.maemo.org/fremantle/source/kernel/include/linux/i2c/twl4030-madc.h This handles reading various ADCs to readout voltages and currents.


Unsorted adds:

  • Then there's also /usr/lib/hal/hald-addon-bme, which seems not to be completely out of order (according to lshal) even when bme_RX-51 is stopped.
  • lsof -p `pidof bme_RX-51` gives an idea about what BME is actually interfering/interfacing with, and a strace will show it talks to dsme_lib probably to implement the watchdog timers.
  • BME process/file is called /usr/sbin/bme_RX-51 and killing or sigstop'ing it will cause immediate or delayed reboot. It is easily suspended though through upstart process management by:
    ~>stop bme
    and resumed any time by:
    ~>start bme

A nice little experiment to investigate the bq24150 USB Battery Charger chip's abilities is to

  • plug in Nokia wallwart charger
  • ->stop bme
  • wait max 32s until bq24150 internal watchdog timer expires (due to bme not resetting it), which will cause bq24150 to reset to defaults, which are a mostly sane, safe charging without any software support. You can tell this by bq24150 firing up the hardwired steady yellow indicator LED

I'm about to write a first draft little script to somewhat replace bme's basic functions, eventually turning this into a real project Just-Replaces-BME aka jrbme (some say it's "JRBME replaces BME", according to an age old tradition of linux self referencing ETLA [like GNU=="GNU Not Unix", KDE=="KDE Desktop Environment"])

Contents

Replacement Goals

Alpha

  • Not make the battery explode.
  • Charge from any 5V source, assuming the battery is in a safe condition, just setting the charger chip to the end voltage, and resetting the watchdog.

Beta

  • Watch the state of the battery, and charge taking into account device load.

Gamma

  • Charge at appropriate limits for USB chargers, and USB hosts we are plugged into.