User manual

...the world's most energy friendly microcontrollers
2012-04-24 - Giant Gecko Family - d0053_Rev0.96 319
www.energymicro.com
6. For Periodic IN endpoints, the data must always be prefetched 1 frame ahead for transmission in the
next frame. This can be done, by enabling the Periodic IN endpoint 1 frame ahead of the frame in
which the data transfer is scheduled.
7. The complete data to be transmitted in the frame must be written into the transmit FIFO, before the
Periodic IN token is received. Even when 1 DWORD of the data to be transmitted per frame is missing
in the transmit FIFO when the Periodic IN token is received, the core behaves as when the FIFO was
empty. When the transmit FIFO is empty,
A zero data length packet would be transmitted on the USB for ISOC IN endpoints
A NAK handshake would be transmitted on the USB for INTR IN endpoints
USB_DIEPx_TSIZ.PKTCNT is not decremented in this case.
8. For a High Bandwidth IN endpoint with three packets in a frame, the application can program the
endpoint FIFO size to be 2 * max_pkt_size and have the third packet load in after the first packet has
been transmitted on the USB.
Figure 15.30. Periodic IN Application Flow for Periodic Transfer Interrupt Feature
NOTE
Requirem e nt s For XferSize and Pkt Cnt program ming
1. Packet Size has t o be of M axPktSize for all ( micro) frames except for last
packet w hich can be a Short Packet.
2. Short Packet s are not allow ed in betwee n Xfers
5. Core w ill read pa cket s from System M emory only from DW ORD aligned
addre sses.
6. If M axPkt Size is not DWORD aligne d, Applica t ion must insert pa ds at the
end of t he packet so t hat ne w packet is always DW ORD aligned.
7. Thresholding in not supported for the Periodic Transfer Interrupt
enhance m ent
START
De- a lloc a te Data Ra m Me m or y
· Program EP Ctrl regist er to start t he xfer
USB_DIEPx_CTL.CNAK = 0b1
USB_DIEPx_CTL.TXFNUM = tx_fifo_num;
USB_DIEPx_CTL.EPENA = 0b1
USB_DIEPx_CTL.SNAK = 0b0
USB_DIEPx_CTL.EPDIS = 0b0
·Wait for USB_DOEPX_INTXFERCOMPL interrupt & report error if timeout expires
If USB_DIEPx_TSIZ
XFERSIZE != 0 or
USB_DIEPx_TSIZ
PKTCNT != 0
return
· Check for error_ scenario
· If no error_ scenario set report error
Yes
no
· Intialize variables
· Allocate a buffer in the Syst em Memory for multiple Xfe rs. Buffer size should be multiple ot MaxPktSize.
· Program the DMA address
DIEPDMA = START Address of the Dat a Memory
· Program Xfer_ size register
USB_DIEPx_TSIZ XFERSIZE = XferSize Spanning across multiple Xfe rs
USB_DIEPx_TSIZ PKTCNT = Program PktCnt for multiple Xfers
USB_DIEPx_TSIZ.MC = M ax Num be r of Packet s in a ( micro)fram e
· Program the Global INT STS
USB_GINTMSK. INCOMPLSOCINMSK = 0b0 // Ma sk IncompISOCIN Interrupt
Internal Data Flow
1. The application must set the Transfer Size and Packet Count fields in the endpoint-specific registers
and enable the endpoint to transmit the data.
The application must enable the USB_DCTL.IGNRFRMNUM
2. When an isochronous OUT endpoint is enabled by setting the Endpoint Enable and clearing the NAK
bits, the Even/Odd frame will be ignored by the core.
Subsequently the core updates the Even / Odd bit on its own