N900 Hardware USB
The USB connector on the N900 is a micro-b connector, as now required in European and Chinese markets, under the scheme to make all phone charger sockets identical.
Contents |
USB implementation
The N900 seems initially to have been designed to be capable of acting as a USB host, or implementing OSG mode. This would have allowed keyboards, mice, and other peripherals to be plugged in.
The USB port with embedded host mode could not be certified, as the OTG drivers were not ready. (see [1] last block).
This lead to the the micro-AB USB connector being replaced by a micro-B, and the host functionality being officially removed short time before launch.
Lacking certification would have a large number of issues, from some operating systems requiring certification before allowing drivers to be distributed, to legal compliance with the USB charger specs - it would technically not be a USB port.
The Chips
There are four chips involved in the USB subsystem.
SoC
The System-on-a-chip is the main processor on the n900. This is the TI omap3430
Gaia
The TWL4030 is a TI companion chip to the SoC
USB battery charger
The bq24150 charger from TI is a flexible charger. It, along with the PHY chip - support charging without the intervention of the SoC when the system is charging from a completely dead battery. The PHY chip detects a charger (shorted D+ and D- pins) and the charger uses this information to charge more rapidly.
It also features reverse boost mode - which enables power to be supplied to a USB device connected to the N900. (up to a limit of 200mA)
For more information see N900 Hardware Battery Charger
USB Phy
The NXP isp1707a is used as the USB PHY chip. [2]. This rights to this part have been bought by ST-Ericson and some information is available in a brief marketing sheet.
There is no published datasheet for this chip. It may be available under another name.
A reasonably similar chip (compare chips: [3]) is the 1704 which has a datasheet [4]
For more information see N900 Hardware USB PHY
The Circuit
- The SoC has the USB protocol controller - this is the 'high level' controller - it implements most of the USB protocol. This is a Mentorgrafix MUSBMHDRC-core IntelectualProperty function block licenced for the OMAP.
- The PHY (physical layer) chip connects to the world through the USB socket. This is not the normal companion chip - but the NXP part, and is connected to the SoC via a standard ULPI interface. It does the very lowest level USB hardware protocol. Also it detects chargers (by sensing D+/D- short). It also has a connection to VBUS, via a 1k resistor, to do certain probing.
- The bq24150 Battery charger. This is connected to the battery, and the PHY chip, as well as to the SoC though I2C. It handles (with the PHY chip) charging from dead. It also implements boost mode, to enable powering things through the USB socket. Of course it detects when external VBUS is applied.
- Gaia. The TWL4030 is used to sense the value of the ID pin. It also has a connection to VBUS, to power up the device on charger insertion and inform a running system about changes in VBUS state. Though TWL4030 has a function similar to PHY chip as well, the original design using this function had to change as early chip revisions had problems with charger detection (so the rumour). Driver sourecode is full of cruft from that original design.
The Software
- BME - the battery managment entity. This has its hands in everything, especially the bq24150, and is split into
- charger detection (via PHY) in kernel MUSB_HDRC driver, exposing /sys/devices/platform/musb_hdrc/charger
- BME - userspace driver for the charger chip, as well as monitoring battery voltage through Gaia.
- Hald-addon-bme - a small helper program to interface between HAL and BME.
- Kernel driver.
- This seems to be a partially implemented OTG driver for the initial design of the N900, with OTG mode partially implemented, assuming that the twl4030 would be used as the USB PHY. It seems to have been modified only to the extent required to make the NXP PHY work as a replacement.
Host mode details.
Host mode works, see this post by egoshin on talk.maemo.org. He has succeeded in mounting a USB stick using an externally powered hub.
A user friendly implementation that makes it easy to use host mode is some way off.
A USB OTG controller would normally switch between host and device mode (initially) using the ID pin, to detect if it's at the A or B-side of a OTG cable.
Initially it was claimed that ID is not connected externally, and that this made USB host mode impossible.
However, similar device datasheets indicate that the ID pin is used on hardware that supports it to switch between host and device mode.
But, importantly, the ID pin does nothing directly to the state of the PHY. It simply informs the CPU of the state of the ID pin, and leaves the driver to properly configure the chip (nota bene, only for OTG, and only for determining the inital state).
So, if the kernel can be altered to ignore this pin - which should be trivial if there is host mode support for the chip in the kernel - then host mode works.(the related sourcecode is to be found here:[5], a 'echo host >mode' should work if the kernel driver wasn't crippled in some strange way)
The current understanding by several people who are working on USB host mode is:
The USB port can supply power - at least 200mA (as demonstrated here:[6]). This is plenty for many devices - mice and keyboards.
It seems likely that a relatively simple kernel change should enable USB hostmode - http://focus.ti.com/lit/ug/spruf98d/spruf98d.pdf - search for FORCE_HOST - there may well be other cleaner solutions.
A possibly related errata is detailed at 3.1.3 in this document - this, and other erratas may or may not cause issues with implementing host mode.
USB socket
Main article: N900 Hardware USB Socket