AT32WB415
Series Reference Manual
2022.04.13
Page 324
Ver 2.00
receive the synchronous OUT data in the enxt frame by following the steps listed in
“SETUP/Data IN/Status OUT”
3. When it receives an incomplete synchronous OUT data interrupt, the application must read the control
registers of all synchronous OUT endpoints to determine which one of the endpoints has an
incomplete data transfer in the current frame. An endpoint transfer is regarded as incomplete if both
of the following conditions are met:
OTGFS_DOEPCTLx. Even/Odd frame bit= OTGFS_DSTS.SOFFN[0]
OTGFS_DOEPCTLx. Endpoint enable = 0x1
4.The pervious step must be performed before the SOF interrupt of the GINTSTS register is detected to
ensure that the current frame number is not changed.
5. For synchronous OUT endpoints with incomplete transfers, the application must drop the data in
memory, and disable the endpoint through the endpoint disable bit in the OTGFS_DOEPCTLx
register.
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.