
NuMicro® NUC029LEE/NUC029SEE
32-bit Arm
®
Cortex
®
-M0 Microcontroller
Aug, 2018
Page
452
of
497
Rev 1.00
N
U
MICRO
®
N
UC02
9L
E
E
/N
UC029
S
E
E
T
E
CHN
ICA
L R
E
F
E
R
E
NC
E
M
A
NU
A
L
6.16.5.8 Handling Transactions with USB Device Peripheral
User can use interrupt or poll USB_INTSTS to monitor the USB transactions. When transactions
occur, USB_INTSTS will be set by hardware and send an interrupt request to CPU (if related
interrupt enabled), or user can poll USB_INTSTS to get these events without interrupt. The
following is the control flow with interrupt enabled.
When USB host has requested data from a device controller, user needs to prepare related data
in the specified endpoint buffer in advance. After buffering the required data, user needs to write
the actual data length in the specified USB_MXPLDx register. Once this register is written, the
internal signal “In_Rdy” will be asserted and the buffering data will be transmitted immediately
after receiving associated IN token from Host. Note that after transferring the specified data, the
signal “In_Rdy” will be de-asserted automatically by hardware.
USB_IRQ
In_Rdy
Data In
Setup PID
Data Setup
ACK PID
IN PID
NAK PID
IN PID
Data 0/1
ACK PID
USB
Bus Packets
Setup Received
Setup Handled by Firmware
Set by Hardware
Clear by Firmware
Set by Firmware
Clear by Hardware
Figure 6.16-4 Setup Transaction Followed by Data IN Transaction
Alternatively, when USB host wants to transmit data to the OUT endpoint in the device controller,
hardware will buffer these data to the specified endpoint buffer. After this transaction is
completed, hardware will record the data length in specified USB_MXPLDx register and de-assert
the internal
signal “Out_Rdy”. This will avoid hardware accepting next transaction until user
moves out the current data in the related endpoint buffer. Once users have processed this
transaction, the specified USB_MXPLDx register needs to be written by firmware to assert the
signal “Out_Rdy” again to accept the next transaction.
USB_IRQ
Out_Rdy
OUT PID
Data 0/1
ACK PID
OUT PID
NAK PID
OUT PID
Data 0/1
ACK PID
USB
Bus Packets
Read Data from Buffer
Set by Hardware
Clear by Firmware
Set by Firmware
Clear by Hardware
Clear by Hardware
Figure 6.16-5 Data Out Transfer