Full-speed Universal Serial Bus single-chip host and device
controller
Rev. 01 — 3 July 2001Product data
1.General description
The ISP1161 is a single-chip Universal Serial Bus (USB) Host Controller (HC) and
Device Controller (DC) which complies with
Rev 1.1
microprocessor bus interface. They have the same data bus, but different I/O
locations. They also have separate interrupt request output pins, separate DMA
channels that include separate DMA request output pins and DMA acknowledge
input pins. This makes it possible for a microprocessor to control both the USB HC
and the USB DC at the same time.
ISP1161 provides two downstream ports for the USB HC and one upstream port for
the USB DC. Each downstream port has its own overcurrent (OC) detection input pin
and power supply switching control output pin. The upstream port has its own V
detection input pin. ISP1161 also provides separate wakeup input pins and
suspended status output pins for the USB HC and the USB DC, respectively. This
makes power management flexible. The downstream ports for the HC can be
connected with any USB compliant USB devices and USB hubs that have USB
upstream ports. The upstream port for the DC can be connected to any USB
compliant USB host and USB hubs that have USB downstream ports.
c
c
The DC is compliant with most device class specifications such as Imaging Class,
Mass Storage Devices, Communication Devices, Printing Devices and Human
Interface Devices.
Universal Serial Bus Specification
. These two USB controllers, the HC and the DC, share the same
BUS
ISP1161 is well suited for embedded systems and portable devices that require a
USB host only, a USB device only, or a combined and configurable USB host and
USB device capabilities. ISP1161 brings high flexibility to the systems that have it
built-in. For example, a system that has ISP1161 built-in allows it not only to be
connected to a PC or USB hub that has a USB downstream port, but also to be
connected to a device that has a USB upstream port such as a USB printer, USB
camera, USB keyboard, USB mouse, among others. ISP1161 enables peer-to-peer
connectivity between embedded systems. An interesting application example is to
connect a ISP1161 HC with a ISP1161 DC.
Let us see an example of ISP1161beingusedinaDigitalStillCamera(DSC)design.
Figure 1 shows ISP1161 being used as a USB DC. Figure 2 shows ISP1161 being
used as a USB HC. Figure 3 shows ISP1161 being used as a USB HC and a USB
DC at the same time.
Page 2
Philips Semiconductors
ISP1161
Full-speed USB single-chip host and device controller
EMBEDDED SYSTEM
PC
(host)
USB cable
USB I/F
USB I/F
Fig 1. ISP1161 operating as a USB device.
EMBEDDED SYSTEM
ISP1161
HOST/
DEVICE
µP SYSTEM
MEMORY
µP bus I/F
USB host
USB I/F
µP
DSC
µP
USB device
USB cable
µP SYSTEM
MEMORY
µP bus I/F
ISP1161
HOST/
DEVICE
DSC
MGT926
PRINTER
(device)
USB I/F
MGT927
Fig 2. ISP1161 operating as a stand-alone USB host.
Full-speed USB single-chip host and device controller
EMBEDDED SYSTEM
ISP1161
HOST/
DEVICE
µP SYSTEM
MEMORY
µP bus I/F
USB host
PRINTER
(device)
USB I/FUSB I/F
USB I/F
MGT928
µP
PC
(host)
USB cableUSB cable
Fig 3. ISP1161 operating as both USB host and device simultaneously.
DSC
USB I/F
USB device
2.Features
■ Complies with
■ Combines HC and DC in a single chip
■ On-chip DC complies with most Device Class specifications
■ Both HC and DC can be accessed by an external microprocessor via separate I/O
port addresses
■ Selectable one or two downstream ports for HC and one upstream port for DC
■ High speed parallel interface to most of the generic microprocessors and
Reduced Instruction Set Computer (RISC) processors (Hitachi SH-3 and SH-4,
MIPS-based RISC, ARM7/9, StrongARM, etc.). Maximum 15 Mbyte/s data
transfer rate between microprocessor and the HC, 11.1 Mbyte/s data transfer rate
between microprocessor and the DC
■ Operation at either +5 V or +3.3 V power supply input
■ 8 kV in-circuit ESD protection
■ Operating temperature range −40 to +85 °C
■ Available in two LQFP64 packages (SOT314-2 and SOT414-1).
3.Applications
■ Personal Digital Assistant (PDA)
■ Digital camera
■ Third-generation (3-G) phone
■ Set-top box (STB)
■ Information Appliance (IA)
■ Photo printer
■ MP3 jukebox
■ Game console.
4.Ordering information
ISP1161
Full-speed USB single-chip host and device controller
Table 1:Ordering information
Type numberPackage
NameDescriptionVersion
ISP1161BDLQFP64Plastic low profile quad flat package; 64 leads; body 10 x 10 x 1.4 mmSOT314-2
ISP1161BMLQFP64Plastic low profile quad flat package; 64 leads; body 7 x 7 x 1.4 mmSOT414-1
Full-speed USB single-chip host and device controller
Table 2:Pin description for LQFP64
Symbol
[1]
PinTypeDescription
…continued
XTAL244Ocrystal oscillator output (6 MHz); connect a fundamental
mode or third-overtone, parallel-resonant crystal; leave this
pin open when using an external clock source on pin
XTAL1
DGND45-digital ground
H_PSW146Opower switching control output for downstream port 1; open
drain output
H_PSW247Opower switching control output for downstream port 2; open
drain output
D_DM48AI/OUSB D- data line for DC’s upstream port
D_DP49AI/OUSB D+ data line for DC’s upstream port
H_DM150AI/OUSB D- data line for HC’s downstream port 1
H_DP151AI/OUSB D+ data line for HC’s downstream port 1
H_DM252AI/OUSB D- data line for HC’s downstream port 2
H_DP253AI/OUSB D+ data line for HC’s downstream port 2
H_OC154Iovercurrent sensing input for HC’s downstream port 1
H_OC255Iovercurrent sensing input for HC’s downstream port 2
V
CC
56-digital power supply voltage input (3.0 to 3.6 V or
4.75 to 5.25 V). This pin connects to the internal 3.3 V
regulator input. When connected to +5 V, the internal
regulator will output 3.3 V to pins V
reg(3.3),Vhold1
and V
hold2
When connected to 3.3 V, it will bypass the internal
regulator.
AGND57-analog ground
V
reg(3.3)
58-internal 3.3 V regulator output; When the VCC pin is
connected to +5 V, this pin outputs 3.3 V. When the V
CC
is connected to +3.3 V, then this pin should also be
connected to +3.3 V.
A059Iaddress input; selects command (A0 = 1) or data (A0 = 0)
A160Iaddress input; selects AutoMux switching to DC (A1 = 1) or
AutoMux switching to HC (A1 = 0); see Table 3
n.c.61-no connection
DGND62-digital ground
D063I/Obit 0 of bidirectional data; slew-rate controlled; TTL input;
A 6 to 48 MHz clock multiplier Phase-Locked Loop (PLL) is integrated on-chip. This
allows for the use of a low-cost 6 MHz crystal, which also minimizes EMI. No external
components are required for the operation of the PLL.
7.2 Bit clock recovery
The bit clock recovery circuit recovers the clock from the incoming USB data stream
using a 4× over-sampling principle. It is able to track jitter and frequency drift as
specified by the
7.3 Analog transceivers
Three sets of transceiver are embedded in the chip: two are used for downstream
ports with USB connector type A; one is used for upstream port with USB connector
type B.The integrated transceivers are compliant with the
Specification Rev 1.1
through external termination resistors.
ISP1161
Full-speed USB single-chip host and device controller
USB Specification Rev. 1.1
. They interface directly with the USB connectors and cables
.
Universal Serial Bus
7.4 Philips Serial Interface Engine (SIE)
The Philips SIE implements the full USB protocol layer. It is completely hardwired for
speed and needs no firmware intervention. The functions of this block include:
synchronization pattern recognition, parallel/serial conversion, bit (de)stuffing, CRC
checking/generation, Packet IDentifier (PID) verification/generation, address
recognition, handshake evaluation/generation.There are separate SIE in both the HC
and the DC.
7.5 SoftConnect (in DC)
The connection to the USB is accomplished by bringing D+ (for high-speed USB
devices) HIGH through a 1.5 kΩ pull-up resistor. In the ISP1161 the 1.5 kΩ pull-up
resistor is integrated on-chip and is not connected to VCC by default. The connection
is established through a command sent by the external/system microcontroller. This
allows the system microcontroller to complete its initialization sequence before
deciding to establish connection with the USB. Re-initialization of the USB connection
can also be performed without disconnecting the cable.
The ISP1161 DC will check for USB V
established. V
Remark: Note that the tolerance of the internal resistors is 25%. This is higher than
the 5% tolerance specified by the USB specification. However, the overallVSEvoltage
specification for the connection can still be met with a good margin. The decision to
make use of this feature lies with the USB equipment designer.
Indication of a good USB connection is provided at pin GL through GoodLink
technology. During enumeration the LED indicator will blink on momentarily. When
the ISP1161 has been successfully enumerated (the device address is set), the LED
indicator will remain permanently on. Upon each successful packet transfer (with
ACK) to and from the ISP1161 the LED will blink off for 100 ms. During ‘suspend’
state the LED will remain off.
This feature provides a user-friendly indicator of the status of the USB device, the
connected hub and the USB traffic. It is a useful field diagnostics tool for isolating
faulty equipment. It can therefore help to reduce field support and hotline overhead.
7.7 Suspend and wakeup (in DC)
ISP1161’sDC also can be put into suspended state by toggling bit 5, GOSUSP, of the
Mode Register. Pin D_SUSPEND is used for the DC’s suspended state sensing
output. The polarity of D_SUSPEND pin can be changed by setting bit 2, PWROFF,
of the Hardware Configuration Register.
ISP1161
Full-speed USB single-chip host and device controller
GOSUSP
WAKEUP
2 ms0.5 ms
SUSPEND
Fig 8. ISP1161 DC’s suspend and wakeup.
There are some ways to resume ISP1161’s DC from the suspended state:
By USB host, drivers a K-state on the USB bus (global resume)
•
By pin D_WAKEUP or CS.
•
Figure 8 shows the timing relationship for DC going into suspended state, and
resuming from the suspended state.
8.Microprocessor bus interface
8.1 I/O addressing mode
MGS782
ISP1161 provides I/O addressing mode for external microprocessors to access its
internal control registers and FIFO buffer RAM. I/O addressing mode has the
advantage of reducing the pin count for address lines and so occupying less
microprocessor resources. ISP1161 uses only two address lines: A1 and A0 to
access the internal control registers and FIFO buffer RAM. Therefore, ISP1161
occupies only four I/O ports or four memory locations of a microprocessor. External
microprocessors can read or write ISP1161’s internal control registers and FIFO
bufferRAM through the parallel I/O (PIO) operating mode. Figure 9 shows the parallel
I/O interface between a microprocessor and ISP1161.
ISP1161
Full-speed USB single-chip host and device controller
MICRO-
PROCESSOR
D[15:0
RD
WR
IRQ1
IRQ2
µP bus I/F
]
CS
A2
A1
D[15:0
RD
WR
CS
A1
A0
INT1
INT2
]
ISP1161
MGT933
Fig 9. Parallel I/O interface between microprocessor and ISP1161.
8.2 DMA mode
ISP1161 also provides DMA mode for external microprocessors to access its internal
FIFO buffer RAM. Data can be transferred by DMA operation between a
microprocessor’ssystem memory and ISP1161’s internal FIFO buffer RAM. Note: the
DMA operation must be controlled by the external microprocessor system’s DMA
controller (Master). Figure 10 shows the DMA interface between a microprocessor
system and ISP1161. ISP1161 provides two DMA channels: DMA channel 1
(controlled by DREQ1, DACK1 signals) is for the DMA transfer between a
microprocessor’ssystem memory and ISP1161 HC’s internal FIFO buffer RAM. DMA
channel 2 (controlled by DREQ2, DACK2 signals) is for the DMA transfer between a
microprocessor’s system memory and ISP1161 DC’s internal FIFO buffer RAM. The
EOT signal is an external end-of-transfer signal used to terminate the DMA transfer.
Some microprocessors may not have this signal. In this case, ISP1161 provides an
internal EOT signal to terminate the DMA transfer as well. Setting the
HcDMAConfiguration register (21H - Read, A1H - Write) enables ISP1161’s HC
internal DMA counter for DMA transfer. When the DMA counter reaches the value
that is set in the HcTransferCounter (22H - Read, A2H - Write) register to be used as
the byte count of the DMA transfer, the internal EOT signal will be generated to
terminate the DMA transfer.
Full-speed USB single-chip host and device controller
MICRO-
PROCESSOR
D[15:0
RD
WR
DACK1
DREQ1
DACK2
DREQ2
EOT
µP bus I/F
]
D[15:0
RD
WR
DACK1
DREQ1
DACK2
DREQ2
EOT
]
ISP1161
MGT934
Fig 10. DMA interface between microprocessor and ISP1161.
8.3 Microprocessor read/write ISP1161’s internal control registers by
PIO mode
8.3.1 I/O port addressing
Table 3 shows ISP1161’s I/O port addressing. Complete decoding of the I/O port
address should include the chip select signal CS and the address lines A1 and A0.
However, the direction of the access of the I/O ports is controlled by the RD and WR
signals. When RD is LOW, the microprocessor reads data from ISP1161’s data port.
When WR is LOW, the microprocessor writes a command to the command port, or
writes data to the data port.
Table 3:I/O port addressing
PortCS[A1:A0]
(Bin)
AccessData bus width
(bits)
Description
0000R/W16HC data port
1001W16HC command port
2010R/W16DC data port
3011W16DC command port
Figure 11 and Figure 12 illustrate how an external microprocessor accesses
Fig 11. A microprocessor accessing a HC or a DC via an automux switch.
Full-speed USB single-chip host and device controller
AUTOMUX
DC/HC
µP bus I/F
A1
When A1 = 0, microprocessor accesses the HC.
When A1 = 1, microprocessor accesses the DC.
CMD/DATA
SWITCH
command port
Host or Device
bus I/F
A0
1
data port
0
0
1
Host bus I/F
Device bus I/F
MGT935
.
.
.
ISP1161
Commands
Command register
When A0 = 0, microprocessor accesses the data port.
When A0 = 1, microprocessor accesses the command port.
Fig 12. Access to internal control registers.
8.3.2 Register access phases
ISP1161’s register structure is a command-data register pair structure. A complete
register access cycle comprises a command phase followed by a data phase. The
command (also known as the index of a register) points the ISP1161 to the next
register to be accessed. A command is 8 bits long. On a microprocessor’s 16-bit data
bus, a command occupies the lower byte, with the upper byte filled with zeros.
Figure 13 shows a complete 16-bit register access cycle for ISP1161. The
microprocessor writes a command code to the command port, and then reads from or
writes the data word to the data port. Take the example of a microprocessor
attempting to read a chip’s ID, which is saved in the HC’s HcChipID register (27H,
read only) where its command code is 27H, read only. The 16-bit register access
cycle is therefore:
1. Microprocessor writes the command code of 27H (0027H in 16-bit width) to
ISP1161’s HC command port
2. Microprocessor reads the data word of the chip’s ID (6110H) from ISP1161’s HC
data port.
For ISP1161’s ES1 (engineering sample: version one), the chip’s ID is 6110H, where
the upper byte of 61H stands for ISP1161, and the lower byte of 10H stands for the
first version of the IC chip.
ISP1161
Full-speed USB single-chip host and device controller
16-bit register access cycle
write command
(16 bits)
read/write data
(16 bits)
t
MGT937
Fig 13. 16-bit register access cycle.
Most of ISP1161’s internal control registers are 16 bits wide. Some of the internal
control registers, however, have 32-bit width. Figure 14 shows how ISP1161’s 32-bit
internal control register is accessed. The complete cycle of accessing a 32-bit
register consists of a command phase followed by two data phases. In the two data
phases, the microprocessor should first read or write the lower 16-bit data, followed
by the upper 16-bit data.
32-bit register access cycle
write command
(16 bits)
read/write data
(lower 16 bits)
read/write data
(upper 16 bits)
t
MGT938
Fig 14. 32-bit register access cycle.
To further describe the complete access cycles of ISP1161’s internal control
registers, the status of some pin signals of the microprocessor bus interface are
shown in Figure 15 and Figure 16 for the HC and the DC respectively.
Full-speed USB single-chip host and device controller
SignalsValid status
CS
A1, A0
RD, WR
data bus
0
11
RD = 1,
WR = 0
Command code
Valid status
0
10
RD = 0 (read) or
WR = 0 (write)
Register data
(lower word)
Valid status
0
10
RD = 0 (read) or
WR = 0 (write)
Register data
(upper word)
Fig 16. Accessing ISP1161 DC control registers.
8.4 Microprocessor read/write ISP1161’s internal FIFO buffer RAM by
PIO mode
Since ISP1161’s internalmemory is structured as a FIFO bufferRAM, the FIFO buffer
RAM is mapped to dedicated register fields. Therefore, accessing ISP1161’s internal
FIFO buffer RAM is just like accessing the internal control registers in multiple data
phases.
Figure 17 shows a complete access cycle of ISP1161’sinternal FIFO bufferRAM. For
a writecycle, the microprocessor first writes the FIFO buffer RAM’s command code to
the command port, and then writes the data words one by one to the data port until
half of the transfer’s byte count is reached. The HcTransferCounter register (22H Read, A2H - Write) is used to specify the byte count of a FIFO buffer RAM’s read
cycle or write cycle. Every access cycle must be in the same access direction. The
read cycle procedure is similar to the write cycle.
For ISP1161 DC’s FIFO buffer RAM access, see Section 11.
The DMA interface between a microprocessor and ISP1161 is shown in Figure 10.
When doing a DMA transfer, at the beginning of every burst the ISP1161 outputs a
DMA request to the microprocessor via the DREQ pin (DREQ1 for HC, DREQ2 for
DC). After receiving this signal, the microprocessor will reply with a DMA
acknowledge to ISP1161 via the DACK pin (DACK1 for HC, DACK2 for DC), and at
the same time, do the DMA transferthrough the data bus. For normal DMA mode, the
microprocessor must still issue a RD or WR signal to ISP1161’s RD or WR pin.
(DACK Only mode does not need the RD or WR signal.) ISP1161 will repeat the DMA
cycles until it receives an EOT signal to terminate the DMA transfer.
ISP1161 supports both external EOT and internal EOT signals. The external EOT
signal is received as input from ISP1161’s EOT pin: it generally comes from the
external microprocessor. The internal EOT signal is generated by ISP1161 internally.
To select either, set the DMA configuration registers. For example, for the HC, setting
bit 2 of the HcDMAConfiguration register (21H - Read, A1H - Write) to 1 will enable
the DMA counter for DMA transfer. When the DMA counter reaches the value of
HcTransferCounter register, the internal EOT signal will be generated to terminate the
DMA transfer.
ISP1161 supports either single-cycle burst mode DMA operation or multiple-cycle
burst mode DMA operation.
DREQ
ISP1161
Full-speed USB single-chip host and device controller
DACK
RD or WR
]
D[15:0
data #1data #2data #N
EOT
N = 1/2 byte count of transfer data.
Fig 18. DMA transfer for single-cycle burst mode.
DREQ
DACK
RD or WR
]
D[15:0
data #1data #Kdata #2Kdata #Ndata #(K+1)data #(N−K+1)
MGT942
EOT
MGT943
N = 1/2 byte count of transfer data, K = number of cycles/burst.
Fig 19. DMA transfer for multi-cycle burst mode.
In both figures, the DMA transfer is configured such that DREQ is active HIGH and
DACK is active LOW.
ISP1161 has separate interrupt request pins for the USB HC (INT1) and the USB DC
(INT2).
8.6.1 Pin configuration
The interrupt output signals have four configuration modes:
•
•
•
•
Figure 20 shows these four interrupt configuration modes. They are programmable
through register settings, which are also used to disable or enable the signals.
ISP1161
Full-speed USB single-chip host and device controller
Level trigger, active LOW
Level trigger, active HIGH
Edge trigger, active LOW
Edge trigger, active HIGH.
INT
(1) INT is level triggered, active LOW
INT
(2) INT is level triggered, active HIGH
INT
(3) INT is edge triggered, active LOW
INT
(4) INT is edge triggered, active HIGH
Fig 20. Interrupt pin operating modes.
8.6.2 HC’s interrupt output pin (INT1)
To program the four configuration modes of the HC’s interrupt output signal (INT1),
set bits 1 and 2 of the HcHardwareConfiguration register (20H - Read, A0H - Write).
Bit 0 is used as the master enable setting for pin INT1.
INT active
INT active
INT active
167 ns
INT active
167 ns
clear or disable INT
clear or disable INT
MGT944
INT1 has many interrupt events. The relationship between pin INT1 and its interrupt
events is shown as in Figure 21.
Full-speed USB single-chip host and device controller
HcInterruptStatus
register
SO
SF
RD
UE
FNO
RHSC
SO IE
SF IE
RD IE
UE IE
FNO IE
RHSC IE
HcInterruptEnable
register
X
X
Fig 21. HC interrupt logic.
HcuPInterrupt
register
SOF/ITL
ATL
All EOT
OPR Reg
HcSuspend
ClkReady
PULSE
GENERATOR
1
0
INT1
MGT945
SOF/ITL IE
ATL IE
All EOT IE
OPR Reg IE
HcSuspend IE
ClkReady IE
HcuPInterruptEnable
register
INT Enable
INT Trigger
INT Polarity
.
.
.
HcHardwareConfiguration
register
The interrupt events of the HcµPInterrupt register (24H - Read, A4H - Write) changes
the status of pin INT1 when the corresponding bits of the HcµPInterruptEnable
register (25H - Read, A5H - Write) and pin INT1’s global enable bit (bit 0 of the
HcHardwareConfiguration register) are all set to enable status.
However, events that come from the HcInterruptStatus register (03H - Read, 83H Write) affect only the OPR_Reg bit of the HcµPInterrupt register. They cannot directly
change the status of pin INT1.
8.6.3 DC’s interrupt output pin (INT2)
The DC’s interrupt output pin INT2’s four configuration modes can also be
programmed by setting bit 0 (INTPOL) and bit 1 (INTLVL) of the DC’s hardware
configuration register (BBH - Read, BAH - Write). Bit 3 (INTENA) of the DC’s mode
register (B9H - Read, B8H - Write) is used as pin INT2’s global enable setting.
Figure 22 shows the relationship between the interrupt events and pin INT2.
Each of the indicated USB events is logged in a status bit of the Interrupt Register.
Corresponding bits in the Interrupt Enable Register determine whether or not an
event will generate an interrupt.
Interrupts can be masked globally by means of the INTENA bit of the Mode Register
(see Table 80).
The active level and signalling mode of the INT output is controlled by the INTPOL
and INTLVL bits of the Hardware Configuration Register (see Table 82). Default
settings after reset are active LOW and level mode. When pulse mode is selected, a
pulse of 166 ns is generated when the OR-ed combination of all interrupt bits
changes from logic 0 to logic 1.
Bits RESET, RESUME, EOT and SOF are cleared upon reading the Interrupt
Register.The endpoint bits (EP0OUT to EP14) are cleared by reading the associated
Endpoint Status Register.
Bit BUSTATUS follows the USB bus status exactly, allowing the firmware to get the
current bus status when reading the Interrupt Register.
SETUP and OUT token interrupts are generated after ISP1161’s DC has
acknowledged the associated data packet. In bulk transfer mode, the ISP1161’s DC
will issue interrupts for every ACK received for an OUT token or transmitted for an IN
token.
In isochronous mode, an interrupt is issued upon each packet transaction. The
firmware must take care of timing synchronization with the host. This can be done via
the Pseudo Start-Of-Frame (PSOF) interrupt, enabled via bit IEPSOF in the Interrupt
Enable Register. If a Start-Of-Frame is lost, PSOF interrupts are generated every
1 ms. This allows the firmware to keep data transfer synchronized with the host. After
3 missed SOF events the ISP1161’s DC will enter ‘suspend’ state.
An alternative way of handling isochronous data transfer is to enable both the SOF
and the PSOF interrupts and disable the interrupt for each isochronous endpoint.
ISP1161
Full-speed USB single-chip host and device controller
ISP1161’s USB HC has four USB states−USB Operational, USB Reset, USB
Suspend, and USB Resume− that define the HC’s USB signaling and bus states
responsibilities. The signals are visible to the HC (software) Driver via ISP1161 USB
HC’s control registers.
ISP1161
Full-speed USB single-chip host and device controller
USB_OPERATIONAL write
USB_SUSPEND write
Fig 23. ISP1161 HC’s USB states.
The USB states are reflected in the HostControllerFunctionalState field of the
HcControl register (01H - Read, 81H - Write), which is located at bits 7 and 6 of the
register.
USB_OPERATIONAL
USB_SUSPEND
software reset
USB_OPERATIONAL write
USB_RESUME
USB_RESUME write
or
remote wake-up
USB_RESET write
USB_RESET write
USB_RESET write
USB_RESET
hardware reset
MGT947
The HC Driver can perform only the USB state transitions shown in Figure 23.
Remark: The Software Reset in Figure 23 is not caused by the HcSoftwareReset
command. It is caused by the HostControllerReset field of the HcCommandStatus
register (02H - Read, 82H - Write).
9.2 Generating USB traffic
USB traffic can be generated only when the ISP1161 USB HC is under the USB
Operational State. Therefore, the HC Driver must set the
HostControllerFunctionalState field of the HcControl register before generating USB
traffic.
A simplistic flow diagram showing when and how to generate USB traffic is shown in
Figure 24. For greater accuracy, refer to both the
Revision 1.1
ISP1161
Full-speed USB single-chip host and device controller
Universal Serial Bus Specification
about the protocol and ISP1161 USB HC’s register usage.
Reset
HC state =
Initialize
HC
Entry
Fig 24. ISP1161 HC operating flow.
USB_Operational
Reset
•
This includes hardware reset by pin RESET and software reset by the
HcSoftwareReset command (A9H). The reset function will clear all the HC’s
internal control registers to their reset status. After reset, the HC Driver must
initialize the ISP1161 USB HC by setting some registers.
Initialize HC
•
It includes:
– Setting the physical size for the HC’s internal FIFO buffer RAM by setting the
HcITLBufferLength register (2AH - Read, AAH - Write) and the
HcATLBufferLength register (2BH - Read, ABH - Write)
– Setting the HcHardwareConfiguration register according to requirements
– Clearing interrupt events, if required
– Enabling interrupt events, if required
– Setting the HcFmInterval register (0DH - Read, 8DH - Write)
– Setting the HC’s root hub registers
– Setting the HcControl register to move the HC into USB Operational state
See also Section 9.5.
Entry
•
The normal entry point. The microprocessor returns to this point when there are
HC requests.
Need USB Traffic
•
USB devices need the HC to generate USB traffic when they have USB traffic
requests such as:
– Connecting to or disconnecting from the downstream ports
– Issuing the Resume signal to the HC
To generate USB traffic, the HC Driver must enter the USB transaction loop.
Full-speed USB single-chip host and device controller
Prepare PTD Data in µP System RAM
The communication channel between the HC Driver and ISP1161’s USB HC is in
the form of Philips Transfer Descriptor (PTD) data. The PTD data provides USB
traffic information about the commands, status, and USB data packets.
The physical storage media of PTD data for the HC Driver is the microprocessor’s
system RAM. For ISP1161’s USB HC, it is the ISP1161’s internal FIFO buffer
RAM.
The HC Driver prepares PTD data in the microprocessor’s system RAM for transfer
to ISP1161’s HC internal FIFO buffer RAM.
Transfer PTD Data into HC’s FIFO Buffer RAM
When PTD data is ready in the microprocessor’s system RAM, the HC Driver must
transfer the PTD data from the microprocessor’s system RAM into ISP1161’s
internal FIFO buffer RAM.
HC Interprets PTD Data
The HC determines what USB transactions are required based on the PTD data
that have been transferred into the internal FIFO buffer RAM.
HC Performs USB Transactions via USB Bus Interface
The HC performs the USB transactions with the specified USB device endpoint
through the USB bus interface.
HC Informs HCD the USB Traffic Results
The USB transaction status and the feedback from the specified USB device
endpoint will be put back into the ISP1161’s HC internal FIFO buffer RAM in PTD
data format. The HC Driver can read back the PTD data from the internal FIFO
buffer RAM.
9.3 PTD data structure
The Philips Transfer Descriptor (PTD) data structure provides a communication
channel between the HC Driver and the ISP1161’s USB HC. PTD data contains
information required by the USB traffic. PTD data consists of a PTD followed by its
payload data, as shown in Figure 25.
Full-speed USB single-chip host and device controller
The PTD data structure is used by the HC to define a bufferof data that will be moved
to or from an endpoint in the USB device. This data buffer is set up for the current
frame (1 ms frame) by the firmware, the HC Driver. The payload data for every
transfer in the frame must have a PTD as a header to describe the characteristic of
the transfer. PTD data is DWORD aligned.
9.3.1 PTD data header definition
The PTD forms the header of the PTD data. It tells the HC the transfer type, where
the payload data should go, and the payload data’s actual size. A PTD is an 8-byte
data structure that is very important for HC Driver programming.
Table 4:Philips Transfer Descriptor (PTD): bit allocation
Full-speed USB single-chip host and device controller
Table 5:Philips Transfer Descriptor (PTD): bit description
SymbolAccessDescription
ActualBytes[9:0]R/WContains the number of bytes that were transferred for this PTD
CompletionCode[3:0]R/W0000NoErrorGeneral TD or isochronous data packet processing
completed with no detected errors.
0001CRCLast data packet from endpoint contained a CRC error.
0010BitStuffingLast data packet from endpoint contained a bit stuffing
violation.
0011DataToggleMismatchLast packet from endpoint had data toggle PID that did
not match the expected value.
0100StallTD was moved to the Done queue because the
endpoint returned a STALL PID.
0101DeviceNotResponding Devicedid not respond to token (IN) or did not provide a
handshake (OUT).
0110PIDCheckFailureCheck bits on PID from endpoint failed on data PID (IN)
or handshake (OUT)
0111UnexpectedPIDReceived PID was not valid when encountered or PID
value is not defined.
1000DataOverrunThe amount of data returned by the endpoint exceeded
either the size of the maximum data packet allowed
from the endpoint (foundin MaximumPacketSize field of
ED) or the remaining buffer size.
1001DataUnderrunThe endpoint returned is less than MaximumPacketSize
and that amount was not sufficient to fill the specified
buffer.
1010reserved1011reserved1100BufferOverrunDuring an IN, the HC received data from an endpoint
faster than it could be written to system memory.
1101BufferUnderrunDuring an OUT, the HC could not retrieve data from the
system memory fast enough to keep up with the USB
data rate.
ActiveR/WSet to logic 1 by firmware to enable the execution of transactions by the HC. When the
transaction associated with this descriptor is completed, the HC sets this bit to logic 0,
indicating that a transaction for this element should not be executed when it is next
encountered in the schedule.
ToggleR/WUsed to generate or compare the data PID value (DATA0 or DATA1). It is updated after
each successful transmission or reception of a data packet.
MaxPacketSize[9:0]RThe maximum number of bytes that can be sent to or received from the endpoint in a
single data packet.
EndpointNumber[3:0]RUSB address of the endpoint within the function.
Last(PTD)RLast PTD of a list (ITL or ATL). A logic 1 indicates that the PTD is the last PTD.
(Low)SpeedRSpeed of the endpoint:
Full-speed USB single-chip host and device controller
Table 5:Philips Transfer Descriptor (PTD): bit description
SymbolAccessDescription
TotalBytes[9:0]RSpecifies the total number of bytes to be transferred with this data structure.ForBulk and
Control only, this can be greater than MaximumPacketSize.
DirectionPID[1:0]R00SETUP
01OUT
10IN
11reserved
FormatRThe format of this data structure. If this is a Control, Bulk or Interrupt endpoint, then
Format = 0. If this is an Isochronous endpoint, then Format = 1.
FunctionAddress[6:0]RThe is the USB address of the function containing the endpoint that this PTD refers to.
…continued
9.4 HC’s internal FIFO buffer RAM structure
9.4.1 Partitions
According to the
USB data transfers: Control, Bulk, Interrupt and Isochronous.
The HC’s internal FIFO buffer RAM is of a physical size of 4 kbytes. This internal
FIFO buffer RAM is used for transferring data between the microprocessor and USB
peripheral devices. This on-chip buffer RAM can be partitioned into two areas:
Acknowledged Transfer List (ATL) buffer and Isochronous (ISO)Transfer List (ITL)
buffer. The ITL buffer is a Ping-pong structured FIFO buffer RAM that is used to keep
the payload data and their PTD header for Isochronous transfers. The ATL buffer is a
non Ping-pong structured FIFO buffer RAM that is used for the other three types of
transfers.
Universal Serial Bus Specification Rev 1.1
, there are four types of
For the ITL buffer, it can be further partitioned into ITL0 and ITL1 for the Ping-Pong
structure. The ITL0 buffer and ITL1 buffer always have the same size. The
microprocessor can put ISO data into either the ITL0 buffer or the ITL1 buffer. When
the microprocessor accesses an ITL buffer, the HC can take over another ITL buffer
at the same time. This architecture can improve the ISO transfer performance.
The Host Controller Driver can assign the logical size for ATL buffer and ITL buffers at
any time, but normally at initialization after power-on reset, by setting the
HcATLBufferLength register (2BH - Read, ABH - Write) and HcITLBufferLength
register (2AH - Read, AAH - Write), respectively. However, the total length (ATL buffer
+ ITL buffer) should not exceed 4 kbytes, the maximum RAM size. Figure 26 shows
the partitions of the internal FIFO buffer RAM. When assigning buffer RAM sizes,
follow this formula:
ATL buffer length + 2 × (ITL buffer size) ≤ 1000H (that is, 4 kbytes)
where: ITL buffer size = ITL0 buffer length = ITL1 buffer length
The following assignments are examples of legal uses of the internal FIFO buffer
Full-speed USB single-chip host and device controller
ATL buffer length = 400H, ITL buffer length = 200H.
This is insufficient use of the internal FIFO buffer RAM.
ATL buffer length = 1000H, ITL buffer length = 0H.
This will use the internal FIFO buffer RAM for only ATL transfers.
ATL buffer length = 0H, ITL buffer length = 800H.
This will use the internal FIFO buffer RAM for only ISO transfers.
FIFO buffer RAM
top
ITL0
ITL buffer
ITL1
ISO data A
ISO data B
programmable
sizes
ISP1161
ATL buffer
Fig 26. HC Internal FIFO buffer RAM partitions.
ATL
bottom
control/bulk/interrupt
data
not used
MGT950
4 kbytes
The actual requirement for the buffer RAM may not reach the maximum size. You can
make your selection based on your application.
The following are some calculations of the ISO_A or ISO_B space for a frame of data:
Maximum number of useful data sent during one USB frame is 1280 bytes (20 ISO
packets of 64 bytes). Total RAM size needed for this is 20 × 8 + 1280 = 1440 bytes.
Maximum number of packets for different endpoints sent during one USB frame is
•
150 (150 ISO packets of 1 byte). Total RAM size needed is
150 × 8 + 150 × 1 = 1350 bytes.
The Ping buffer RAM (ITL0) and the Pong buffer RAM (ITL1) have a maximum size
•
of 2 kbytes each. All data needed for one frame can be stored in the Ping or the
Pong buffer RAM.
When the embedded system wants to initiate a transfer to the USB bus, the data
needed for one frame is transferred to the ATL buffer or ITL buffer. The
microprocessor detects the buffer status through the interrupt routines. When the
HcBufferStatus register (2CH - Read only) indicates that buffer is empty, then the
microprocessor can write data into the buffer. When the HcBufferStatus register
indicates that buffer is full, that is data is ready on the buffer, the microprocessor
needs to read data from the buffer.
During every 1 ms, there might be many events to generate interrupt requests to the
microprocessor for data transfer or status retrieval. However, each of the interrupt
types defined in this specification can be enabled or disabled by setting the
HcµPInterruptEnable register bits accordingly.
The data transfer can be done via PIO mode or DMA mode. The data transfer rate
can go up to 15 Mbyte/s. In DMA operation, single-cycle or multi-cycle burst modes
are supported. For the multi-cycle burst mode, 1, 4, or 8 cycles per burst is supported
for ISP1161.
9.4.2 Data organization
PTD data is used for every data transfer between a microprocessor and the USB bus,
and the PTD data resides in the buffer RAM. For an OUT or SETUP transfer, the
payload data is placed just after the PTD, after which the next PTD is placed. For an
IN transfer,some RAM space is reservedforreceiving a number of bytes that is equal
to the total bytes of the transfer. After this, the next PTD and its payload data are
placed (see Figure 27).
Remark: The PTD is defined for both ATL and ITL type data transfer. For ITL, the
PTD data should be put into ITL buffer RAM, the ISP1161 takes care of the
Ping-Pong action for the ITL buffer RAM access.
ISP1161
Full-speed USB single-chip host and device controller
RAM buffer
top
PTD of OUT transfer
000H
payload data of OUT transfer
PTD of IN transfer
empty space for IN total data
PTD of OUT transfer
payload data of OUT transfer
bottom
Fig 27. Buffer RAM data organization.
7FFH
MGT952
The PTD data (PTD header and its payload data) is a structure of DWORD (doubleword or 4-byte) alignment. This means that the memory address is organized in steps
of 4 bytes. Therefore, the first byte of every PTD and the first byte of every payload
data are located at an address which is a multiple of 4. Figure 28 illustrates an
example in which the first payload data is 14 bytes long, meaning that the last byte of
the payload data is at the location 15H. The next addresses (16H and 17H) are not
multiples of 4. Therefore, the first byte of the next PTD will be located at the next
multiple-of-four address, 18H.
Full-speed USB single-chip host and device controller
RAM buffer
PTD
(8 bytes)
payload data
(14 bytes)
PTD
(8 bytes)
payload data
00Htop
08H
15H
18H
20H
MGT953
Fig 28. PTD data with DWORD alignment in buffer RAM.
9.4.3 Operation & C Program Example
Figure 29 shows the block diagram for internal FIFO buffer RAM operations by PIO
mode. ISP1161 provides one register as the access port for each buffer RAM. For the
ITL buffer RAM, the access port is the ITLBufferPort register (40H - Read, C0H Write). For the ATL buffer RAM, the access port is the ATLBufferPort register (41H Read, C1H - Write). The buffer RAM is an array of bytes (8 bits) while the access port
is a 16-bit register. Therefore, each read/write operation on the port accesses two
consecutive memory locations, incrementing the pointer of the internal buffer RAM by
two.
The lower byte of the access port register corresponds to the data byte at the even
location of the buffer RAM, and the higher byte in the access port register
corresponds to the other data byte at the odd location of the buffer RAM. Regardless
of the number of data bytes to be transferred, the command code must be issued
merely once, and it will be followed by a number of accesses of the data port (see
Section 8.4).
When the pointer of the buffer RAM reaches the value of the HcTransferCounter
register, an internal EOT signal will be generated to set bit 2, AllEOTInterrupt, of the
HcµPinterrupt register and update the HcBufferStatus register, to indicate that the
whole data transfer has been completed.
For ITL buffer RAM, every start of frame (SOF) signal (1 ms) will cause toggling
between ITL0 and ITL1 but this depends on the buffer status. If both ITL0BufferFull
and ITL1BufferFull of the HcBufferStatus register are already logic 1, meaning that
both ITL0 and ITL1 buffer RAMs are full, the toggling will not happen. In this case, the
microprocessor will always have access to ITL1.
Full-speed USB single-chip host and device controller
Following is an example of a C program that shows how to write data into the ATL
buffer RAM. The total number of data bytes to be transferred is 80 (decimal) which
will be set into the HcTransferCounter register as 50H. The data consists of four types
of PTD data:
1. The first PTD header (IN) is 8 bytes, followedby 16 bytes of space reserved for its
payload data;
2. The second PTD header (IN) is also 8 bytes, followed by 8 bytes of space
reserved for its payload data;
3. The third PTD header (OUT) is 8 bytes, followed by 16 bytes of payload data with
values beginning from 0H to FH incrementing by 1;
4. The fourth PTD header (OUT) is also 8 bytes, followedby 8 bytes of payload data
with values beginning from 0H to EH incrementing by 2.
In all PTD’s, we assign device address 5 and endpoint 1. ActualBytes is always zero
(0). TotalBytes equals the number of payload data bytes. The following table shows
the results after running this program.
Table 6:Run results of the C program example
Observed itemsHC not initialized and not
under Operational state
HcµPinterrupt Register
Bit 1 (ATLInt)01microprocessor must read ATL
Bit 2 (AllEOTInterrupt)11transfer completed
HcBufferStatus Register
Bit 2 (ATLBufferFull)11transfer completed
Bit 5 (ATLBufferDone)01PTD data processed by HC
USB Traffic on USB BusNoYesOUT packets can be seen
HC initialized and under
Operational state
Comments
However,if communication with a peripheralUSB device is desired, the deviceshould
be connected to the downstream port and pass enumeration.
//The example program for writing ATL buffer RAM
#include <conio.h>
#include <stdio.h>
#include <dos.h>
// Prepare PTD data to be written into HC ATL buffer RAM:
unsigned int PTDData[0x28]=
{
0x0800,0x1010,0x0810,0x0005, //PTD header for IN token #1
//Reserved space for payload data of IN token #1
0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,
0x0800,0x1008,0x0808,0x0005, //PTD header for IN token #2
//Reserved space for payload data of IN token #2
0x0000,0x0000,0x0000,0x0000,
0x0800,0x1010,0x0410,0x0005, //PTD header for OUT token #1
0x0100,0x0302,0x0504,0x0706, //Payload data for OUT token #1
0x0908,0x0b0a,0x0d0c,0x0f0e,
ISP1161
Full-speed USB single-chip host and device controller
0x0800,0x1808,0x0408,0x0005, //PTD header for OUT token #2
0x0200,0x0604,0x0a08,0x0e0c //Payload data for OUT token #2
};
HcRegWrite(wHcuPInterrupt,0x04); //Clear EOT interrupt bit
//HcRegWrite(wHcITLBufferLength,0x0);
HcRegWrite(wHcATLBufferLength,0x1000); //RAM full use for ATL
//Set the number of bytes to be transferred
HcRegWrite(wHcTransferCounter,0x50);
wCount = 0x28; //Get word count outport
(HcCmdPort,0x00c1); //Command for ATL buffer write
//write 80 (0x50) bytes of data into ATL buffer RAM
for (i=0;i<wCount;i++)
{
outport(HcDataPort,PTDData[i]);
};
//Check EOT interrupt bit
wData = HcRegRead(wHcuPInterrupt);
printf("\n HC Interrupt Status = %xH.\n",wData);
//Check Buffer status register
wData = HcRegRead(wHcBufferStatus);
printf("\n HC Buffer Status = %xH.\n",wData);
}
//
// Read HC 16-bit registers
//
unsigned int HcRegRead(unsigned int wIndex)
{ unsigned int wValue;
}
//
// Write HC 16-bit registers
//
void HcRegWrite(unsigned int wIndex,unsigned int wValue)
{
outport(HcCmdPort,wIndex | 0x80);
outport(HcDataPort,wValue);
}
Host bus I/F
A0
1
0
command port
data port
22H/A2H
24H/A4H
Full-speed USB single-chip host and device controller
Control registers
TransferCounter
µPInterrupt
Commands
Command register
EOT
ISP1161
0
12
2CH
40H/C0H
41H/C1H
000H
001H
3FFH
ITL0 buffer RAM
(8-bit width)
000H
001H
3FFH
Fig 29. PIO access to Internal FIFO buffer RAM.
9.5 HC’s operational model
Upon power up, the HC Driver sets up all operational registers (32-bit). The
FSLargestDataPacket field (bits 30 to 16) of the HcFmInterval register (0DH - Read,
8DH - write) and the HcLSThreshold register (11H - Read, 91H - Write) determine the
end of the frame for full-speed and low-speed packets. By programming these fields,
the effective USB bus usage can be changed. Furthermore,the size of the ITL buffers
(HcITLBufferLength, 2AH - Read, AAH - Write) is programmed.
BufferStatus
ITLBufferPort
ATLBufferPort
(16-bit width)
ITL1 buffer RAM
(8-bit width)
=
toggle
T
000H
001H
7FFH
ATL buffer RAM
(8-bit width)
internal EOT
automatically
increments by 2
SOF
BufferStatus
Pointer
MGT951
In the case when a USB frame contains both ISO and AT packets, two interrupts will
be generated per frame.
One interrupt is issued concurrently with the SOF. This interrupt (the ITLint is set in
the HcµPInterrupt register) triggers reading and writing of the ITL by the
microprocessor, after which the interrupt is cleared by the microprocessor.
Next the programmable AT Interrupt (the ATLint is set in the HcµPInterrupt Register)
is issued, which triggers reading and writing of the ITL by the microprocessor, after
which the interrupt is cleared by the microprocessor. If the microprocessor cannot
handle the ISO interrupt before the next ISO interrupt, disrupted ISO traffic can result.
To be able to send more than one packet to the same Control or Bulk endpoint in the
same frame, an active bit and a ’TotalBytes of transfer’ field are introduced (see
Table 5). The active bit is cleared only if all data of the Philips Transfer Descriptor
(PTD) are transferred or if a transaction at that endpoint contained a fatal error. If all
PTD of the ATLare serviced once and the frame is not over yet, the HC starts looking
for a PTD with the active bit still set. If such a PTD is found and there is still enough
time in this frame, another transaction is started on the USB bus for this endpoint.
For ISO processing, the Host Controller Driver has also to take care of the
BufferStatus register (2CH, Read only) for the ITL buffer RAM operations. After the
Host Controller Driver writes ISO data into ITL buffer RAM, the ITL0BufferFull or
ITL1BufferFull bit (depends if it is ITL0 or ITL1) will be set to logic 1.
ISP1161
Full-speed USB single-chip host and device controller
After the HC processes the ISO data in the ITL buffer RAM then the corresponding
ITL0BufferDone or ITL1BufferDone bit will automatically be set to logic 1.
The Host Controller Driver can clear the buffer status bits by a read of the ITL buffer
RAM, and this must be done within the 1 ms frame from which the ITL0BufferDone or
ITL1BufferDone was set. Failure to do so will cause the ISO processing to stop and a
power on reset or software reset will have to be applied to the HC, a USB reset to the
USB bus must not be made.
For example, in the first frame, for the HCD doing a write of ISO-A data into the ITL0
buffer. This will cause the BufferStatus register to show that the ITL0 buffer is full by
setting the ITL0BufferFull bit to logic 1. At this stage the Host Controller Drivercannot
write ISO data into the ITL0 buffer RAM again.
In the second frame, the Host Controller will process the ISO-A data in the ITL0
buffer. At the same time, the HCD can write ISO-B data into ITL1 buffer. When the
next SOF comes (the beginning of the third frame), both the ITL1BufferFull and
ITL0BufferDone are automatically set to logic 1. In the third frame the HCD has to
read ITL0 buffer at least two bytes (one word) to clear both the ITL0BufferFull and
ITL0BufferDone bits. If both are not cleared, when the next SOF comes (the
beginning of the fourth frame) the ITL0BufferDone bit will be cleared automatically,
but the ITL0BufferFull bit remains at logic 1 and the ITL0BufferFull bit will be unable
to be cleared. This condition will disable the HCD from writing ISO data into the ITL0
buffer again and ISO processing be unable to be carried on. This also applies to the
ITL1 buffer because the ITL0 and ITL1 are Ping-Pong structured buffers. To recover
from this state the power on reset or software reset will have to be applied on the HC.
Time domain behavior
In the first example the CPU is fast enough to read back and download a scenario
before the next interrupt. Note that on the ISO interrupt of frame N:
Full-speed USB single-chip host and device controller
The ISO packet for frame N + 1 will be written;
The AT packet for frame N + 1 will be written.
AT
traffic
on USB
interrupt
ISP1161
ISO
interrupt
read ISO_A(N − 1) write ISO_A(N + 1)
Fig 30. HC time domain behavior: example 1.
In the next example,the microprocessor is still busy transferring the AT data when the
ISO interrupt of the next frame (N + 1) is raised. As a result, there will be no AT traffic
in frame N + 1. The HC should not raise an AT interrupt in frame N + 1. The ATpart is
simply postponed until frame N + 2. On the AT N + 2 interrupt the transfer mechanism
is back to normal operation. This simple mechanism ensures, among other things,
that Control transfers are not dropped systematically from the USB in case of an
overloaded microprocessor.
(frame N)(frame N + 1)(frame N + 2)(frame N + 3)
MGT954
read AT(N)write AT(N + 1)
MGT955
Fig 31. HC time domain behavior: example 2.
In the following example the ISO part is still being written while the Start of Frame
(SOF) of the next frame has occurred. This will result in undefined behaviour for the
ISO data on the USB bus in frame N + 1 (depending on the exact timing data is
corrupted or not). The HC should not raise an AT interrupt in frame N + 1.
The different phases of a Control transfer (SETUP, Data and Status) should never be
put in the same ATL.
9.6 Microprocessor loading
The maximum amount of data that can be transferred for an endpoint during one
frame is 1023 bytes. The number of USB packets that are needed for this batch of
data depends on the Maximum Packet Size that is specified.
ISP1161
Full-speed USB single-chip host and device controller
MGT956
The HC Driver has to schedule the transactions in a frame. On the other hand, the
microprocessor must have the ability to handle the interrupts coming from HC every
1 ms. It must also be able to do the scheduling for the next frame, reading the frame
information from and writing the next frame information to the buffer RAM in the time
between the end of the current frame and the start of the next frame.
9.7 Internal 15 kΩ pull-down resistors for downstream ports
There are four internal 15 kΩ pull-down resistors built in ISP1161 for the two
downstream ports: two resistors for each port. These resistors are software
selectable by programming bit 12 of the HcHardwareConfiguration register (20H Read, A0H - Write). When bit 12 is cleared to logic 0, it means that external 15 kΩ
pull-down resistors should be used. Bit 12 is set to logic 1 that indicates the internal
built in 15 kΩ pull-down resistors will be used instead of external ones. See
Figure 33.
This feature is a cost-saving option. However, the power on reset default value is
logic 0. If you want to use the internal resistors, the HC Driver must check this bit
status after every reset, because a reset action will clear this bit regardless of it being
a hardware reset or a software reset.
Full-speed USB single-chip host and device controller
HcHardware
Configuration
ISP1161
bit 12
internal
15 kΩ
(2×)
D−
D+
MGT957
external
15 kΩ
(2×)
22 Ω
22 Ω
47 pF
(2×)
V
BUS
USB
connector
Using either internal or external 15 kΩ resistors.
Fig 33. Use of 15 kΩ pull-down resistors on downstream ports.
9.8 Overcurrent detection and power switching control
A downstream port provides +5 V power supply to the V
hardware functions to monitor the downstream ports loading conditions and control
their power switching. These hardware functions are implemented by the internal
power switching control circuit and overcurrent detection circuit. H_PSW1 and
H_PSW2 are power switching control output pins (active LOW, open drain) for
downstream port 1 and 2, respectively. H_OC1 and H_OC2 are overcurrent detection
input pins for downstream ports 1 and 2, respectively. Let H_PSWn denote either
H_PSW1 or H_PSW2 and H_OCn denote either H_OC1 or H_OC2.
. The ISP1161 has built-in
BUS
Figure 34 shows the ISP1161 downstream port power management scheme.
The internal OC detection circuit can be used only when VCC(pin 56) is connected to
a +5 V power supply. The HC Driver must set AnalogOCEnable, bit 10 of the
HcHardwareConfiguration register, to logic 1.
An application using the internal OC detection circuit and internal 15 kΩ pull-down
resistors is shown in Figure 35, where H_DMn denotes either pin H_DM1 or H_DM2,
while H_DPn denotes either pin H_DP1 or H_DP2. In this example, the HC Driver
must set both AnalogOCEnable and the DownstreamPort15KresistorSel to logic 1.
They are bit 10 and bit 12 of the HcHardwareConfiguration register, respectively.
When H_OCn detects an overcurrent status on a downstream port, H_PSWn will
output HIGH, a logic 1 to turn off the +5 V power supply to the downstream port V
When there is no such detection, H_PSWn will output LOW, a logic 0 to turn on the
+5 V power supply to the downstream port V
In general applications, we can use a P-channel MOSFET (such as PHP109) as the
power switch for V
P-channel MOSFET, V
the voltage drop (∆V) across the drain and source poles the overcurrent trip voltage.
For the internal overcurrent detection circuit, a voltage comparator has been
designed-in, with a nominal voltage threshold of 75 mV. Therefore, when the
overcurrent trip voltage (∆V) exceeds the voltage threshold, H_PSWn will output a
HIGH level, logic 1 to turn off the P-channel MOSFET.If the P-channel MOSFET has
a R
P-channel MOSFET with a different R
threshold.
ISP1161
Full-speed USB single-chip host and device controller
.
BUS
. Connect the +5 V power supply to the drain pole of the
BUS
to the source pole, and H_PSWn to the gate pole. We call
BUS
of 150 mΩ, the overcurrent threshold will be 500 mA. The selection of a
Full-speed USB single-chip host and device controller
P-Ch
MOSFET
(PHP109)
+
5 V
∆V = +5 V − V
V
BUS
BUS
USB
downstream
port
connector
22 Ω
22 Ω
Fig 35. Using internal OC detection circuit.
47 pF
(2×)
V
CC
H_OCn
H_PSWn
H_DMn
H_DPn
regulator
OC detect
≥
15 kΩ
bit 12
(2×)
OC select
1
0
Reg
PSW
C/L
ATX
HcHardware
Configuration
HC CORE
HcHardware
Configuration
bit 10
SIE
ISP1161
MGT960
9.8.2 Using external OC detection circuit
When VCC (pin 56) is connected to the +3.3 V power supply instead of the +5 V
power supply, then the internal OC detection circuit cannot be used. An external OC
detection circuit must be used instead. Nevertheless, regardless of VCC’s
connections, an external OC detection circuit can be used from time to time. To use
an external OC detection circuit, AnalogOCEnable, bit 10 of the
HcHardwareConfiguration register, should be set to logic 0. By default after reset, this
bit is already set to logic 0; therefore, the HC Driver does not need to clear this bit.
Figure 36 shows how to use an external OC detection circuit.
Full-speed USB single-chip host and device controller
+
3.3 V or +5 V
V
CC
+
5 V
i
H_OCn
H_PSWn
H_DMn
regulator
OC detect
≥
OC select
1
0
Reg
PSW
C/L
HC CORE
HcHardware
Configuration
bit 10
22 Ω
47 pF
(2×)
H_DPn
Fig 36. Using external OC detection circuit.
10. Suspend and wakeup (in HC)
10.1 HC suspended state
The HC can be put into suspended state by setting the HcControl register (01H Read, 81H - Write). See Figure 23 for the HC’s flow of USB states changes.
With the device in a suspended state it will consume considerably less power by
turning off the internal 48 MHz clock, PLL and crystal, and setting the internal
regulator to power-down mode. The ISP1161 suspend and resume clock scheme is
shown in Figure 37.
Remark: ISP1161 can be put into a fully suspended mode only after both the HC and
the DC go into the suspended mode, when the crystal can be turned off and the
internal regulator can be put into power-down mode.
Pin H_SUSPEND is the sensing output pin for HC’s suspended state. When the HC
goes into SUSPEND state, this pin will output a HIGH level (logic 1). This pin is
cleared to LOW (logic 0) level only when the HC is put into a RESET state or
OPERATIONAL state (refer to the HcControl register bits 7 to 6, 01H - Read, 81H Write). By setting bit 11, SuspendClkNotStop, of the HcHardwareConfiguration
register (20H - Read, A0H - Write), you can also define such that when the HC goes
into SUSPEND state, its internal clock is stopped or kept running. After HC enters the
SUSPEND State for 1.3 ms, the internal clock will be stopped if bit
SuspendClkNotStop is logic 0.
10.2 HC wakeup from suspended state
ISP1161
Full-speed USB single-chip host and device controller
There are three methods to wake up the HC from the USB SUSPEND state:
hardware wakeup, software wakeup, and USB bus resume. They are described as
follows:
10.2.1 Wakeup by pin H_WAKEUP
Pins H_SUSPEND and H_WAKEUP provide hardware wakeup, a way of remote
wakeup control for the HC without the need to access the HC internal registers.
H_WAKEUP is an external wakeup control input pin for the HC. After the HC goes
into SUSPEND state, it can be woken up by sending a HIGH level pulse to pin
H_WAKEUP. This will turn on the HC’s internal clock, and set bit 6, ClkReady, of the
HcµPInterrupt register (24H - Read, A4H - Write). Under the SUSPEND state, once
pin H_WAKEUP goes HIGH, after 160 µs, the internal clock will be up. After the
internal clock is up, it will be kept running at least 1.14 ms depending on the status of
pin H_WAKEUP. If pin H_WAKEUP is HIGH, then the internal clock will be kept
running. If pin H_WAKEUP is LOW, then the internal clock can be kept running for
1.14 ms only, unless the microprocessor sets the HC into OPERATIONAL state
during this time.
10.2.2 Wakeup by pin CS (software wakeup)
During the SUSPEND state, an external microprocessor issues the chip select signal
through pin CS to ISP1161. This method of access to ISP1161 internal registers is a
software wakeup.
10.2.3 Wakeup by USB devices
For the USB bus resume, a USB device attached to the root hub port issues a
resume signal to the HC through the USB bus, switching the HC from SUSPEND
state to RESUME State. This will also set the ResumeDetected bit, bit 3 of the
HcInterruptStatus register (03H - Read, 83H - Write).
No matter which method is used to wake up the HC from SUSPEND state, you must
enable the corresponding interrupt bits before the HC goes into SUSPEND state so
that the microprocessor can receive the correct interrupt request to wake up the HC.
11. The USB device controller (DC)
The Device Controller (DC) in ISP1161 originates from Philips ISP1181 USB
Full-Speed Interface Device IC. The functionality is same as ISP1181 in 16-bit bus
mode. The command and register sets are also the same. Refer also to the ISP1181
datasheet for a description of the operation of ISP1161’s DC. If there is any difference
found in ISP1181 and ISP1161 datasheet in terms of the DC’s functionality, the
ISP1161 datasheet supersedes the content in ISP1181 datasheet.
In general the DC in ISP1161 provides 16 endpoints for USB device implementation.
Each endpoint can be allocated an amount of RAM space in the on-chip Ping-Pong
Buffer RAM. Note: the Ping-Pong buffer RAM for the DC is independent of the buffer
RAM in the HC. When the buffer RAM is full, the DC will transfer the data in the buffer
RAM to the USB bus. When the buffer RAM is empty, an interrupt is generated to
notify the microprocessor to feed in the data. The transfer of data between the
microprocessor and the DC can be done in Parallel I/O (PIO) mode or in DMA mode.
ISP1161
Full-speed USB single-chip host and device controller
11.1 DC data transfer operation
The following session explains how the DC of ISP1161 handles an IN data transfer
and an OUT data transfer. In Device mode, ISP1161 acts as a USB device: an IN
data transfer means transfer from ISP1161 to an external USB Host (through the
upstream port) and an OUT transfer means transfer from external USB Host to
ISP1161.
11.1.1 IN data transfer
The arrival of the IN token is detected by the SIE by decoding the PID.
•
The SIE also checks for the device number and endpoint number and verifies
•
whether they are ok.
If the endpoint is enabled, the SIE checks the contents of the Endpoint Status
•
register. If the endpoint is full, the contents of the FIFO are sent during the data
phase, else a NAK handshake is sent.
After the data phase, the SIE expects a handshake (ACK) from the host (except for
•
ISO endpoints).
On receiving the handshake (ACK), the SIE updates the interrupt register
•
contents, which in turn generates an interrupt to the microprocessor. The Last
Transaction Register (LTR) status is updated and the buffer is set to zero in the
Endpoint Status Register. If it fails to get a handshake, a timeout error is generated
and the LTR status is updated accordingly. For ISO endpoints, the interrupt and
LTR status are updated as soon as data are sent, since there is no handshake
phase.
On receiving an interrupt, the microprocessor reads the interrupt register. It will
•
know which endpoint has generated the interrupt and reads the contents of the
corresponding Endpoint Status register. If the buffer is empty, it fills up the buffer,
so that data can be sent by the SIE at the next IN token phase.
Full-speed USB single-chip host and device controller
The arrival of the OUT token is detected by the SIE by decoding the PID.
The SIE also checks for the device number and endpoint number and verifies
whether they are ok.
If the endpoint is enabled, the SIE checks the contents of the Endpoint Status
register. If the endpoint is empty, the data from USB is stored to FIFO during the
data phase, else a NAK handshake is sent.
After the data phase, the SIE sends a handshake (ACK) to the host (except for ISO
endpoints).
The SIE updates the contents of the interrupt register, which in turn generates an
interrupt to the microprocessor. The LTR status is updated and the buffer is set to
full in the Endpoint Status Register. For ISO endpoints, interrupt and LTR status
are updated as soon as data is received successfully,since there is no handshake
phase.
On receiving interrupt, the microprocessor reads the interrupt register. It will know
which endpoint has generated the interrupt and reads the content of the
corresponding Endpoint Status register. If the buffer is full, it empties the buffer, so
that data can be received by the SIE at the next OUT token phase.
11.2 Device DMA transfer
11.2.1 For OUT endpoint (external USB host to ISP1161’s DC)
When the internal DMA handler is enabled and at least one buffer (Ping or Pong) is
free, the DREQ2 line is asserted. The external DMA controller then starts negotiating
for the bus with ISP1161. As soon as it has access, it asserts the DACK2 line and
starts writing data. The burst length is programmable. When the number of bytes
equal to the burst length has been written, the DREQ2 line is deasserted. As a result,
the DMA controller deasserts the DACK2 line and releases the bus. At that moment
the whole cycle restarts for the next burst.
When the buffer is full, the DREQ2 line will be de-asserted and the buffer is validated
(which means that it will be sent to the host when the next IN token comes in). When
the DMA controller terminates the DMA transfer by asserting EOT, the buffer is also
validated (even if it is not full). In Auto-reload mode, the DMA handler will
automatically restart by asserting its DREQ2 line as soon as a new bufferis available.
If the Auto-reload mode is off, then the DMA handler will be disabled automatically.
For the next DMA transfer, the DMA handler must be reenabled.
11.2.2 For IN endpoint (ISP1161’s DC to external USB host)
When the internal DMA handler is enabled and at least one buffer is full, the DREQ2
line is asserted. The external DMA controller then starts negotiating for the bus with
other parties and as soon as it has access, it asserts the DACK2 line and starts
reading the data. The burst length is programmable.When the number of bytes equal
to the burst length has been read, the DREQ2 line is deasserted. As a result, the
DMA controller deasserts the DACK2 line and releases the bus. At that moment the
whole cycle restarts for the next burst. When all data are read, the DREQ2 line will be
deasserted and the buffer is cleared (which means that it can be overwritten when a
new packet comes in).
When the DMA controller terminates the DMA transfer by asserting EOT and
Auto-reload mode is off, the buffer is also cleared (even if not all data are read) and
the DMA handler is disabled automatically. For the next DMA transfer, the DMA
controller as well as the DMA handler must be re-enabled. However in Auto-reload
mode, the DMA handler will automatically restart by reasserting the DREQ2 line,
without any loss of data.
11.3 Endpoint descriptions
11.3.1 Endpoints with programmable FIFO size
Each USB device is logically composed of several independent endpoints. An
endpoint acts as a terminus of a communication flow between the host and the
device. At design time each endpoint is assigned a unique number (endpoint
identifier, see Table 7). The combination of the device address (given by the host
during enumeration), the endpoint number and the transfer direction allows each
endpoint to be uniquely referenced.
The ISP1161 has 16 endpoints: endpoint 0 (control IN and OUT) plus 14 configurable
endpoints, which can be individually defined as interrupt/bulk/isochronous, IN or OUT.
Each enabled endpoint has an associated FIFO, which can be accessed either via
the parallel I/O interface or via DMA.
ISP1161
Full-speed USB single-chip host and device controller
11.3.2 Endpoint access
Table 7 lists the endpoint access modes and programmability. All endpoints support
I/O mode access. Endpoints 1 to 14 also support DMA access. FIFO DMA access is
selected and enabled via bits EPIDX[3:0] and DMAEN of the DMA Configuration
Register. A detailed description of the DMA operation is given in Section 12.
Table 7:Endpoint access and programmability
Endpoint
identifier
064 (fixed)noyesnocontrol OUT
064 (fixed)noyesnocontrol IN
1programmablesupportedsupportedsupportedprogrammable
2programmablesupportedsupportedsupportedprogrammable
3programmablesupportedsupportedsupportedprogrammable
4programmablesupportedsupportedsupportedprogrammable
5programmablesupportedsupportedsupportedprogrammable
6programmablesupportedsupportedsupportedprogrammable
7programmablesupportedsupportedsupportedprogrammable
8programmablesupportedsupportedsupportedprogrammable
9programmablesupportedsupportedsupportedprogrammable
10programmablesupportedsupportedsupportedprogrammable
11programmablesupportedsupportedsupportedprogrammable
12programmablesupportedsupportedsupportedprogrammable
13programmablesupportedsupportedsupportedprogrammable
14programmablesupportedsupportedsupportedprogrammable
Full-speed USB single-chip host and device controller
[1] IN: input for the USB host (ISP1161 transmits); OUT: output from the USB host (ISP1161 receives).
[2] The data flow direction is determined by bit EPDIR in the Endpoint Configuration Register.
[3] The total amount of FIFO storage allocated to enabled endpoints must not exceed 2462 bytes.
11.3.3 Endpoint FIFO size
The size of the FIFO determines the maximum packet size that the hardware can
support for a given endpoint. Only enabled endpoints are allocated space in the
shared FIFO storage, disabled endpoints have zero bytes. Table 8 lists the
programmable FIFO sizes.
The following bits in the Endpoint Configuration Register (ECR) affect FIFO
allocation:
Endpoint enable bit (FIFOEN)
•
Size bits of an enabled endpoint (FFOSZ[3:0])
•
Isochronous bit of an enabled endpoint (FFOISO).
•
Remark: Register changes that affect the allocation of the shared FIFO storage
among endpoints must not be made while valid data is present in any FIFO of the
enabled endpoints. Such changes will render all FIFO contents undefined.
Full-speed USB single-chip host and device controller
Each programmable FIFO can be configured independently via its ECR, but the total
physical size of all enabled endpoints (IN plus OUT) must not exceed 2462 bytes
(512 bytes for non-isochronous FIFOs).
Table 9 shows an example of a configuration fitting in the maximum availablespace of
2462 bytes. The total number of logical bytes in the example is 1311. The physical
storage capacity used for double buffering is managed by the device hardware and is
transparent to the user.
Table 9:Memory configuration example
Physical size
(bytes)
6464control IN (64 byte fixed)
6464control OUT (64 byte fixed)
20461023double-buffered 1023-byte isochronous endpoint
161616-byte interrupt OUT
161616-byte interrupt IN
12864double-buffered 64-byte bulk OUT
12864double-buffered 64-byte bulk IN
In response to the standard USB request Set Interface,the firmware must program all
16 ECRs of the ISP1161 in sequence (see Table 7), whether the endpoints are
enabled or not. The hardware will then automatically allocate FIFO storage space.
If all endpoints have been configured successfully, the firmware must return an empty
packet to the control IN endpoint to acknowledge success to the host. If there are
errors in the endpoint configuration, the firmware must stall the control IN endpoint.
When reset by hardware or via the USB bus, the ISP1161 DC disables all endpoints
and clears all ECRs, except for the control endpoint which is fixed and always
enabled.
Endpoint initialization can be done at any time; however, it is valid only after
enumeration.
11.3.5 Endpoint I/O mode access
When an endpoint event occurs (a packet is transmitted or received), the associated
endpoint interrupt bits (EPn) of the Interrupt Register (IR) will be set by the SIE. The
firmware then responds to the interrupt and selects the endpoint for processing.
ISP1161
Full-speed USB single-chip host and device controller
The endpoint interrupt bit will be cleared by reading the Endpoint Status Register
(ESR). The ESR also contains information on the status of the endpoint buffer.
For an OUT (= receive) endpoint, the packet length and packetdata can be read from
ISP1161 using the Read Buffer command. When the whole packet has been read,
the firmware sends a Clear Buffer command to enable the reception of new packets.
For an IN (= transmit) endpoint, the packet length and data to be sent can be written
to ISP1161 DC using the Write Buffer command. When the whole packet has been
written to the buffer, the firmware sends a Validate Buffer command to enable data
transmission to the host.
11.3.6 Special actions on control endpoints
Control endpoints require special firmware actions. The arrival of a SETUP packet
flushes the IN buffer and disables the Validate Buffer and Clear Buffer commands for
the control IN and OUT endpoints. The microcontroller needs to re-enable these
commands by sending an Acknowledge Setup command to both control endpoints.
This ensures that the last SETUP packet stays in the buffer and that no packets can
be sent back to the host until the microcontroller has explicitly acknowledged that it
has seen the SETUP packet.
Full-speed USB single-chip host and device controller
12. DMA transfer for the Device Controller
Direct Memory Access (DMA) is a method to transfer data from one location to
another in a computer system, without intervention of the Central Processor Unit
(CPU). Many different implementations of DMA exist. The ISP1161 DC supports two
methods:
8237 compatible mode: based on the DMA subsystem of the IBM personal
•
computers (PC, AT and all its successors and clones); this architecture uses the
Intel 8237 DMA controller and has separate address spaces for memory and I/O
DACK-only mode: based on the DMA implementation in some embedded RISC
•
processors, which has a single address space for both memory and I/O.
The ISP1161 DC supports DMA transfer for all 14 configurable endpoints (see
Table 7). Only one endpoint at a time can be selected for DMA transfer. The DMA
operation of the ISP1161 DC can be interleaved with normal I/O mode access to
other endpoints.
The following features are supported:
ISP1161
Single-cycle or burst transfers (up to 16 bytes per cycle)
short/empty packet
Programmable signal levels on pins DREQ2, DACK2 and EOT.
•
12.1 Selecting an endpoint for DMA transfer
The target endpoint for DMA access is selected via bits EPDIX[3:0] in the DMA
Configuration Register, as shown in Table 10. The transfer direction (read or write) is
automatically set by bit EPDIR in the associated ECR, to match the selected endpoint
type (OUT endpoint: read; IN endpoint: write).
Asserting input DACK2 automatically selects the endpoint specified in the DMA
Configuration Register, regardless of the current endpoint used for I/O mode access.
The 8237 compatible DMA mode is selected by clearing bit DAKOLY in the Hardware
Configuration Register (see Table 81). The pin functions for this mode are shown in
Table 11.
Table 11: 8237 compatible mode: pin functions
SymbolDescriptionI/OFunction
DREQ2DC’s DMA requestOISP1161 DC requests a DMA transfer
DACK2DC’s DMA
acknowledge
EOTend of transferIDMA controller terminates the transfer
RDread strobeIinstructs ISP1161 DC to put data on the
WRwrite strobeIinstructs ISP1161 DC to get data from the
…continued
EPDIR = 0EPDIR = 1
IDMA controller confirms the transfer
bus
bus
The DMA subsystem of an IBM compatible PC is based on the Intel 8237 DMA
controller. It operates as a ‘fly-by’ DMA controller: the data is not stored in the DMA
controller, but it is transferred between an I/O port and a memory address. A typical
example of ISP1161 DC in 8237 compatible DMA mode is given in Figure 38.
The 8237 has two control signals for each DMA channel: DREQ (DMA Request) and
DACK (DMA Acknowledge). General control signals are HRQ (Hold Request), HLDA
(Hold Acknowledge) and EOP (End-Of-Process). The bus operation is controlled via
MEMR (Memory Read), MEMW (Memory Write), IOR (I/O read) and IOW (I/O write).
D0 to D15
ISP1161
DEVICE
CONTROLLER
DREQ2
DACK2
RD
WR
RAM
Fig 38. ISP1161’s device controller in 8237 compatible DMA mode.
The following example shows the steps which occur in a typical DMA transfer:
1. ISP1161 DC receives a data packetin one of its endpoint FIFOs; the packet must
2. ISP1161 DC asserts the DREQ2 signal requesting the 8237 for a DMA transfer.
3. The 8237 asks the CPU to release the bus by asserting the HRQ signal.
4. After completing the current instruction cycle, the CPU places the bus control
5. The 8237 now sets its address lines to 1234H and activates the MEMW and IOR
6. The 8237 asserts DACK to inform the ISP1161 DC that it will start a DMA
7. The ISP1161 DC now places the word to be transferred on the data bus lines,
8. The 8237 waits one DMA clock period and then de-asserts MEMW and IOR. This
9. The ISP1161 DC de-asserts the DREQ2 signal to indicate to the 8237 that DMA
10. The 8237 de-asserts the DACK output indicating that the ISP1161 must stop
11. The 8237 places the bus control signals (MEMR, MEMW, IOR and IOW) and the
12. The CPU acknowledges control of the bus by de-asserting HLDA. After activating
ISP1161
Full-speed USB single-chip host and device controller
be transferred to memory address 1234H.
signals (MEMR, MEMW, IOR and IOW) and the address lines in three-state and
asserts HLDA to inform the 8237 that it has control of the bus.
control signals.
transfer.
because its RD signal was asserted by the 8237.
latches and stores the word at the desired memory location. It also informs the
ISP1161 DC that the data on the bus lines has been transferred.
is no longer needed. In Single cycle mode this is done after each word, in Burstmode following the last transferred word of the DMA cycle.
placing data on the bus.
address lines in three-state and de-asserts the HRQ signal, informing the CPU
that it has released the bus.
the bus control lines (MEMR, MEMW, IOR and IOW) and the address lines, the
CPU resumes the execution of instructions.
For a typical bulk transfer the above process is repeated, once for each byte. After
each byte the address register in the DMA controller is incremented and the byte
counter is decremented. When using 16-bit DMA the number of transfers is 32 and
address incrementing and byte counter decrementing is done by 2 for each word.
12.3 DACK-only mode
The DACK-only DMA mode is selected by setting bit DAKOLY in the Hardware
Configuration Register (see Table 81). The pin functions for this mode are shown in
Table 12. A typical example of ISP1161 DC in DACK-only DMA mode is given in
Figure 39.
Table 12: DACK-only mode: pin functions
SymbolDescriptionI/OFunction
DREQ2DC’s DMA requestOISP1161 DC requests a DMA transfer
DACK2DC’s DMA
Full-speed USB single-chip host and device controller
Table 12: DACK-only mode: pin functions
SymbolDescriptionI/OFunction
EOTEnd-Of-TransferIDMA controller terminates the transfer
RDread strobeInot used
WRwrite strobeInot used
…continued
In DACK-only mode the ISP1161 DC uses the DACK2 signal as a data strobe. Input
signals RD and WR are ignored. This mode is used in CPU systems that have a
single address space for memory and I/O access. Such systems have no separate
MEMW and MEMR signals: the RD and WR signals are also used as memory data
strobes.
ISP1161
DEVICE
CONTROLLER
DREQ2
DACK2
D0 to D15
RAM
DMA
CONTROLLER
DREQ
DACK
RD
WR
HRQ
HLDA
CPU
HRQ
HLDA
004aaa010
Fig 39. ISP1161’s device controller in DACK-only DMA mode.
12.4 End-Of-Transfer conditions
12.4.1 Bulk endpoints
A DMA transfer to/from a bulk endpoint can be terminated by any of the following
conditions (bit names refer to the DMA Configuration Register, see Table 85):
An external End-Of-Transfer signal occurs on input EOT
•
The internal DMA Counter Register reaches zero (CNTREN = 1)
•
A short/empty packet is received on an enabled OUT endpoint (SHORTP = 1)
•
DMA operation is disabled by clearing bit DMAEN.
•
External EOT: When reading from an OUT endpoint, an external EOT will stop the
DMA operation and clear any remaining data in the current FIFO. For a doublebuffered endpoint the other (inactive) buffer is not affected.
When writing to an IN endpoint, an EOT will stop the DMA operation and the data
packet in the FIFO (even if it is smaller than the maximum packet size) will be sent to
the USB host at the next IN token.
DMA Counter Register zero: An EOT from the DMA Counter Register is enabled by
setting bit CNTREN in the DMA Configuration Register. The ISP1161 has a 16-bit
DMA Counter Register, which specifies the number of bytes to be transferred. When
DMA is enabled (DMAEN = 1), the internalDMA counter is loaded with the value from
the DMA Counter Register. When the internal counter reaches zero an EOT condition
is generated and the DMA operation stops.
Short/empty packet: Normally, the transfer byte count must be set via a control
endpoint before any DMA transfer takes place. When a short/empty packet has been
enabled as EOT indicator (SHORTP = 1), the transfer size is determined by the
presence of a short/empty packet in the data. This mechanism permits the use of a
fully autonomous data transfer protocol.
When reading from an OUT endpoint, reception of a short/empty packet at an OUT
token will stop the DMA operation after transferring the data bytes of this packet.
When writing to an IN endpoint, a short packet transferred at an IN token will stop the
DMA operation after all bytes have been transferred. If the number of bytes in the
buffer is zero, ISP1161 DC will automatically send an empty packet.
Table 13: Summary of EOT conditions for a bulk endpoint
EOT conditionOUT endpointIN endpoint
EOT inputEOT is activeEOT is active
DMA Counter Registercounter reaches zerocounter reaches zero
Short packetshort packet is received and
Empty packetempty packet is received and
DMAEN bit in DMA
Configuration Register
ISP1161
Full-speed USB single-chip host and device controller
counter reaches zero in the
transferred
transferred
DMAEN = 0DMAEN = 0
middle of the buffer
empty packet is automatically
appended when needed
[1]
[1] If short/empty packet EOT is enabled (SHORTP = 1 in DMA Configuration Register) and DMA
Counter Register is zero.
12.4.2 Isochronous endpoints
A DMA transfer to/from an isochronous endpoint can be terminated by any of the
following conditions (bit names refer to the DMA Configuration Register, see
Table 85):
An external End-Of-Transfer signal occurs on input EOT
•
The internal DMA Counter Register reaches zero (CNTREN = 1)
•
An End-Of-Packet (EOP) signal is detected
•
DMA operation is disabled by clearing bit DMAEN.
•
Table 14: Recommended EOT usage for isochronous endpoints
EOT conditionOUT endpointIN endpoint
EOT input activedo not usepreferred
DMA Counter Register zerodo not usepreferred
End-Of-Packetpreferreddo not use
The HC contains a set of on-chip control registers. These registers can be read or
written by the Host Controller Driver (HCD). The Control and Status register sets,
Frame Counter register sets, and Root Hub register sets are grouped under the
category of HC Operational Registers (32 bits). These operational registers are made
compatibleto OpenHCI (Host Controller Interface)Operational Registers. This makes
a provision that the OpenHCI HCD can be ported to ISP1161 easily.
Reserved bits may be defined in future releases of this specification. To ensure
interoperability, the HCD that does not use a reservedfield must not assume that the
reserved field contains logic 0. Furthermore, the HCD must always preserve the
values of the reserved field. When a R/W register is modified, the HCD must first read
the register, modify the bits desired, and then write the register with the reserved bits
still containing the read value. Alternatively, the HCD can maintain an in-memory
copy of previously written values that can be modified and then written to the HC
register. When a write to set or clear the register is written, bits written to reserved
fields must be logic 0.
As shown in Table 15, the offset locations (the commands for reading registers) of
these Operational Registers (the 32-bit registers) are similar to those defined in the
OHCI specification, however, the addresses are equal to offset DIV 4:
ISP1161
Full-speed USB single-chip host and device controller
Table 15: HC Control Register summary
Command (Hex) RegisterWidth Functionality
ReadWrite
00N/AHcRevision32HC Control and Status Registers
0181HcControl32
0282HcCommandStatus32
0383HcInterruptStatus32
0484HcInterruptEnable32
0585HcInterruptDisable32
0D8DHcFmInterval32HC Frame Counter Registers
0EN/AHcFmRemaining32
0FN/AHcFmNumber32
1191HcLSThreshold32
1292HcRhDescriptorA32HC Root Hub Registers
1393HcRhDescriptorB32
1494HcRhStatus32
1595HcRhPortStatus[1]32
1696HcRhPortStatus[2]32
20A0HcHardwareConfiguration16HC DMA and Interrupt Control
21A1HcDMAConfiguration16
22A2HcTransferCounter16
24A4HcµPInterrupt16
25A5HcµPInterruptEnable16
31 to 8−Reserved
7 to 0REV[7:0]Revision: This read-only field contains the BCD representation of
the version of the HCI specification that is implemented by this HC.
For example, a value of 11H corresponds to version 1.1. All HC
implementations that are compliant with this specification will have
a value of 10H.
Full-speed USB single-chip host and device controller
Code (Hex): 00 — read only
13.1.2 HcControl Register
The HcControl register defines the operating modes for the HC. Most fields are
modified only by the HCD, except for HostControllerFunctionalState (HCFS) and
RemoteWakeupConnected (RWC).
31 to 11-reserved
10RWERemoteWakeupEnable: This bit is used by the HCD to enable or
9RWCRemoteWakeupConnected: This bit indicates whether the HC
8-reserved
7 to 6HCFSHostControllerFunctionalState for USB:
5 to 0-reserved
ISP1161
Full-speed USB single-chip host and device controller
disable the remote wakeup feature upon the detection of upstream
resume signaling. When this bit is set and the ResumeDetected bit
in HcInterruptStatus is set, a remote wakeup is signaled to the host
system. Setting this bit has no impact on the generation of
hardware interrupt.
supports remote wakeup signaling. If remote wakeup is supported
and used by the system, it is the responsibility of system firmware
to set this bit during POST. The HC clears the bit upon a hardware
reset but does not alter it upon a software reset. Remote wakeup
signaling of the host system is host-bus-specific and is not
described in this specification.
A transition to USBOPERATIONAL from another state causes
start-of-frame (SOF) generation to begin 1 ms later. The HCD may
determine whether the HC has begun sending SOFs by reading
the StartofFrame field of HcInterruptStatus.
This field may be changed by the HC only when in the
USBSUSPEND state. The HC may move from the USBSUSPEND
state to the USBRESUME state after detecting the resume
signaling from a downstream port.
The HC enters USBSUSPEND after a software reset; it enters
USBRESET after a hardware reset. The latter also resets the Root
Hub and asserts subsequent reset signaling to downstream ports.
Code (Hex): 01 — read
Code (Hex): 81 — write
13.1.3 HcCommandStatus Register
The HcCommandStatus register is used by the HC to receive commands issued by
the HCD, and it also reflects the HC’s current status. To the HCD, it appears to be a
‘write to set’ register. The HC must ensure that bits written as logic 1 become set in
the register while bits written as logic 0 remain unchanged in the register. The HCD
may issue multiple distinct commands to the HC without concern for corrupting
previously issued commands. The HCD has normal read access to all bits.
Full-speed USB single-chip host and device controller
The SchedulingOverrunCount field indicates the number of frames with which the HC
has detected the scheduling overrun error. This occurs when the Periodic list does
not complete before EOF. When a scheduling overrun error is detected, the HC
increments the counter and sets the SchedulingOverrun field in the HcInterruptStatus
register.
Table 20: HcCommandStatus Register: bit allocation
Table 21: HcCommandStatus Register: bit description
BitSymbolDescription
31 to 18-reserved
17 to 16SOC[1:0]SchedulingOverrunCount: The field is incremented on each
scheduling overrun error. It is initialized to 00B and wraps around
at 11B. It will be incremented when a scheduling overrun is
detected even if SchedulingOverrun in HcInterruptStatus has
already been set. This is used by HCD to monitor any persistent
scheduling problems.
15 to 1-reserved
0HCRHostControllerReset: This bit is set by HCD to initiate a software
reset of HC. Regardless of the functional state of HC, it moves to
the USBSUSPEND state in which most of the operational registers
are reset except those stated otherwise; e.g., the InterruptRouting
field of HcControl, and no Host bus accesses are allowed. This bit
is cleared by HC upon the completion of the reset operation. The
reset operation must be completed within 10 s. This bit, when set,
should not cause a reset to the Root Hub and no subsequent reset
signaling should be asserted to its downstream ports.
Full-speed USB single-chip host and device controller
13.1.4 HcInterruptStatus Register
This register provides the status of the events that cause hardware interrupts. When
an event occurs, the HC sets the corresponding bit in this register. When a bit
becomes set, a hardware interrupt is generated if the interrupt is enabled in the
HcInterruptEnable register (see Section 13.1.5) and the MasterInterruptEnable bit is
set. The HCD may clear specific bits in this register by writing logic1 to the bit
positions to be cleared. The HCD may not set any of these bits. The HC will not clear
the bit.
Table 22: HcInteruptStatus Register: bit allocation
Table 23: HcInterruptStatus Register: bit description
BitSymbolDescription
31 to 8reserved
7reserved−
6RHSCRootHubStatusChange: This bit is set when the content of
5FNOFrameNumberOverflow: This bit is set when the MSB of
4UEUnrecoverableError: This bit is set when the HC detects a
3RDResumeDetected: This bit is set when the HC detects that a
2SFStartOfFrame: At the start of each frame, this bit is set by the HC
1-reserved
0SOSchedulingOverrun: This bit is set when USB schedules for
ISP1161
Full-speed USB single-chip host and device controller
HcRhStatus or the content of any of
HcRhPortStatus[NumberofDownstreamPort] has changed.
HcFmNumber (bit 15) changes value, from logic 0 to 1 or from
logic 1 to 0.
system error not related to USB. The HC should not proceed with
any processing nor signaling before the system error has been
corrected. The HCD clears this bit after HC has been reset.
PHCI: Always set to logic 0.
deviceon the USB is assertingresume signaling. It is the transition
from no resume signaling to resume signaling causing this bit to be
set. This bit is not set when HCD sets the USBRESUME state.
and an SOF generated.
current frame overruns. A scheduling overrun will also cause the
SchedulingOverrunCount of HcCommandStatus to be
incremented.
Code (Hex): 03 — read
Code (Hex): 83 — write
13.1.5 HcInterruptEnable Register
Each enable bit in the HcInterruptEnable register corresponds to an associated
interrupt bit in the HcInterruptStatus register. The HcInterruptEnable register is used
to control which events generate a hardware interrupt. When these three conditions
occur:
A bit is set in the HcInterruptStatus register
•
The corresponding bit in the HcInterruptEnable register is set
•
The MasterInterruptEnable bit is set
•
then a hardware interrupt is requested on the host bus.
•
Writing a logic1 to a bit in this register sets the corresponding bit, whereas writing a
logic 0 to a bit in this register leaves the corresponding bit unchanged. On a read, the
current value of this register is returned.
Full-speed USB single-chip host and device controller
13.1.6 HcInterruptDisable Register
Each disable bit in the HcInterruptDisable register corresponds to an associated
interrupt bit in the HcInterruptStatus register. The HcInterruptDisable register is
coupled with the HcInterruptEnable register. Thus, writing a logic 1 to a bit in this
register clears the corresponding bit in the HcInterruptEnable register, whereas
writing a logic 0 to a bit in this register leaves the corresponding bit in the
HcInterruptEnable register unchanged. On a read, the current value of the
HcInterruptEnable register is returned.
Table 26: HcInterruptDisable Register: bit allocation
Full-speed USB single-chip host and device controller
Table 27: HcInterruptDisable Register: bit description
BitSymbolDescription
5FNO0 — ignore
1 — disable interrupt generation due to frame Number Overflow4UE0 — ignore
1 — disable interrupt generation due to Unrecoverable Error3RD0 — ignore
1 — disable interrupt generation due to Resume Detect2SF0 — ignore
1 — disable interrupt generation due to Start of frame
1-reserved
0SO0 — ignore
1 — disable interrupt generation due to Scheduling Overrun
Code (Hex): 05 — read
Code (Hex): 85 — write
13.2 HC frame counter registers
13.2.1 HcFmInterval Register
…continued
The HcFmInterval register contains a 14-bit value which indicates the bit time interval
in a frame (that is, between two consecutive SOFs), and a 15-bit value indicating the
full-speed maximum packet size that the HC may transmit or receive without causing
a scheduling overrun. The HCD may carry out minor adjustments on the
FrameIntervalby writing a new value overthe present one at each SOF. This provides
the programmability necessary for the HC to synchronize with an external clocking
resource and to adjust any unknown local clock offset.
31FRTFrameRemainingToggle: This bit is loaded from the
30 to 14-reserved
13 to 0FR[13:0]FrameRemaining: This counter is decremented at each bit time.
Code (Hex): 0E — read
13.2.3 HcFmNumber Register
The HcFmNumber register is a 16-bit counter. It provides a timing reference for
events happening in the HC and the HCD. The HCD may use the 16-bit value
specified in this register and generate a 32-bit frame number without requiring
frequent access to the register.
ISP1161
Full-speed USB single-chip host and device controller
FrameIntervalToggle field of HcFmInterval whenever
FrameRemainingreaches 0. This bit is used by the Host Controller
Driver (HCD) for synchronization between FrameInterval and
FrameRemaining.
When it reaches zero, it is reset by loading the FrameInterval value
specified in HcFmInterval at the next bit time boundary. When
entering the USBOPERATIONAL state, the HC reloads it with the
content of the FrameInterval part of the HcFmInterval register and
Full-speed USB single-chip host and device controller
Table 33: HcFmNumber Register: bit description
BitSymbolDescription
31 to 16−reserved
15 to 0FN[15:0]FrameNumber: This is incremented when HcFmRemaining is
reloaded. It will be rolled over to 0H after FFFFH. When the
USBOPERATIONAL state is entered, this will be incremented
automatically. HC will set the StartofFrame in HcInterruptStatus.
Code (Hex): 0F — read
13.2.4 HcLSThreshold Register
The HcLSThreshold register contains an 11-bit value used by the HC to determine
whether to commit to the transfer of a maximum of 8-byte LS packet before EOF.
Neither the HC nor the HCD is allowed to change this value.
All registers included in this partition are dedicated to the USB Root Hub, which is an
integral part of the HC although it is a functionally separate entity.The Host Controller
Driver (HCD) emulates USBD accesses to the Root Hub via a register interface. The
HCD maintains many USB-defined hub features that are not required to be supported
in hardware. For example, the Hub’s Device, Configuration, Interface, and Endpoint
Descriptors are maintained only in the HCD as well as some static fields of the Class
Descriptor. The HCD also maintains and decodes the Root Hub’s device address as
well as other trivial operations that they are better suited to software than to
hardware.
The Root Hub registers are developed to maintain the similarity of bit organization
and operation to typical hubs found in the system.
Four registers are defined as follows:
ISP1161
Full-speed USB single-chip host and device controller
HcRhDescriptorA
•
HcRhDescriptorB
•
HcRhStatus
•
HcRhPortStatus[1:NDP]
•
Each register is read and written as a Dword. These registers are only written during
initialization to correspond with the system implementation. The HcRhDescriptorA
and HcRhDescriptorB registers should be implemented such that they are writeable
regardless of the HCs USB states. HcRhStatus and HcRhPortStatus must be
writeable during the USBOPERATIONAL state.
13.3.1 HcRhDescriptorA Register
The HcRhDescriptorA register is the first register of two describing the characteristics
of the Root Hub. Reset values are implementation-specific (IS). The descriptor length
(11), descriptor type and hub controller current (0) fields of the hub Class Descriptor
are emulated by the HCD. All other fields are located in the registers
HcRhDescriptorA and HcRhDescriptorB.
Remark: IS denotes an implementation-specific reset value for that field.
Full-speed USB single-chip host and device controller
13.3.2 HcRhDescriptorB Register
The HcRhDescriptorB register is the second register of two describing the
characteristics of the Root Hub. These fields are written during initialization to
correspond with the system implementation. Reset values are
implementation-specific (IS).
Table 38: HcRhDescriptorB Register: bit allocation
Full-speed USB single-chip host and device controller
Code (Hex): 13 — read
Code (Hex): 93 — write
13.3.3 HcRhStatus Register
The HcRhStatus register is divided into two parts. The lower word of a Dword
represents the Hub Status field and the upper word represents the Hub Status
Change field. Reserved bits should always be written as logic 0.
Full-speed USB single-chip host and device controller
13.3.4 HcRhPortStatus[1:2]
The HcRhPortStatus[1:2] register is used to control and report port events on a
per-port basis. NumberDownstreamPorts represents the number of HcRhPortStatus
registers that are implemented in hardware. The lower word is used to reflect the port
status, whereas the upper word reflects the status change bits. Some status bits are
implemented with special write behavior. If a transaction (token through handshake)
is in progress when a write to change port status occurs, the resulting port status
change must be postponed until the transaction completes. Reserved bits should
always be written logic 0.
Table 42: HcRhPortStatus[1:2] Register: bit allocation
1. Bit 0, InterruptPinEnable, is used as pin INT1’s master interrupt enable. This bit
should be used together with the register HcµPInterruptEnable to enable pin
INT1.
2. Bits 4:3 are fixed at the value 01B for ISP1161.
13.4.2 HcDMAConfiguration Register
Table 46: HcDMAConfiguration Register: bit allocation
Full-speed USB single-chip host and device controller
13.4.3 HcTransferCounter Register
This register holds the number of bytes of a PIO or DMA transfer. For a PIO transfer,
the number of bytes being read or written to the (Isochronous Transfer List) ITL or
(Acknowledged Transfer List) ATL buffer RAM must be written into this register. For a
DMA transfer, the number of bytes must be written into this register as well. However,
for this counter to be read into the DMA counter, the HCD must set bit 2 of the
HcDMAConfiguration register. The counter value for ATL must not be greater than
1000H, and for ITL it must not be greater than 800H. When the byte count of the data
transfer reaches this value, the HC will generate an internal EOT signal to set bit 2
AllEOInterrupt, of the HcµPInterrupt register, and also update the HcBufferStatus
register.
Table 48: HcTransferCounter Register: bit allocation
Bit15141312111098
SymbolCounter value
Reset00000000
AccessR/W
Bit76543210
SymbolCounter value
Reset00000000
AccessR/W
Table 49: HcTransferCounter Register: bit description
BitSymbolDescription
15 to 0Counter
value
Code (Hex): 22 — read
Code (Hex): A2 — write
13.4.4 HcµPInterrupt Register
All the bits in this register will be active on power-on reset. However, none of the
active bits will cause an interrupt on the interrupt pin (INT1) unless they are set by the
respective bits in the HcµPInterruptEnable register, and together with bit 0 of the
HcHardwareConfiguration register.
After this register (24H Read) is read, the bits that are active will not be reset, until
logic 1 is written to the bits in this register (A4H - Write) to clear it.
The bits in this register are cleared only when you write to this register indicating the
bits to be cleared. To clear all the enabled bits in this register, the HCD must write
FFH to this register.
The number of data bytes to be read to or written from RAM
4OPR_Regread HcControl and HcInterruptregisters to detect type of interrupt
3-reserved
2AllEOTInter
rupt
1ATLInt0 — no event
0SOFITLInt0 — no event
OPR_RegreservedAllEOT
Interrupt
1 — clock is ready. (After a wakeup is sent, there is a wait for clock
ready. Maximum is 1 ms, and typical is 160 µs)
0 — no event
1 — the HC has been suspended and no USB activity is sent from
the microprocessor for each ms. When the microprocessor wants
to suspend the HC, the microprocessor must write to the
HcControl register. And when all downstream devices are
suspended, then the HC stops sending SOF; the HC is suspended
by having the HcControl register written into.
on the HC (if the HC requires the Operational register to be
updated)
0 — no event
1 — implies that data transfer has been finished via PIO transfer or
DMA transfer. Occurrence of internal or external EOT will set this
bit.
1 — implies that the microprocessor must read ATL data from the
HC. This requires that the HcBufferStatus register must first be
read. The time for this interrupt depends on the number of clocks
bit set for USB activities in each ms.
1 — implies that SOF indicates the 1 ms mark. The ITL buffer that
the HC has handled must be read. To know the ITL buffer status,
the HcBufferStatus Register must first be read. This is for
microprocessor to get ISO data to or from the HC. For more
information, see Section 9.5 on page 33 6th paragraph.
Full-speed USB single-chip host and device controller
13.4.5 HcuPInterruptEnable Register
The bits 6:0 in this register are the same as those in the HcµPInterrupt register. They
are used together with bit 0 of the HcHardwareConfiguration register to enable or
disable the bits in the HcµPInterrupt register.
On power-on, all bits in this register are masked with 0. This means no interrupt
request output on the interrupt pin INT1 can be generated.
When the bit is set to 1, the interrupt for the bit is not masked but enabled.
Table 52: HcµPInterruptEnable Register: bit allocation
Table 53: HcµPInterruptEnable Register: bit description
BitSymbolDescription
15 to 8-reserved
7-reserved
6ClkReady0 — power-up value
1 — enables Clkready interrupt
5HC
Suspended
Enable
4OPR
Interrupt
Enable
3-reserved
2EOT
Interrupt
Enable
1ATL
Interrupt
Enable
0SOF
Interrupt
Enable
0 — power-up value
1 — enables HC suspended interrupt. When the microprocessor
wants to suspend the HC, the microprocessor must write to the
HcControl register. And when all downstream devices are
suspended, then the HC stops sending SOF; the HC is suspended
by having the HcControl register written into.
0 — power-up value
1 — enables the 32-bit Operational register’s interrupt (if the HC
requires the Operational register to be updated)
0 — power-up value
1 — enables the EOT interrupt which indicates an end of a
Read/Write transfer
0 — power-up value
1 — enables ATL interrupt. The time for this interrupt depends on
the number of clock bits set for USB activities in each ms.
0 — power-up value
1 — enables the interrupt bit due to SOF (for the microprocessor
DMA to get ISO data from the HC by first accessing the
HcDMAConfiguration register)
Full-speed USB single-chip host and device controller
Code (Hex): 25 — read
Code (Hex): A5 — write
13.5 HC miscellaneous registers
13.5.1 HcChipID Register
Read this register to get the ID of the ISP1161 silicon chip. The high byte stands for
the product name (here 61H stands for ISP1161). The low byte indicates the revision
number of the product including engineering samples (here 10H means revision 1,
that is ES1 of ISP1161).
Full-speed USB single-chip host and device controller
Code (Hex): A8 — write
13.5.3 HcSoftwareReset Register
This is a soft reset command. The microprocessor writes A9H to ISP1161’s
command port, resetting all the HC’s internal registers except for the internal FIFO
buffer RAM.
Table 58: HcSoftwareReset Register: bit allocation
Table 59: HcSoftwareReset Register: bit description
BitSymbolDescription
15 to 0Reset[15:0] Soft reset command
Code (Hex): A9 — write
13.6 HC buffer RAM control registers
13.6.1 HcITLBufferLength Register
Write to this register to assign the ITL buffer size in bytes for both ITL0 and ITL1
simultaneously. Thus, the ITL0 and ITL1 always have the same size.
Table 63: HcATLBufferLength Register: bit description
BitSymbolDescription
15 to 0ATLBufferLength
[15:0]
Assign ATL buffer length
Code (Hex): 2B — read
Code (Hex): AB — write
Remark: The maximum total RAM size is 1000H (4096 in decimal) bytes. That
means ITL0 (length) + ITL1 (length) + ATL (length) ≤ 1000H bytes. For example: If
ATL buffer length has been set to be 800H, then the maximum ITL buffer length can
only be set as 400H.
Table 65: HcBufferStatus Register: bit description
BitSymbolDescription
15 to 8-reserved
7 to 6-reserved
5ATLBuffer
4ITL1Buffer
3ITL0Buffer
2ATLBuffer
1ITL1Buffer
0ITL0Buffer
Done
Done
Done
Full
Full
Full
ISP1161
Full-speed USB single-chip host and device controller
0 — ATL Buffer not read by HC yet
1 — ATL Buffer read by HC
0 — ITL1 Buffer not read by HC yet
1 — ITL1 Buffer read by HC
0 — 1TL0 Buffer not read by HC yet
1 — 1TL0 Buffer read by HC
0 — ATL Buffer is empty
1 — ATL Buffer is full
0 — 1TL1 Buffer is empty
1 — 1TL1 Buffer is full
0 — ITL0 Buffer is empty
1 — ITL0 Buffer is full
Code (Hex): 2C — read
13.6.4 HcReadBackITL0Length Register
This register’s value stands for the current number of data bytes inside an ITL0 buffer
to be read back by the microprocessor. The HCD must set the HcTransferCounter
equivalent to this value before reading back the ITL0 buffer RAM.
Table 66: HcReadBackITL0Length Register: bit allocation
Table 67: HcReadBackITL0Length Register: bit description
BitSymbolDescription
15 to 0RdITL0BufferLength
[15:0]
The number of bytes for ITL0 data to be read back by the
microprocessor
Code (Hex): 2D — read
13.6.5 HcReadBackITL1Length Register
This register’s value stands for the current number of data bytes inside the ITL1 buffer
to be read back by the microprocessor. The HCD must set the HcTransferCounter
equivalent to this value before reading back the ITL1 buffer RAM.
Table 69: HcReadBackITL1Length Register: bit description
BitSymbolDescription
15 to 0RdITL1BufferLength
[15:0]
The number of bytes for ITL1 data to be read back by the
microprocessor
Code (Hex): 2E — read
13.6.6 HcITLBufferPort Register
This is the ITL buffer RAM read/write port. The bits 15:8 contain the data byte that
comes from the ITL buffer RAM’s even address. The bits 7:0 contain the data byte
that comes from the ITL buffer RAM’s odd address.
Table 70: HcITLBufferPort Register: bit allocation
Table 71: HcITLBufferPort Register: bit description
BitSymbolDescription
15 to 0DataWord[15:0]Read/Write ITL buffer RAM’s two data bytes.
Code (Hex): 40 — read
Code (Hex): C0 — write
The HCD must set the byte count into the HcTransferCounter register and check the
HcBufferStatus register before reading from or writing to the buffer. The HCD must
write the command (40H for read, C0H for write) once only, and then read or write all
the data bytes in word. After every read/write, the pointer of ITL buffer RAM will be
automatically increased by two to point to the next data word until it reaches the value
of HcTransferCounter register; otherwise, an internal EOT signal is not generated to
set the bit 2 AllEOTInterrupt, of the HcµPInterrupt register and update the
HcBufferStatus register.
Full-speed USB single-chip host and device controller
The HCD must take care of the difference that the internal buffer RAM is organized in
bytes.The HCD must write the byte count into the HcTransferCounter register, but the
HCD reads or writes the buffer RAM by 16 bits (by 1 word).
13.6.7 HcATLBufferPort Register
This is the ATL buffer RAM read/write port. The bits 15:8 contain the data byte that
comes from the Acknowledged Transfer List (ATL) buffer RAM’s even address. The
bits 7:0 contain the data byte that comes from the ATL buffer RAM’s odd address.
Table 72: HcATLBufferPort Register: bit allocation
Table 73: HcATLBufferPort Register: bit description
BitSymbolDescription
15 to 0DataWord[15:0]Read/Write ATL buffer RAM’s two data bytes.
Code (Hex): 41 — read
Code (Hex): C1 — write
The HCD must set the byte count into the HcTransferCounter register and check the
HcBufferStatus register before reading from or writing to the buffer. The HCD must
write the command (41H for read, C1H for write) once only, and then read or write all
the data bytes in word. After every read/write, the pointer of ATL buffer RAM will be
automatically increased by two to point to the next data word until it reaches the value
of HcTransferCounter register; otherwise, an internal EOT signal is not generated to
set the bit 2 AllEOTInterrupt, of the HcµPInterrupt register and update the
HcBufferStatus register.
The HCD must take care of the difference: the internal buffer RAM is organized in
bytes, so the HCD must write the byte count into the HcTransferCounter register, but
the HCD reads or writes the buffer RAM by 16 bits (by 1 word).
14. DC commands and registers
The functions and registers of ISP1161 are accessed via commands, which consist
of a command code followed by optional data bytes (read or write action). An
overview of the available commands and registers is given in Table 74.
Full-speed USB single-chip host and device controller
1. Command phase: when address bit A0 = 1, the DC interprets the data on the
lower byte of the bus (bits D7 to D0) as a command code. Commands without a
data phase are executed immediately.
2. Data phase (optional): when address bit A0 = 0, the DC transfers the data on
the bus to or from a register or endpoint FIFO. Multi-byte registers are accessed
least significant byte/word first.
As the ISP1161 DC’s data bus is 16 bits wide:
The upper byte (bits D15 to D8) in command phase or the undefined byte in data
•
phase is ignored.
The access of registers is word-aligned: byte access is not allowed.
•
If the packet length is odd, the upper byte of the last word in an IN endpoint buffer
•
is not transmitted to the host. When reading from an OUT endpoint buffer, the
upper byte of the last word must be ignored by the firmware. The packet length is
stored in the first 2 bytes of the endpoint buffer.
Table 74: Command and register summary
NameDestinationCode (Hex)Transaction
Initialization commands
Write Control OUT ConfigurationEndpoint Configuration Register
endpoint 0 OUT
Write Control IN ConfigurationEndpoint Configuration Register
endpoint 0 IN
Write Endpoint n Configuration
(n = 1 to 14)
Read Control OUT ConfigurationEndpoint Configuration Register
Read Control IN ConfigurationEndpoint Configuration Register
Read Endpoint n Configuration
(n = 1 to 14)
Write/Read Device AddressAddress RegisterB6/B7write/read 1 word
Write/Read Mode RegisterMode RegisterB8/B9write/read 1 word
Write/Read Hardware Configuration Hardware Configuration RegisterBA/BBwrite/read 1 word
Write/Read Interrupt Enable
Register
Write/Read DMA ConfigurationDMA Configuration RegisterF0/F1write/read 1 word
Write/Read DMA CounterDMA Counter RegisterF2/F3write/read 1 word
Reset Deviceresets all registersF6-
Data flow commands
Write Control OUT Bufferillegal: endpoint is read-only(00)Write Control IN BufferFIFO endpoint 0 IN01N ≤ 64 bytes
Write Endpoint n Buffer
(n = 1 to 14)
Read Control OUT BufferFIFO endpoint 0 OUT10N ≤ 64 bytes
Read Control IN Bufferillegal: endpoint is write-only(11)-
Full-speed USB single-chip host and device controller
Table 74: Command and register summary
NameDestinationCode (Hex)Transaction
Read Endpoint n Buffer
(n = 1 to 14)
FIFO endpoint 1 to 14
(OUT endpoints only)
…continued
[1]
12 to 1Fisochronous:
N ≤ 1023 bytes
interrupt/bulk: N ≤ 64 bytes
Stall Control OUT EndpointEndpoint 0 OUT40Stall Control IN EndpointEndpoint 0 IN41Stall Endpoint n
Endpoint 1 to 1442 to 4F-
(n = 1 to 14)
Read Control OUT StatusEndpoint Status Register
50read 1 word
endpoint 0 OUT
Read Control IN StatusEndpoint Status Register
51read 1 word
endpoint 0 IN
Read Endpoint n Status
(n = 1 to 14)
Validate Control OUT Bufferillegal: IN endpoints only
Validate Control IN BufferFIFO endpoint 0 IN
Validate Endpoint n Buffer
(n = 1 to 14)
Endpoint Status Register n
endpoint 1 to 14
[2]
[2]
FIFO endpoint 1 to 14
(IN endpoints only)
[2]
52 to 5Fread 1 word
(60)61none
62 to 6Fnone
Clear Control OUT BufferFIFO endpoint 0 OUT70none
Clear Control IN Bufferillegal
Clear Endpoint n Buffer
(n = 1 to 14)
[3]
FIFO endpoint 1 to 14
(OUT endpoints only)
(71)72 to 7Fnone
[3]
Unstall Control OUT EndpointEndpoint 0 OUT80Unstall Control IN EndpointEndpoint 0 IN81Unstall Endpoint n
Endpoint 1 to 1482 to 8F-
(n = 1 to 14)
Check Control OUT Status
[4]
Endpoint Status Image Register
D0read 1 word
endpoint 0 OUT
Check Control IN Status
[4]
Endpoint Status Image Register
D1read 1 word
endpoint 0 IN
Check Endpoint n Status
(n = 1 to 14)
[4]
Endpoint Status Image Register n
endpoint 1 to 14
D2 to DFread 1 word
Acknowledge SetupEndpoint 0 IN and OUTF4none
General commands
Read Control OUT Error CodeError Code Register
A0read 1 word
[5]
endpoint 0 OUT
Read Control IN Error CodeError Code Register
A1read 1 word
[5]
endpoint 0 IN
Read Endpoint n Error Code
(n = 1 to 14)
Error Code Register
endpoint 1 to 14
A2 to AFread 1 word
[5]
Unlock Deviceall registers with write accessB0write 1 word
Write/Read Scratch RegisterScratch RegisterB2/B3write/read 1 word
Read frame NumberFrame Number RegisterB4read 1 word
Full-speed USB single-chip host and device controller
Table 74: Command and register summary
NameDestinationCode (Hex)Transaction
Read Chip IDChip ID RegisterB5read 1 word
Read Interrupt RegisterInterrupt RegisterC0read 2 words
[1] With N representing the number of bytes, the number of words for 16-bit bus width is: (N + 1) DIV 2.
[2] Validating an OUT endpoint buffer causes unpredictable behavior of ISP1161’s DC.
[3] Clearing an IN endpoint buffer causes unpredictable behavior of ISP1161’s DC.
[4] Reads a copy of the Status Register: executing this command does not clear any status bits or interrupt bits.
[5] When accessing an 8-bit register in 16-bit mode, the upper byte is invalid.
[6] During isochronous transfer in 16-bit mode, because N ≤ 1023, the firmware must take care of the upper byte.
…continued
14.1 Initialization commands
Initialization commands are used during the enumeration process of the USB
network. These commands are used to configure and enable the embedded
endpoints. They also serve to set the USB assigned address of ISP1161’s DC and to
perform a device reset.
14.1.1 Write/Read Endpoint Configuration
This command is used to access the Endpoint Configuration Register (ECR) of the
target endpoint. It defines the endpoint type (isochronous or bulk/interrupt), direction
(OUT/IN), FIFO size and buffering scheme. It also enables the endpoint FIFO. The
register bit allocation is shown in Table 75. A bus reset will disable all endpoints.
[1]
The allocation of FIFO memory only takes place after all 16 endpoints have been
configured in sequence (from endpoint 0 OUT to endpoint 14). Although the control
endpoints have fixed configurations, they must be included in the initialization
sequence and be configured with their default values (see Table 7). Automatic FIFO
allocation starts when endpoint 14 has been configured.
Remark: If any change is made to an endpoint configuration which affects the
allocated memory (size, enable/disable), the FIFO memory contents of all endpoints
becomes invalid. Therefore, all valid data must be removed from enabled endpoints
before changing the configuration.
Code (Hex): 20 to 2F — write (control OUT, control IN, endpoint 1 to 14)
Code (Hex): 30 to 3F — read (control OUT, control IN, endpoint 1 to 14)
Transaction — write/read 1 word
Table 75: Endpoint Configuration Register: bit allocation
Table 76: Endpoint Configuration Register: bit description
BitSymbolDescription
7FIFOENA logic 1 indicates an enabled FIFO with allocated memory.
6EPDIRThis bit defines the endpoint direction (0 = OUT, 1 = IN); it also
5DBLBUFA logic 1 indicates that this endpoint has double buffering.
4FFOISOA logic 1 indicates an isochronous endpoint. A logic 0 indicates
3 to 0FFOSZ[3:0]Selects the FIFO size according to Table 8
14.1.2 Write/Read Device Address
This command is used to set the USB assigned address in the Address Register and
enable the USB device. The Address Register bit allocation is shown in Table 77.
A USB bus reset sets the device address to 00H (internally) and enables the device.
The value of the Address Register (accessible by the microcontroller) is not altered by
the bus reset. In response to the standard USB request Set Address the firmware
must issue a Write Device Address command, followed by sending an empty packet
to the host. The new device address is activated when the host acknowledges the
empty packet.
ISP1161
Full-speed USB single-chip host and device controller
A logic 0 indicates a disabled FIFO (no bytes allocated).
determines the DMA transfer direction (0 = read, 1 = write)
7DEVENA logic 1 enables the device.
6 to 0DEVADR[6:0] This field specifies the USB device address.
14.1.3 Write/Read Mode Register
This command is used to access the ISP1161’s DC Mode Register, which consists of
1 byte (bit allocation: see Table 78). In 16-bit bus mode the upper byte is ignored.
The Mode Register controls the DMA bus width, resume and suspend modes,
interrupt activity and SoftConnect operation. It can be used to enable debug mode,
where all errors and Not Acknowledge (NAK) conditions will generate an interrupt.
0 and 2). A logic 0 selects 8-bit DMA bus width. Bus reset value:
unchanged.
6-reserved
5GOSUSPWriting a logic 1 followed by a logic 0 will activate ‘suspend’
mode.
4-reserved
3INTENAA logic 1 enables all interrupts. Bus reset value: unchanged.
2DBGMODA logic 1 enables debug mode. where all NAKs and errors will
generate an interrupt. A logic 0 selects normal operation, where
interrupts are generated on every ACK (bulk endpoints) or after
every data transfer (isochronous endpoints). Bus reset value:
unchanged.
1-reserved
0SOFTCTA logic 1 enables SoftConnect (see Section 7.5). This bit is
ignored if EXTPUL = 1 in the Hardware Configuration Register
(see Table 81). Bus reset value: unchanged.
[1]
[1]
0
[1]
0
[1]
0
14.1.4 Write/Read Hardware Configuration
This command is used to access the Hardware Configuration Register, which
consists of 2 bytes. The first (lower) byte contains the device configuration and
control values, the second (upper) byte holds the clock control bits and the clock
division factor. The bit allocation is given in Table 81. A bus reset will not change any
of the programmed bit values.
The Hardware Configuration Register controls the connection to the USB bus, clock
activity and power supply during ‘suspend’ state, output clock frequency, DMA
operating mode and pin configurations (polarity, signalling mode).
Full-speed USB single-chip host and device controller
14.1.5 Write/Read Interrupt Enable Register
This command is used to individually enable/disable interrupts from all endpoints, as
well as interrupts caused by events on the USB bus (SOF, SOF lost, EOT, suspend,
resume, reset). A bus reset will not change any of the programmed bit values.
The command accesses the Interrupt Enable Register, which consists of 4 bytes.The
bit allocation is given in Table 83.
Table 84: Interrupt Enable Register: bit description
BitSymbolDescription
31 to 24-reserved; must write logic 0
23 to 10IEP14 to IEP1 A logic 1 enables interrupts from the indicated endpoint.
9IEP0INA logic 1 enables interrupts from the control IN endpoint.
8IEP0OUTA logic 1 enables interrupts from the control OUT endpoint.
7, 6-reserved
5IEPSOFA logic 1 enables 1 ms interrupts upon detection of Pseudo
SOF.
4IESOFA logic 1 enables interrupt upon SOF detection.
3IEEOTA logic 1 enables interrupt upon EOT detection.
2IESUSPA logic 1 enables interrupt upon detection of ‘suspend’ state.
1IERESMA logic 1 enables interrupt upon detection of a ‘resume’ state.
0IERSTA logic 1 enables interrupt upon detection of a bus reset.
Full-speed USB single-chip host and device controller
14.1.6 Write/Read DMA Configuration
This command defines the DMA configuration of ISP1161’sDC and enables/disables
DMA transfers. The command accesses the DMA Configuration Register, which
consists of 2 bytes. The bit allocation is given in Table 85. A bus reset will clear bit
DMAEN (DMA disabled), all other bits remain unchanged.
Table 86: DMA Configuration Register: bit description
BitSymbolDescription
15CNTRENA logic 1 enables the generation of an EOT condition, when the
DMA Counter Register reaches zero. Bus reset value:
unchanged.
14SHORTPA logic 1 enables short/empty packet mode. When receiving
(OUT endpoint) a short/empty packet an EOT condition is
generated. When transmitting (IN endpoint) this bit should be
cleared. Bus reset value: unchanged.
13 to 8-reserved
7 to 4EPDIX[3:0]Indicates the destination endpoint for DMA, seeTable 10.
3DMAENWriting a logic 1 enables DMA transfer, a logic 0 forces the end
of an ongoing DMA transfer and generates an EOT interrupt.
Reading this bit indicates whether DMA is enabled (0 = DMA
stopped, 1 = DMA enabled). This bit is cleared by a bus reset.
2-reserved
1 to 0BURSTL[1:0]Selects the DMA burst length:
00 — single-cycle mode (1 byte)
01 — burst mode (4 bytes)
10 — burst mode (8 bytes)
11 — burst mode (16 bytes).
Bus reset value: unchanged.
For selecting an endpoint for device DMA transfer, see Section 11.2.
Full-speed USB single-chip host and device controller
14.1.7 Write/Read DMA Counter
This command accesses the DMA Counter Register. The bit allocation is given in
Table 87. Writing to the register sets the number of bytes for a DMA transfer. Reading
the register returns the number of remaining bytes in the current transfer. A bus reset
will not change the programmed bit values.
The internal DMA counter is automatically reloaded from the DMA Counter Register
when DMA is re-enabled (DMAEN = 1). See Section 14.1.6 for more details.
This command resets the ISP1161 DC in the same way as an external hardware
reset via input RESET. All registers are initialized to their ‘reset’ values.
Code (Hex): F6 — reset the device
Transaction — none
14.2 Data flow commands
Data flow commands are used to manage the data transmission between the USB
endpoints and the system microprocessor. Much of the data flow is initiated via an
interrupt to the microprocessor. The data flow commands are used to access the
endpoints and determine whether the endpoint FIFOs contain valid data.
Remark: The IN bufferof an endpoint contains input data for the host, the OUT buffer
receives output data from the host.
This command is used to access endpoint FIFO buffers for reading or writing. First,
the buffer pointer is reset to the beginning of the buffer. Following the command, a
maximum of (M + 1) words can be written or read, with M given by (N + 1) DIV 2, N
representing the size of the endpoint buffer. After each read/write action the buffer
pointer is automatically incremented by 2.
In DMA access the first word (the packet length) is skipped: transfers start at the
second word of the endpoint buffer. When reading, the ISP1161 DC can detect the
last word via the End of Packet (EOP) condition. When writing to a bulk/interrupt
endpoint, the endpoint buffer must be completely filled before sending the data to the
host. Exception: when a DMA transfer is stopped by an external EOT condition, the
current buffer content (full or not) is sent to the host.
Remark: Reading data after a Write Endpoint Buffer command or writing data after a
Read Endpoint Buffer command will cause unpredictable behavior of the ISP1161
DC.
Code (Hex): 01 to 0F — write (control IN, endpoint 1 to 14)
ISP1161
Full-speed USB single-chip host and device controller
Code (Hex): 10, 12 to 1F — read (control OUT, endpoint 1 to 14)
Transaction — write/read maximum (M + 1) words (isochronous endpoint: N ≤ 1023,
bulk/interrupt endpoint: N ≤ 32)
The data in the endpoint FIFO must be organized as shown in Table 89. An example
D[15:8]-ignored
0dataD[15:0]0packet length
0dataD[15:0]1data word 1 (data byte 2, data byte 1)
0dataD[15:0]2data word 2 (data byte 4, data byte 3)
……………
Remark: There is no protection against writing or reading past a buffer’sboundary or
against writing into an OUT buffer or reading from an IN buffer. Any of these actions
could cause an incorrect operation. Data residing in an OUT buffer are only
Full-speed USB single-chip host and device controller
meaningful after a successful transaction. Exception: during DMA access of a
double-buffered endpoint, the buffer pointer automatically points to the secondary
buffer after reaching the end of the primary buffer.
14.2.2 Read Endpoint Status
This command is used to read the status of an endpoint FIFO. The command
accesses the Endpoint Status Register, the bit allocation of which is shown in
Table 91. Reading the Endpoint Status Register will clear the interrupt bit set for the
corresponding endpoint in the Interrupt Register (see Table 106).
All bits of the Endpoint Status Register are read-only. Bit EPSTAL is controlled by the
Stall/Unstall commands and by the reception of a SETUP token (see Section 14.2.3).
Code (Hex): 50 to 5F — read (control OUT, control IN, endpoint 1 to 14)
Transaction — read 1 word
Table 91: Endpoint Status Register: bit allocation
Table 92: Endpoint Status Register: bit description
BitSymbolDescription
7EPSTALThis bit indicates whether the endpoint is stalled or not
(1 = stalled, 0 = not stalled).
Set to logic 1 by a Stall Endpoint command, cleared to logic 0 by
an Unstall Endpoint command. The endpoint is automatically
unstalled upon reception of a SETUP token.
6EPFULL1A logic 1 indicates that the secondary endpoint buffer is full.
5EPFULL0A logic 1 indicates that the primary endpoint buffer is full.
4DATA_PIDThis bit indicates the data PID of the present packet (0 = DATA
PID, 1= DATA1 PID).
3OVERWRITEThis bit is set by hardware, a logic 1 indicating that a new Setup
packet has overwritten the previous setup information, before it
was acknowledged or before the endpoint was stalled. This bit is
cleared by reading, if writing the setup data has finished.
Firmware must check this bit before sending an Acknowledge
Setup command or stalling the endpoint. Upon reading a logic 1
the firmware must stop ongoing setup actions and wait for a new
Setup packet.
2SETUPTA logic 1 indicates that the buffer contains a Setup packet.
1CPUBUFThis bit indicates which buffer is currently selected for CPU
These commands are used to stall or unstall an endpoint. The commands modify the
content of the Endpoint Status Register (see Table 91).
A stalled control endpoint is automatically unstalled when it receives a SETUP token,
regardless of the packet content. If the endpoint should stay in its stalled state, the
microprocessor can re-stall it with the Stall Endpoint command.
When a stalled endpoint is unstalled (either by the Unstall Endpoint command or by
receiving a SETUP token), it is also re-initialized. This flushes the buffer: in and if it is
an OUT buffer it waits for a DATA 0 PID, if it is an IN buffer it writes a DATA 0 PID.
Code (Hex): 40 to 4F — stall (control OUT, control IN, endpoint 1 to 14)
Code (Hex): 80 to 8F — unstall (control OUT, control IN, endpoint 1 to 14)
Transaction — none
14.2.4 Validate Endpoint Buffer
This command signals the presence of valid data for transmission to the USB host, by
setting the Buffer Full flag of the selected IN endpoint. This indicates that the data in
the bufferis valid and can be sent to the host, when the next IN token is received. For
a double-buffered endpoint this command switches the current FIFO for CPU access.
ISP1161
Full-speed USB single-chip host and device controller
Remark: For special aspects of the control IN endpoint see Section 11.3.6.
Code (Hex): 61 to 6F — validate endpoint buffer (control IN, endpoint 1 to 14)
Transaction — none
14.2.5 Clear Endpoint Buffer
This command unlocks and clears the buffer of the selected OUT endpoint, allowing
the reception of new packets. Reception of a complete packet causes the Buffer Full
flag of an OUT endpoint to be set. Any subsequent packets are refused by returninga
NAK condition, until the buffer is unlocked using this command. For a double-buffered
endpoint this command switches the current FIFO for CPU access.
Remark: For special aspects of the control OUT endpoint see Section 11.3.6.
Code (Hex): 70, 72 to 7F — clear endpoint buffer (control OUT, endpoint 1 to 14)
Transaction — none
14.2.6 Check Endpoint Status
This command is used to check the status of the selected endpoint FIFO without
clearing any status or interrupt bits. The command accesses the Endpoint Status
Image Register, which contains a copy of the Endpoint Status Register. The bit
allocation of the Endpoint Status Image Register is shown in Table 93.
Code (Hex): D0 to DF — check status (control OUT, control IN, endpoint 1 to 14)
Transaction — write/read 1 word
Table 94: Endpoint Status Image Register: bit description
BitSymbolDescription
7EPSTALThis bit indicates whether the endpoint is stalled or not
(1 = stalled, 0 = not stalled).
6EPFULL1A logic 1 indicates that the secondary endpoint buffer is full.
5EPFULL0A logic 1 indicates that the primary endpoint buffer is full.
4DATA_PIDThis bit indicates the data PID of the present packet (0 = DATA
PID, 1= DATA1 PID).
3OVERWRITEThis bit is set by hardware, a logic 1 indicating that a new Setup
packet has overwritten the previous setup information, before it
was acknowledged or before the endpoint was stalled. This bit is
cleared by reading, if writing the setup data has finished.
Firmware must check this bit before sending an Acknowledge
Setup command or stalling the endpoint. Upon reading a logic 1
the firmware must stop ongoing setup actions and wait for a new
Setup packet.
2SETUPTA logic 1 indicates that the buffer contains a Setup packet.
1CPUBUFThis bit indicates which buffer is currently selected for CPU
This command acknowledges to the host that a SETUP packet was received. The
arrival of a SETUP packet disables the Validate Buffer and Clear Buffer commands
for the control IN and OUT endpoints. The microprocessor needs to re-enable these
commands by sending an Acknowledge Setup command, see Section 11.3.6.
Remark: The Acknowledge Setup command must be sent to both control endpoints
(IN and OUT).
This command returns the status of the last transaction of the selected endpoint, as
stored in the Error Code Register. Each new transaction overwrites the previous
status information. The bit allocation of the Error Code Register is shown in Table 95.
Code (Hex): A0 to AF — read error code (control OUT, control IN, endpoint 1 to 14)
7UNREADA logic 1 indicates that a new event occurred before the
previous status was read.
6DATA01This bit indicates the PID type of the last successfully received
or transmitted packet (0 = DATA0 PID, 1 = DATA1 PID).
5-reserved
4 to 1ERROR[3:0]Error code. For error description, see Table 97.
0RTOKA logic 1 indicates that data was received or transmitted
successfully.
Table 97: Transaction error codes
Error code
(Binary)
0000no error
0001PID encoding error; bits 7 to 4 are not the inverse of bits 3 to 0
0010PID unknown; encoding is valid, but PID does not exist
0011unexpected packet; packet is not of the expected type (token, data, or
0100token CRC error
0101data CRC error
0110time-out error
0111babble error
1000unexpected end-of-packet
1001sent or received NAK (Not AcKnowledge)
1010sent Stall; a token was received, but the endpoint was stalled
1011overflow; the received packet was larger than the available buffer space
1100sent empty packet (ISO only)
1101bit stuffing error
1110sync error
1111wrong (unexpected) toggle bit in DATA PID; data was ignored
Description
acknowledge), or is a SETUP token to a non-control endpoint
14.3.2 Unlock Device
This command unlocks ISP1161’s DC from write-protection mode after a ‘resume’. In
‘suspend’ state all registers and FIFOs are write-protected to prevent data corruption
by external devices during a ‘resume’. Register access for reading is not blocked.