
C165UTAH
USB Interface Controller
Data Sheet
344
2001-02-23
page 99); the packetlength supported by the EPEC must always be an even number
of bytes (in receive-direction the EPEC only does word-transfers) and have at least
space for the maxpacketlength of the endpoint.
when host sends data, it is forwarded through the fifo’s and with every transferred
word that can be read from usbd_rxrr-registerX the usbd_rxrr-interruptX is set (for
normal functionality this can be ignored); EPEC transferes this data into the memory
EPEC generates an EPEC-interrupt when it has transferred all the data into the
memory (this interrupt is generated shortly after the USB-block has generated the
udc_rx_done-interrupt); SW must read the EPEC-interrupt-register and clear the (to
the endpoint) corresponding bit in this register by writing a ‘1’ into it
when USB-block has finished the whole transfer, it generates the udc_rx_done-
interrupt; SW must then read the usbd_rx_bytecnt-register, in order to determine the
number of bytes of the received packet and to release the interlocking of the fifo for
the next transfer; the most significant bit in this register contains also the status-bit of
the status-register and shows whether this packet had transmission-errors or not
if host has sent a packet of zero lenght, no rxrr-interrupt is generated but only a
rx_done-interrupt; here also SW must read the rxbytecountX-register
in order to prepare a receive on this endpoint again SW must provide a new free
memory-block, set up the source-, destination-pointer and packetlength of the EPEC
and write the start-bit
15.7.4
Reading out Setup-Packets
Setup-packets are treated without the EPEC. If host sends a setup-packet which is
forwarded to the CPU (there are only three commands: get_descriptor, set_descriptor
and synch_frame all the other ones are treated internally), and the packet is valid, the
udc_setup-interrupt is generated and SW must read all four setup-registers. By reading
the last one (setup 61, an overwrite-protection for those registers will be released and
the device will accept the next setup-packet. As long as this register is not read, each
setup-packet on the USB will be NAK’d.
15.7.5
Special case: Setup-Transfer
The endpoint zero has an additional feature in transmit-direction in order to handle an
early end of a setup-transaction. If, as an example, host requests for a device-desciptor
(by sending a get_descriptor(device_descriptor)) with a length of 12 bytes and the
maxpacketlength of endpoint zeo is eight, host must request for two control_in-packets
and then accnwowledge them with an status_out-packet. According to the USB-spec,
host can also request only one packet or even none before it sends out the status-
packet. This is called an early end of the setup-transaction.
If SW has already set up the data in the tx-fifo after the get_descriptor-command and
host will immediately after this request for different data with another setup-packet, the
old data, already in the fifo would be sent. By enabling the AutoFlushEnable-feature, with