USB host

From Openmoko

(Difference between revisions)
Jump to: navigation, search
(Three-Headed Cable: resistors)
(add instructions on building DIY usb host adapter)
Line 40: Line 40:
  
 
  echo -n "fast_cccv" >  /sys/devices/platform/s3c2410-i2c/i2c-adapter/i2c-0/0-0008/chgmode
 
  echo -n "fast_cccv" >  /sys/devices/platform/s3c2410-i2c/i2c-adapter/i2c-0/0-0008/chgmode
 +
 +
== DIY USB host adapter ==
 +
 +
Note that these instructions are provided in the hope that they are useful but without any warranty!
 +
 +
[[Image:2-usb-receptables.jpg]]
 +
 +
:#Find an old motherboard with a set of two USB receptables as shown above.
 +
:#Desolder this set of receptables from the motherboard. This can be bit tricky but it is doable at least with a desoldering gun.
 +
:#Each receptable has four pins. Use a multimeter to verify that you have no short circuits between the pins or the shield.
 +
:#Solder adjacent pins together (GND to GND, D- to D-, D+ to D+, VCC to VCC).
 +
:#(Optional) Build a test cable. Cut an USB cable with A plug into half, connect it a receptable and again measure that you have no short circuits. Then connect the test cable to PC and verify that you see
 +
black GND
 +
green 0V
 +
white 0V
 +
red +5V
 +
:#Freerunner is shipped with a mini-B-to-A-plug cable. Connect this to a receptable.
 +
:#(Optional)Connect test cable to another receptable and verify that you see
 +
black GND
 +
green 0V
 +
white 0V
 +
red 0V
 +
when freerunner acts as a device and
 +
black GND
 +
green 0V
 +
white 0V
 +
red +5V
 +
when it acts as a host.
 +
:#At your own risk, switch freerunner to USB host mode and connect an usb device to a receptable. Here's how the setup should look like:
 +
 +
[[Image:Usb-gender-changer1.jpg]]
 +
[[Image:Usb-gender-changer2.jpg]]
 +
  
 
[[Category:Neo1973 Hardware]]
 
[[Category:Neo1973 Hardware]]
 
[[Category:USB]]
 
[[Category:USB]]

Revision as of 07:12, 6 August 2008

Contents

The Neo1973 as a USB host

The Neo1973's mini-USB port can be configured to act as a usb host instead of a usb device. This opens up a range of possibilities, such as USB cameras and usb input devices.

This used to require a kernel patch provided as an attachment in Bugzilla, but that same page now details how to do this without any kernel hacking:


Tell the device that it is logically a host:

echo "host" > /sys/devices/platform/s3c2410-ohci/usb_mode

Instruct the device to provide 5 volts:

echo "1" > /sys/devices/platform/neo1973-pm-host.0/hostmode


Note: You may want to run ifconfig usb0 down prior to switching to usb host mode, as the Neo's usb networking may not like having its USB port disappear. You'll probably want to ssh into your Neo over WiFi or Bluetooth before starting all of this, alternatively use an on screen keyboard.

Three-Headed Cable

Three-headed cables are required if you want to power the FreeRunner / USB device whilst in host mode. For many uses the FreeRunner provides sufficient power to make such a cable unnecessary. At the moment, you'll have to manufacture this one yourself. You need to make a cable with three ends:

  • A mini-usb type B cable for the Neo itself
  • A cable of whatever type to go to your USB device.
  • A cable going to a +5V voltage source with enough power for your device and to charge the Neo. This could be a wall charger or even another USB plug.

You connect the Data+ and Data- wires of the Neo and the device, and connect all of the ground wires together and all of the +5V wires together. This powers the Neo and the device, while letting the neo talk to the device. You have to connect 2pcs 15kOhm resistors, one from D+ to ground, and one from D- to ground, to comply with USB-spec for hostmode, as Freerunner is switching off the internal resistors when you enable charging/powering over USB by asserting EN_USBHOST. See schematics, LOCATION:49XX

Just for reference, the USB wires from left to right are:

  • Black: Power -
  • Green: Data -
  • White: Data +
  • Red: Power +

The Mini_USB-B connector has a fifth pin, the ID-pin. This pin is supposed to be short to ground to signal Freerunner to enter hostmode. For the Y-cable and enabling external power while in hostmode, you may connect a 47kOhm resistor from ID-pin to ground. This is the same trick the OM-wallcharger uses to signal to Freerunner it can charge with 1A. Future kernels should switch to hostmode + external power when seeing this 47k resistor.

Power Concerns

You'll need to force the Neo to go into fast charge mode, since it can't do its usual power negotiation over USB.

echo -n "fast_cccv" >  /sys/devices/platform/s3c2410-i2c/i2c-adapter/i2c-0/0-0008/chgmode

DIY USB host adapter

Note that these instructions are provided in the hope that they are useful but without any warranty!

2-usb-receptables.jpg

  1. Find an old motherboard with a set of two USB receptables as shown above.
  2. Desolder this set of receptables from the motherboard. This can be bit tricky but it is doable at least with a desoldering gun.
  3. Each receptable has four pins. Use a multimeter to verify that you have no short circuits between the pins or the shield.
  4. Solder adjacent pins together (GND to GND, D- to D-, D+ to D+, VCC to VCC).
  5. (Optional) Build a test cable. Cut an USB cable with A plug into half, connect it a receptable and again measure that you have no short circuits. Then connect the test cable to PC and verify that you see
black GND
green 0V
white 0V
red +5V
  1. Freerunner is shipped with a mini-B-to-A-plug cable. Connect this to a receptable.
  2. (Optional)Connect test cable to another receptable and verify that you see
black GND
green 0V
white 0V
red 0V

when freerunner acts as a device and

black GND
green 0V
white 0V
red +5V

when it acts as a host.

  1. At your own risk, switch freerunner to USB host mode and connect an usb device to a receptable. Here's how the setup should look like:

Usb-gender-changer1.jpg Usb-gender-changer2.jpg

Personal tools

The Neo1973 as a USB host

The Neo1973's mini-USB port can be configured to act as a usb host instead of a usb device. This opens up a range of possibilities, such as USB cameras and usb input devices.

This used to require a kernel patch provided as an attachment in Bugzilla, but that same page now details how to do this without any kernel hacking:


Tell the device that it is logically a host:

echo "host" > /sys/devices/platform/s3c2410-ohci/usb_mode

Instruct the device to provide 5 volts:

echo "1" > /sys/devices/platform/neo1973-pm-host.0/hostmode


Note: You may want to run ifconfig usb0 down prior to switching to usb host mode, as the Neo's usb networking may not like having its USB port disappear. You'll probably want to ssh into your Neo over WiFi or Bluetooth before starting all of this, alternatively use an on screen keyboard.

Three-Headed Cable

Three-headed cables are required if you want to power the FreeRunner / USB device whilst in host mode. For many uses the FreeRunner provides sufficient power to make such a cable unnecessary. At the moment, you'll have to manufacture this one yourself. You need to make a cable with three ends:

  • A mini-usb type B cable for the Neo itself
  • A cable of whatever type to go to your USB device.
  • A cable going to a +5V voltage source with enough power for your device and to charge the Neo. This could be a wall charger or even another USB plug.

You connect the Data+ and Data- wires of the Neo and the device, and connect all of the ground wires together and all of the +5V wires together. This powers the Neo and the device, while letting the neo talk to the device. You have to connect 2pcs 15kOhm resistors, one from D+ to ground, and one from D- to ground, to comply with USB-spec for hostmode, as Freerunner is switching off the internal resistors when you enable charging/powering over USB by asserting EN_USBHOST. See schematics, LOCATION:49XX

Just for reference, the USB wires from left to right are:

  • Black: Power -
  • Green: Data -
  • White: Data +
  • Red: Power +

The Mini_USB-B connector has a fifth pin, the ID-pin. This pin is supposed to be short to ground to signal Freerunner to enter hostmode. For the Y-cable and enabling external power while in hostmode, you may connect a 47kOhm resistor from ID-pin to ground. This is the same trick the OM-wallcharger uses to signal to Freerunner it can charge with 1A. Future kernels should switch to hostmode + external power when seeing this 47k resistor.

Power Concerns

You'll need to force the Neo to go into fast charge mode, since it can't do its usual power negotiation over USB.

echo -n "fast_cccv" >  /sys/devices/platform/s3c2410-i2c/i2c-adapter/i2c-0/0-0008/chgmode