Instruction manual

Renesas USB MCU and USB ASSP USB Basic Host and Peripheral firmware
R01AN0512EJ0210 Rev.2.10 Page 56 of 157
Apr 1, 2013
2. USB communication data length (tranlen)
Reception or ControlRead transfer: Stores the receive data length.
Transmission or ControlWrite transfer: Stores the transmit data length.
NoDataControl transfer: Set to 0.
The remaining transmit/receive data length is stored after USB communication end. In case of control transfer in host
mode, the remaining data length from the data stage is stored.
3. Pipe control (pipectr)
PDCD can perform communication with multiple endpoint addresses over a single pipe by remembering the sequence
toggle bit information in this register. When specifying transfer continuation, set the SQMON bit in this register to the
previous toggle state.
4. Segment information (segment)
Control transfer continuation: Specify USB_TRAN_CONT (continuation of transfer from data stage enabled).
Control transfer end: Specify USB_TRAN_END.
Data transfer continuation: Specify USB_TRAN_CONT. (Set SQMON bit in PIPECTR.)
Data transfer end: Specify USB_TRAN_END.
4.5.4 Notes on data transfer
When the maximum packet size is an odd number and one packet is not equivalent to one transfer, the CPU may generate
an address exception during buffer access
4.5.5 Notes on data reception
Use a transaction counter for the receive pipe.
When a short packet is received, the expected remaining receive data length is stored in tranlen of USBC_UTR_t structure
and this transfer is ended. When the received data exceeds the buffer size, data read from the FIFO buffer up to the buffer
size and this transfer is ended. When the user buffer area is insufficient to accommodate the transfer size, the
usb_cstd_DataEnd() function may clear the receive packet in some cases. (It should be used with the SHTNAK function,
transaction counter function, single buffer setting, etc.
When using DTC, the buffer size must be an integral multiple of the maximum packet size.
4.5.6 Data transfer overview
The following shows an overview of data transfer with an example.
ANSI Interface
After open() processing is complete, control() is used to set the call-back function for the APL.
read()/write() is called and data transfer request executed.
After data transfer is complete, the call-back function that was set in (2) above is called and the transfer results are
thereby notified to the PDCD. Please refer to
4.5.2, Notification of transfer result.
Non-ANSI Interface
Transfer is done by APL or PDCD the USB_UTR_t structure members listed below.
keyword : Pipe number
tranadr : Pointer to a data buffer containing data to be transmitted.
tranlen : Transfer Size
segment : USB_TRAN_END
complete : Executed call-back function at the data transfer end.