EXI:USBHostAdapter

From gc-linux

Jump to: navigation, search

Contents

Introduction

This is an attempt to build an Universal Serial Bus (USB) host adapter for the Nintendo GameCube using the EXI interface found in retail consoles.

Such an adapter can be used to connect USB peripherals (like keyboards, mices, hard disks, etc.) to the Nintendo GameCube. With the help of a kernel USB Host Controller driver those devices can be directly managed from gc-linux, the port of the Linux Kernel to the Nintendo GameCube.

Considerations on the EXI Bus

The EXI (EXternal Interface) is nothing more than a SPI bus which operates in SPI mode (0,0).

The notation (x,y) means that the bus operates with CPOL (Clock Polarity) equal to x and CPHA (Clock Phase) equal to y.

  • CPOL=0 means that SCK (SPI ClocK) is low when idle.
  • CPOL=1 means that SCK (SPI ClocK) is high when idle.
  • CPHA=0 means that data is sampled on odd edges.
  • CPHA=1 means that data is sampled on even edges.


The following handcrafted ASCII table illustrates the 4 possible SPI modes.

SPI operation modes
CPOL/CPHA CPHA=0 CPHA=1
CPOL=0

(0,0)

hi     __    __
   ___/  \__/  \__
lo    ^     ^
      |     |
    sample sample

(0,1)

hi     __    __
   ___/  \__/  \__
lo       ^     ^
         |     |
       sample sample

CPOL=1

(1,0)

hi __    __    __
     \__/  \__/  
lo   ^     ^
     |     |
   sample sample

(1,1)

hi __    __    __
     \__/  \__/  
lo      ^     ^
        |     |
      sample sample

Adapter Design

The current design will be based on the MAX3421 USB Host Peripheral/Controller with SPI Interface by Maxim. Also a 300mA MAX4917 current limiting switch will be used to control the amount of current that attached USB devices can get from the Nintendo GameCube.

MAX3421E Hardware Considerations

VCC

Power the USB transceiver and digital logic by applying a positive 3.3V supply to VCC. Bypass VCC to GND with a 1.0µF ceramic capacitor as close to the VCC pin as possible.

VL

Connect VL to the system’s 1.4V to 3.6V logic-level power supply. Bypass VL to ground with a 0.1µF capacitor as close to VL as possible.

D- and D+

The internal USB full-/low-speed transceiver is brought out to the bidirectional data pins D+ and D-. These pins are ±15kV ESD protected. Connect D+ and D- to a USB B connector through 33Ω ±1% series resistors.

XI and XO

XI and XO connect an external 12MHz crystal to the internal oscillator circuit. XI is the crystal oscillator input, and XO is the crystal oscillator output. Connect one side of a 12MHz ±0.25% parallel resonant crystal to XI, and connect XO to the other side. Connect load capacitors (20pF max) to ground on both XI and XO.

INT

Set the INTLEVEL bit of the PINCTL (R17) register high to program the INT output pin to be an active-low level open-drain output. An external pullup resistor to VL is required for this setting. In level mode, the MAX3421E drives INT low when any of the interrupt flags are set. If multiple interrupts are pending, INT goes inactive only when the SPI master clears the last active interrupt request bit. The POSINT bit of the PINCTL (R17) register has no effect on INT in level mode.

MAX4917A Hardware Considerations

IN

5V input. Bypass with a 0.1µF ceramic capacitor to ground as close to the device as possible.

OUT

5V output. Bypass with a 0.1µF ceramic capacitor to ground as close to the device as possible.

nFLAG

nFLAG is an open drain output transistor and requires an external pullup resistor from nFLAG to IN. The data sheet doesn't specify the value for the pullup resistor, but probably a 5K resistor would be fine (hardware gurus confirm please).

Hardware Design V1

This is an untested prototype. Build at your own risk.
Note that no working software for this adapter exists yet.

Parts Listing

- MAX3421E SPI-USB host controller

- MAX4917 Power limit switch

- 12 MHz crystal, with two 22pF load capacitors

- 1uF ceramic decoupling capacitors

- Surface mount USB A connector

Schematics

Proposed (untested!) Schematics and PCB. The PCB is meant to be soldered onto the Gamecubes motherboard on one of the memory card slots. This way, the USB-A connector could be mounted flush with the front panel. To allow for a single-sided PCB, there are some 'quirks' in the schematics: the exi signals are connected to the general purpose inputs of the MAX3421. This will not influence the behaviour of the EXI bus. Also, the two shielding ground pins are used instead of the 'normal' ground pin 2. This should be no problem, since all these pins are connected to the ground plane of the motherboard.

A MAX4917 power switch is used to limit the current drawn from the +5V line in case of a short-ciruit or other failure on the USB bus. This switch limits the power to 300mA, it has not been tested whether the Gamecube can indeed deliver this current. Alternatives with a lower current rating, with the same footprint are available from Maxim.

Hardware Design V1.1

This is an untested prototype. Build at your own risk.
Note that no working software for this adapter exists yet.

This new design revision incorporates the following additions:

  • uses additional hardware needed to support the requirements specified in the data sheet products
  • allows control of the USB 5V signal (VBUS) via GPOUT0
  • allows detection of a current fault (nFLAG assertion on the MAX4917A) via GPIN0

Parts Listing

  • 1 x MAX3421E (MAX3421EEHJ+)
  • 1 x MAX4917A (MAX4917AEUK+)
  • 2 x 20 pF ceramic capacitor
  • 3 x 0.1 uF ceramic capacitor
  • 1 x 1.0 uF ceramic capacitor
  • 1 x 5 Kohm resistor
  • 2 x 33 ohm resistor
  • 1 x 12 MHz crystal
  • 1 x USB Type A female conector
  • 1 x GCN memcard connector

Schematics

See gcn-usb-adapter-20071129.png.

Personal tools