AT32F425
Series Reference Manual
2022.03.30
Page 363
Ver 2.01
1.
Initialize channel 1 (according to OTGFS channel initialization requirements). The application must
set the ODDFRM bit in the OTGFS_HCCHAR2 register
2.
Write the first packet to the channel 1
3.
Along with the last DWORD write of each packet, the host writes a reques to the periodic request
queue
4.
The OTGFS host sends an OUT token in the next frame (odd)
5.
The host generates an XFERC interrupt after the last packet is transmitted successfully
6.
In response to the XFERC interrupt, re-initialize the channel for the next transfer.
(
2
)
Handling interrupts
shows an example of common synchronous OUT transfers
Figure 20-9 Exam ple of common synchronous 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 synchronous
OUT transfers
Unmask (FRMOVRUN/XFERC)
if (XFERC)
{
De-allocate Channel
}
else if (FRMOVRUN)
{
Unmask CHHLTD
Disable Channel