Datasheet

SAM9G20
DS60001516A-page 668 2017 Microchip Technology Inc.
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.
Figure 36-12: Stall Handshake (Data IN Transfer)
Figure 36-13: Stall Handshake (Data OUT Transfer)
36.5.2.5 Transmit Data Cancellation
Some endpoints have dual-banks whereas some endpoints have only one bank. The procedure to cancel transmission data held in these
banks is described below.
To see the organization of dual-bank availability refer to Table 36-1 ”USB Endpoint Description”.
Endpoints Without Dual-Banks
There are two possibilities: In one case, TXPKTRDY field in UDP_CSR has already been set. In the other instance, TXPKTRDY is not set.
TXPKTRDY is not set:
- Reset the endpoint to clear the FIFO (pointers). (See Section 36.6.9 ”UDP Reset Endpoint Register.)
TXPKTRDY has already been set:
- Clear TXPKTRDY so that no packet is ready to be sent
- Reset the endpoint to clear the FIFO (pointers). (See Section 36.6.9 ”UDP Reset Endpoint Register.)
Endpoints With Dual-Banks
There are two possibilities: In one case, TXPKTRDY field in UDP_CSR has already been set. In the other instance, TXPKTRDY is not set.
TXPKTRDY is not set:
- Reset the endpoint to clear the FIFO (pointers). (See Section 36.6.9 ”UDP Reset Endpoint Register.)
Data IN Stall PIDPID
USB Bus
Packets
Cleared by Firmware
Set by Firmware
FORCESTALL
STALLSENT
Set by
USB Device
Cleared by Firmware
Interrupt Pending
Data OUT PID
Stall PID
Data OUT
USB Bus
Packets
Cleared by Firmware
Set by Firmware
FORCESTALL
STALLSENT
Set by USB Device
Interrupt Pending