FC UI firmware: battery management and MMI codes

Mychaela Falconia mychaela.falconia at gmail.com
Fri Oct 23 17:52:19 UTC 2020

Hello FreeCalypso community,

I've been making good progress with FC Tourmaline firmware: among other
things, I got the smallbw configuration extended from 84x48 to 96x64
pixels (using the full screen size on C139), and I got the battery icon
hooked up to the FCHG driver.  Remaining issues to be fixed in the
battery and charger management department:

* The battery icon currently appears on the normal-operation idle
screen and on the active call screen, which is good (matches standard
phones) - but it still remains to be added to the "Insert SIM" screen
that appears when the phone is booted up with no SIM present.  The
battery icon needs to be added to this screen so one can see the state
of the battery without the SIM - right now it is invisible.

* The battery icon makes an animation (endlessly cycles through its
number-of-bars states) when charging is in progress, just like in
Pirelli's UI - this is a part which Pirelli left mostly unchanged from
TI's starting-point UI fw.  Right now this animation works when the
idle screen is displayed, but stops when a number is being dialed or
when a call is active, states during which the regular (not animated)
battery icon works - this bug needs to be fixed.

* Every standard phone implements a special boot mode for charging: if
you plug a charger into a switched-off phone, the hardware causes the
phone's main processor to boot, but all standard phone firmwares detect
this condition and handle it specially: instead of booting into regular
phone operation, they go into a special mode where the screen shows
only the state of the charging process and nothing else, all other
functions are disabled until and unless you press the designated button
to "power on for real", and if you unplug the charger in this state,
the phone fully powers off rather than staying on.  This special
charging boot mode and the associated charging state display remain to
be implemented in FreeCalypso.

* I would like to implement a detailed battery status screen that shows
the battery voltage in millivolts, the full state of our FCHG driver
state machine, the charging current in mA during charging, and the
remaining battery percentage (more fine-grained than the battery bars
icon) when not charging.  This screen will be displayed continuously
in the special charging boot mode, and I would like to also make it
available in normal operation via an MMI code.

MMI codes are "magic" sequences of digits and *# characters which cause
phones to execute various special actions.  They are distinct from
similar-looking USSD codes in that USSD codes are defined and
implemented by mobile phone networks, whereas MMI codes are defined
and implemented internally inside phone firmwares.  There are standard
MMI codes like *#06# (display IMEI) which everyone implements, and
then there are phone-specific MMI codes.  Every existing commercial
phone implements a bunch of MMI codes, although they may or may not be
documented - here are the ones we know about on our main target phones:

* Mot C1xx phones have MMI code #02# to display the firmware version
and related system info.

* Pirelli's official fw implements ###520# for fw version display, as
well as a bunch of other ###xxx# MMI codes - ###000# brings up a help
screen showing some of them.

Even the demo/prototype/PoC UI fw we got from TI already implements a
few MMI codes:

###520# brings up a firmware version screen - TI originally had some
junk in it, FC Magnetite and Tourmaline firmwares display our FC fw
version string generated by our build system.  It looks like Pirelli
got their ###520# MMI code from TI!

*36446337464# brings up the Engineering Mode menu where you can see
the current serving cell, neighbor cells etc.

I would like to have some MMI codes in our FreeCalypso fw as well:
keep the ones for fw version display and eng mode menu (although I
would like a shorter, easier-to-type one for the latter), and also add
some new ones of our own.  For our own newly added MMI codes, my
current needs are:

* I would like to have an MMI code that brings up the detailed battery
and charging status screen as explained above;

* I would also like to have MMI codes that start and stop battery
charging on user request, sending appropriate commands to our FCHG
driver, just like our already implemented AT at CHG command.  (Obviously
a charging power source has to be plugged in for charging to be
possible, but having a charging power source plugged in vs. actually
turning on charging circuits are two different things.)

But here is the dilemma I am facing: some years ago I tried looking in
official spec documents (I forgot the spec numbers), hoping to see if
there exists some official demarcation as to which *#-digits sequences
are reserved for USSD vs. which ones are reserved for MMI codes, but I
couldn't find any such demarcation: it appears that both kinds of codes
share the same code space, and any time a phone manufacturer implements
an MMI code, it is a potential clash with some network operator's USSD
code.  As a case in point, T-Mobile USA implements a few #xxx# USSD
codes for balance inquiries etc, and they do work from our Calypso
devices - but then Motorola's #02# MMI code seems to be existing in
the same code space, and so do Pirelli's various ###xxx#.

If there is no official demarcation, i.e., if it is not possible to
define MMI codes that are guaranteed to never conflict with anyone's
USSD codes, then I reason that the only available course of action is
to make our MMI codes long enough to reduce the chance of collision -
thus ###xxx# seems better in this regard than #xx# or #xxx#.  Right
now I am thinking of defining the following MMI codes for FC:

###240#: bring up battery and charging status screen
###241#: start charging user request
###242#: stop charging user request
###364#: shorter alternative to *36446337464# for Eng Mode menu
###520#: display firmware version

If someone has any better ideas, please speak up now!

Hasta la Victoria, Siempre,
Mychaela aka The Mother

More information about the Community mailing list