AT32F425
Series Reference Manual
2022.03.30
Page 360
Ver 2.01
Figure 20-8 shows an example of common interrupt OUT/IN transfers
set_ch_en(ch_2)
set_ch_en(ch_2)
read_rx_sts
read_rx_fifo
read_rx_sts
init_reg(ch_2)
init_reg(ch_2)
write_tx_fifo
(ch_1)
init_reg(ch_1)
1
1
2
2
6
6
7
9
3
4
ch_1
ch_2
4
5
5
ch_1
ch_2
8
1
MPS
1 MPS
XFERC
interrupt
XFERC
interrupt
RXFLVL
interrupt
XFERC
interrupt
Application
AHB
Host
USB
Device
DATA0
MPS
DATA0
Periodic Request Queue
Assume that this queue
can hold 4 entries.
RXFLVL
interrupt
write_tx_fifo
(ch_1)
init_reg(ch_1)
write_tx_fifo
(ch_1)
init_reg(ch_1)
3
1 MPS
1
MPS
DATA1
MPS
DATA1
Odd (micro)
frame
Even (micro)
frame
The following code describes the interrupt service routine related to the channel during interrupt OUT
transfers
Unmask (NAK/XACTERR/STALL/XFERC/FRMOVRUN)
if (XFERC)
{
Reset Error Count
Mask ACK
De-allocate Channel
}
else if (STALL or FRMOVRUN)
{
Mask ACK
Unmask CHHLTD
Disable Channel
if (STALL)
{
Transfer Done = 1
}
}
else if (NAK or XACTERR)
{
Rewind Buffer Pointers