Next: libsurf
Up: Hacking the hardware
Previous: Clock return
  Contents
Subsections
Microprocessor/USB controller
All slow-control interaction between the user and the SURF board happens
through the USB controller. Our USB controller chip (a Cypress EZ-USB AN2131) is a combination of USB line driver, RAM, souped-up 8051
microprocessor and i2c controller.
The USB controller part of the EZ-USB provides an interface to the SURF board for the machine
running the AMBUSH software. It accepts requests to enable or disable
the various features of the SURF board; set the settable settings; and
read out the status of the board. Tables 3.1 and
3.2 list the
requests that the host computer is allowed to make of the SURF board.
(The additional requests required by the
USB protocol specification are not listed in this here manual.)
Global requests are made through control transfers to the EZ-USB's endpoint
EP0. The format of the request is shown in Table 3.3.
Module-specific requests are made through bulk transfers; for the th
module (zero-offset), the transfer is made to the st endpoint.
(This arrangement is necessary because the USB specification
requires EP0 to be the control endpoint.) Byte 0 of a module-specific
transfer specifies the request (choose from one of those listed in
Table 3.2); the remaining 0 to 63 bytes are arguments to the
command as specified in Table 3.2. Note that if you ask an
endpoint for the status of its module by sending it the
SURF_MOD_STATUS
request, the next request you make to that
endpoint must be a bulk in request so that the endpoint can rid itself
of the status information it has generated. Table 3.4 shows
the format of the status report.
Table 3.1:
Global requests supported by the SURF board
USB interface. indicates that the th
module is enabled. These requests should be addressed to EP 0.
|
Table 3.2:
Module-specific requests supported by
the SURF board USB
interface. A
request to module (zero-offset) should be addressed to
EP . See the last paragraph of
Sec. 3.6.2 for an explanation of the ``DAC hint'' argument
to the SURF_MOD_SET_ANAL/SURF_MOD_SET_DIG
request.
|
Table 3.3:
Global request
format.
|
Table 3.4:
Module status report
format.
|
Microprocessor I/O
The microprocessor part of the EZ-USB has two eight-bit digital I/O ports and
an i2c bus controller. The I/O bits are allocated as follows:
- Regulator enable (END and ENA):
- Eight bits are used to turn
on the eight regulators independently of each other.
- Thermal interlock reset (NRESET):
- One bit sends a reset signal
to the thermal
shutdown mechanism; any power supplies in thermal interlock are brought
out of thermal interlock.
- Thermal shutdown readout (TS):
- Each module has a bit that goes
high when the thermal interlock engages.
- Readout select (NSEL):
- Two bits select which module can
transmit data back to the TPCC.
- Enable single-module control (ES):
- The ES bit determines
whether the TPCC writes to all modules or only the selected one.
SURF uses the i2c bus controller of the EZ-USB for the following purposes:
- EEPROM access:
- The SURF board contains a 128-Kb EEPROM.
The EEPROM
stores the 8051 firmware (see
Sec. 3.6.4).
- ADC readout:
- Two twelve-channel ADCs digitize the module
quantities
of interest. The
twenty-four quantities that the EZ-USB can read are: module
temperature
4; remote-sensed module ground
4; remote-sensed
module
VDD
4; remote-sensed VDDA
4; analog supply current
4; and
digital supply current
4.
- Regulator control:
- The EZ-USB sets the voltage levels of the
supply regulators through the AD5242 digital potentiometers in
Fig. 3.1.
``Firmware regulation''
In addition to processing the set/get requests from the host computer,
the 8051 also optionally corrects for the voltage drop
in the module power supply. The firmware continuously digitizes the
supply voltages sensed at the modules; it trims the regulator output
until the sensed voltage falls within tolerance of the set voltage.
Microprocessor firmware
The controller firmware lives in the jboard/firm directory. To build
it you need SDCC, the Small Device C Compiler, from http://sdcc.sourceforge.net. Typing make in the firmware directory
will build two files: firm.ee and loader.ihx. The former is
the actual firmware, in a format suitable for bootloading from the
on-board EEPROM. The latter is loader firmware for the EZ-USB that
allows the host computer to write to the EEPROM through the EZ-USB.
To download the firmware into the EEPROM on the SURF board,
do the following:
- find a Linux machine on which you can be root
- build and load the EZ-USB firmware download module from http://ezusb2131.sourceforge.net
- remove the jumper on the i2c SDA line (J?) on the SURF board to
prevent the EZ-USB from loading the current EEPROM contents
- powercycle the SURF board
- replace the SDA jumper; place a jumper on the EEPROMWPline
(JP?)
to disable EEPROM write protection
- become root on the host computer
- in the jboard/firm directory type cat loader.ihx >
/proc/ezusb/dev0
- in the same directory type ./eeprom.pl -w -i firm.ee
- remove the WP jumper and powercycle the SURF board.
Next: libsurf
Up: Hacking the hardware
Previous: Clock return
  Contents
Johannes Muelmenstaedt
2004-03-31