Friday, 17 October 2008

USB host mode on the Treo 650

Previously I'd always just assumed the USB host pins were separate from the USB client ones, so we wouldn't be able to use the USB port on the multiconnector as a host. Turns out I was wrong. Sleep_Walker pointed out that the PXA27x's USB client pins can the routed to the host controller. I had to try it. So I cut the USB connectors of an old dead motherboard with a jigsaw and soldered the D+ pins and D- pins of each connector respectively together. I then ran +5V from my PC because the Treo can't supply it. Any +5V source should do, so a battery pack or some kind of charge powered by the treo's 3.7V output would also work, the PC was just the closest handy source. I then configured USB port 2 in host mode and powered it up.
UP2OCR = UP2OCR_HXS | UP2OCR_HXOE;
UHCRHDA |= UHCRHDA_NOCP;
UHCHR &= ~(UHCHR_SSEP2 | UHCHR_SSE);
I found low-speed devices (like old mice) just work, but full-speed (USB1.1+ devices) fail to detect. There seems to be an extra strong pull-down on the USB+ pin, probably as part of the USB client hardware. To get around this we can turn on the Treo's own usb client pullups and trick itself into realising there's a full-speed device attached. ;-) Anyway here's the result, a USB keyboard (with builtin hub) and mouse controlling the Treo directly:

Virtually every USB device with a Linux driver I've tried works. I'm looking to get a USB wifi dongle. Not sure it'll be so easy to mount inside as the Eee PC upgrades are. ;-) Update: Sleep_Walker has now tried the same thing on the 680. He reports that there's no pulldown problems on the 680 so full-speed devices detect correctly without any hacks. He also tried a slightly easy way of doing it, all you need is standard powered USB hub (to supply the +5V) and a USB gender changer, no soldering required.

5 comments:

Fernando Cassia said...

Excellent work!. What about the Palm Centro?

After all the centro is supposedly a Treo 680 on a smaller form factor right?.

Can anyone confirm if the centro also supports host mode?

Thanks
FC

Alex said...

Yes, likely it'd work on the Centro as well (as it's PXA27x based), although nobody has done Linux port to it yet as far as I know.

Alex said...

Oh in case it wasn't clear, this isn't going to be very useful in Palm OS (only Linux) as you need drivers for the devices you plug in, which Palm OS doesn't have.

divilis said...

It's cool .
Sometimes we would do something that we need to input A lot of text ,this will increase the speed of inputing .
I hope our keyboard of treo 650 can work with a perfect driver . This means we can use the whole functions of treo keyboard , just like how it works in Palm OS .
Is this related to the keymap file in linux ?

P.S.: I'm interested in your linux-rootfs of your t650 :-D .
Cat you send it to me ?
Tkz very much.

my email:
divilis@qq.com
divilis.mouze@gmail.com

Or you can give me a URL so we all can download it .

Ray said...

I have a couple questions. I'm transitioning from XP.
Does the 5V+ connect to the keyboard? or treo, or both?

You referenced:
UP2OCR = UP2OCR_HXS | UP2OCR_HXOE;
UHCRHDA |= UHCRHDA_NOCP;
UHCHR &= ~(UHCHR_SSEP2 | UHCHR_SSE);

I have never seen anything like this. I assume it is source code. Can you point me to a start point for making this work? Please ?!?!?