English
Language : 

SAM7X256_14 Datasheet, PDF (440/662 Pages) ATMEL Corporation – ARM-based Flash MCU
Figure 34-11. Data OUT Transfer for Ping-pong Endpoint
Host Sends First Data Payload
Microcontroller Reads Data 1 in Bank 0,
Host Sends Second Data Payload
Microcontroller Reads Data2 in Bank 1,
Host Sends Third Data Payload
USB Bus
Packets
Data OUT
PID
Data OUT 1
ACK
PID
Data OUT
PID
Data OUT 2
ACK
PID
Data OUT
PID
Data OUT 3
A
P
RX_DATA_BK0 Flag
(UDP_CSRx)
RX_DATA_BK1 Flag
(UDP_CSRx)
Set by USB Device,
Data Payload Written
in FIFO Endpoint Bank 0
Interrupt Pending
Set by USB Device,
Data Payload Written
in FIFO Endpoint Bank 1
Cleared by Firmware
Cleared by Firmware
Interrupt Pending
FIFO (DPR)
Bank 0
Data OUT1
Write by USB Device
Data OUT 1
Read By Microcontroller
Data OUT 3
Write In Progress
FIFO (DPR)
Bank 1
Data OUT 2
Write by USB Device
Data OUT 2
Read By Microcontroller
Note:
An interrupt is pending while the RX_DATA_BK0 or RX_DATA_BK1 flag is set.
Warning: When RX_DATA_BK0 and RX_DATA_BK1 are both set, there is no way to determine which one to clear first.
Thus the software must keep an internal counter to be sure to clear alternatively RX_DATA_BK0 then RX_DATA_BK1.
This situation may occur when the software application is busy elsewhere and the two banks are filled by the USB host.
Once the application comes back to the USB driver, the two flags are set.
34.5.2.4 Stall Handshake
A stall handshake can be used in one of two distinct occasions. (For more information on the stall handshake, refer to
Chapter 8 of the Universal Serial Bus Specification, Rev 2.0.)
 A functional stall is used when the halt feature associated with the endpoint is set. (Refer to Chapter 9 of the
Universal Serial Bus Specification, Rev 2.0, for more information on the halt feature.)
 To abort the current request, a protocol stall is used, but uniquely with control transfer.
The following procedure generates a stall packet:
1. The microcontroller sets the FORCESTALL flag in the UDP_ CSRx endpoint’s register.
2. The host receives the stall packet.
3. The microcontroller is notified that the device has sent the stall by polling the STALLSENT to be set. An endpoint
interrupt is pending while STALLSENT is set. The microcontroller must clear STALLSENT to clear the interrupt.
When a setup transaction is received after a stall handshake, STALLSENT must be cleared in order to prevent interrupts
due to STALLSENT being set.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
440