AT32WB415
Series Reference Manual
2022.04.13
Page 302
Ver 2.00
Figure 20-7 Example of common Bulk/Control OUT/SETUP and Bulk/Control IN transfer
set_ch_en(ch_2)
read_rx_sts
read_rx_sts
read_rx_fifo
read_rx_sts
Disable(ch_2)
init_reg(ch_2)
write_tx_fifo
(ch_1)
init_reg(ch_1)
1
1
2
2
7
5
7
9
3
4
ch_1
ch_2
ch_1
ch_2
3
6
ch_2
8
1
MPS
1 MPS
RXFLVL
interrupt
RXFLVL
interrupt
Application
AHB
Host
USB
Device
DATA0
MPS
DATA0
Non-periodic Request
Queue
Assume that this queue
can hold 4 entries.
De-allocate(ch_1)
DATA1
MPS
DATA1
write_tx_fifo
(ch_1)
5
set_ch_en(ch_2)
set_ch_en(ch_2)
set_ch_en(ch_2)
read_rx_stsre
ad_rx_fifo
De-allocate
(ch_2)
11
13
1
MPS
ch_1
ch_2
ch_2
ch_2
RXFLVL
interrupt
CHHLTD
interrupt
XFERCOMPL
interrupt
6
12
10
1
MPS
XFERCOMPL
interrupt
4
(2) Handling interrupts
The following code describes the interrupt service routine related to the channel during bulk and control
transfer OUT/SETUP operation
Unmask (NAK/XACTERR/NYET/STALL/XFERC)
if (XFERC)
{
Reset Error Count
Mask ACK
De-allocate Channel
}
else if (STALL)
{
Transfer Done = 1
Unmask CHHLTD
Disable Channel
}
else if (NAK or XACTERR or NYET)
{
Rewind Buffer Pointers