![Atmel SAM4S Series Preliminary Data Sheet Download Page 988](http://html1.mh-extra.com/html/atmel/sam4s-series/sam4s-series_preliminary-data-sheet_3003408988.webp)
988
11100B–ATARM–31-Jul-12
SAM4S Series [Preliminary]
When using a ping-pong endpoint, the following procedures are required to perform Data IN
transactions:
1.
The microcontroller checks if it is possible to write in the FIFO by polling TXPKTRDY to
be cleared in the endpoint’s UDP_CSRx register.
2.
The microcontroller writes the first data payload to be sent in the FIFO (Bank 0), writing
zero or more byte values in the endpoint’s UDP_FDRx register.
3.
The microcontroller notifies the USB peripheral it has finished writing in Bank 0 of the
FIFO by setting the TXPKTRDY in the endpoint’s UDP_CSRx register.
4.
Without waiting for TXPKTRDY to be cleared, the microcontroller writes the second
data payload to be sent in the FIFO (Bank 1), writing zero or more byte values in the
endpoint’s UDP_FDRx register.
5.
The microcontroller is notified that the first Bank has been released by the USB device
when TXCOMP in the endpoint’s UDP_CSRx register is set. An interrupt is pending
while TXCOMP is being set.
6.
Once the microcontroller has received TXCOMP for the first Bank, it notifies the USB
device that it has prepared the second Bank to be sent, raising TXPKTRDY in the end-
point’s UDP_CSRx register.
7.
At this step, Bank 0 is available and the microcontroller can prepare a third data pay-
load to be sent
.
Figure 38-9. Data IN Transfer for Ping-pong Endpoint
Warning: There is software critical path due to the fact that once the second bank is filled, the
driver has to wait for TX_COMP to set TX_PKTRDY. If the delay between receiving TX_COMP
is set and TX_PKTRDY is set too long, some Data IN packets may be NACKed, reducing the
bandwidth.
Warning: TX_COMP must be cleared after TX_PKTRDY has been set.
Data IN
Data IN
Read by USB Device
Read by USB Device
Bank 1
Bank 0
FIFO (DPR)
TXCOMP Flag
(UDP_CSRx)
Interrupt Cleared by Firmware
Set by USB
Device
TXPKTRDY Flag
(UDP_MCSRx)
ACK
PID
Data IN
PID
ACK
PID
Set by Firmware,
Data Payload Written in FIFO Bank 1
Cleared by USB Device,
Data Payload Fully Transmitted
Data IN
PID
USB Bus
Packets
Set by USB Device
Set by Firmware,
Data Payload Written in FIFO Bank 0
Written by
FIFO (DPR)
Microcontroller
Written by
Microcontroller
Written by
Microcontroller
Microcontroller
Load Data IN Bank 0
Microcontroller Load Data IN Bank 1
USB Device Send Bank 0
Microcontroller Load Data IN Bank 0
USB Device Send Bank 1
Interrupt Pending
Summary of Contents for SAM4S Series
Page 44: ...44 11100B ATARM 31 Jul 12 SAM4S Series Preliminary ...
Page 412: ...412 11100B ATARM 31 Jul 12 SAM4S Series Preliminary ...
Page 1105: ...1105 11100B ATARM 31 Jul 12 SAM4S Series Preliminary ...
Page 1143: ...1143 11100B ATARM 31 Jul 12 SAM4S Series Preliminary Figure 43 4 64 lead LQFP Package Drawing ...
Page 1145: ...1145 11100B ATARM 31 Jul 12 SAM4S Series Preliminary Figure 43 5 64 lead QFN Package Drawing ...