Nations Technologies Inc.
Tel
:
+86-755-86309900
:
info@nationstech.com
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
607
/
631
as a isochronous endpoint during enumeration, the USB host will allocate the required bandwidth for the endpoint in
each frame of transmission, but in order to save bandwidth, isochronous transfer does not have a retransmission
mechanism, that is, there is no handshake stage, there is no handshake packet after the data packet, so there is no
need to use the data toggle mechanism, and the isochronous transfer only transmits the PID DATA0 data packet.
The isochronous endpoint uses a double buffer mechanism to reduce the processing pressure of the application. The
buffer used by the USB module is identified by the DATTOG bit. In the same register, the USB_EPn.DATTOG_RX
bit identifies the receiving isochronous endpoint, and the USB_EPn.DATTOG_TX bit identifies the sending
isochronous endpoint. Compared with the bulk double buffering mechanism, the isochronous double buffering
mechanism has no SW_BUF, because the buffer that the application can access is the one not indicated by DATTOG,
so to achieve bidirectional isochronous transmission, two USB_EPn registers need to be used. The use of double-
buffered isochronous endpoints is shown in Table 26-3.
Table 26-3 How to use isochronous double buffering
Endpoint type
DATTOG
Buffer used by the USB module
Buffers used by the application
IN Endpoint
0
ADDRn_TX_0/CNTn_TX_0
ADDRn_TX_1/CNTn_TX_1
1
ADDRn_TX_1/CNTn_TX_1
ADDRn_TX_0/CNTn_TX_0
OUT Endpoint
0
ADDRn_RX_0/CNTn_RX_0
ADDRn_RX_1/CNTn_RX_1
1
ADDRn_RX_1/CNTn_RX_1
ADDRn_RX_0/CNTn_RX_0
The application initializes the DATTOG bits based on the buffer to be used the first time. Each time the transfer is
completed,
USB_EPn.CTRS_RX or USB_EPn.CTRS_TX is set according to the direction in which the transmission
is enabled, and a corresponding interrupt is generated. If a CRC error or buffer overflow error occurs, the
USB_EPn.CTRS_RX or USB_EPn.CTRS_TX interrupt event can still be triggered, but if it is a CRC error, the
hardware will set the USB_STS.ERROR bit, indicating that the data may be corrupted. At the same time, the
hardware toggles the DATTOG bit, but the USB_EPn.STS_RX or USB_EPn.STS_TX bits are not affected.
Isochronous endpoint definition: set USB_EPn.EP_TYPE = 10. Since the isochronous endpoint has no handshake
mechanism, the status of the isochronous endpoint can only be set to VALID or DISABLED, and it is illegal to set it
to STALL or NAK.
Note:
1
、
Compared with bulk double buffering, since
isochronous
double buffering has no handshake mechanism,
isochronous
double buffering has no flow control mechanism.
USB events and interrupts
Every USB behavior is initiated by the application and driven by USB interrupts or events. After a system reset, the
application needs to wait for a series of USB interrupts and events.
Reset events
26.4.5.1.1
System reset and power-on reset
After a system reset or power-on reset occurs, the software first needs to enable the clock signal of the USB module,
then clear the reset signal to access the registers of the USB module, and finally open the analog part connected to
the USB transceiver. The software operation process is as follows: