AT32F425
Series Reference Manual
2022.03.30
Page 378
Ver 2.01
6. Wait for the endpoint disable interrupt in the OTGFS_DOEPINTx register, and enable the endpoint to
receive new data in the next frame by following the steps listed in “SETUP/Data IN/Status OUT”.
Because the controller can take some time to disable the endpoint, the application may not be able to
receive the data in the next frame after receiving wrong synchronous data.
20.5.4.19
Incomplete synchronous IN data transfers
This section describes how the application behaves on incomplete synchronous IN transfers.
【
Internal data flow
】
1. Synchronous IN transfers are incomplete on one of the following conditions:
The controller receives corrupted synchronous IN tokens from more than one synchronous IN
endpoints. In this case, the application can detect the incomplete synchronous IN transfer interrupt in
the GINTSTS register.
The application is slow in writing complete data to the transmit FIFO, and an IN token is received
before the completion of data write. In this case, the application can detect the INTKNTXFEMP
interrupt in the OTGFS_DIEPINTx register. The application ignores this interrupt, which will result in
the generation of the incomplete synchronous IN transfer interrupt (in OTGFS_GINTSTS register).
The controller responds to the received IN token by sending a zero-length data packet to the USB.
2. Either way, the application must stop writing the transmit FIFO as soon as possible.
3. The application must set the NAK and disable bits of the endpoints.
4. The controller disables the endpoint, clears the disable bit, and triggers the endpoint disable interrupt.
【
Application programming sequence
】
1. When the transmit FIFO becomes empty, the application ignores the INTKNTXFEMP interrupt (in the
OTGFS_DIEPINTx register) from any synchronous IN endpoint because this can trigger the incomplete
synchronous IN interrupt.
2. The incomplete synchronous IN transfer interrupt (in the OTGFS_GINTSTS register) indicates that at
least one synchronous IN endpoint is with incomplete synchronous IN transfers.
3. The application must read the endpoint control registers of all synchronous IN endpoints to determine
which one is with incomplete synchronous IN transfers.
4. The application must write data to the periodic transmit FIFO of the endpoint.
5. Disable theses endpoits by setting the following bits in the OTGFS_DIEPCTLx register
OTGFS_DIEPCTLx.SETNAK = 0x1
OTGFS_DIEPCTLx. endpoint enable = 0x1
6. The endpoint disable interrupt in the DIEPINTx register indicates that the controller has disabled the
endpoint.
7. At this point, the application must empty the data in the associated transmit FIFO or overwrite the
existing data in the FIFO by enabling the endpoint for a new transfer in the next frame. The application
must refresh the data through the OTGFS_GRSTCTL register.
20.5.4.20
Periodic IN (interrupt and synchronous) data transfers
This section describes a typical periodic IN data transfer.
To initialize the controller after power-on reset, the application must perform the steps list in OTGFS
Initializtion. Before communicating with a host, the controller must follow the steps defined in Endpoint
Initializtion to initialize endpoints.
【
Application requirements
】
1. Application requirements in “Non-periodic (bulk and control) IN data transfers” also apply to periodic
IN data transfers, except for a slight difference of requirement 2.
The application can only transmit multiples of largest-packet-size data packets, and a short
packet. To transmit several largest-packet-size data packets and a short packet, the following
conditions must be met:
Transfer size [epnum] = n * mps[epnum] + sp
(where n
and
i are integers ≥ 0, and 0 ≤ sp < mps[epnum])
If (sp > 0), packet count [epnum] = n + 1. Otherwise, packet count [epnum] = n, mc[epnum] = packet
count [epnum]