NuMicro® NUC029LEE/NUC029SEE32-bit Arm® Cortex® -M0 MicrocontrollerAug, 2018 Page 452 of 497 Rev 1.00NUMICRO® NUC029LEE/NUC029SEE TECHNICAL REFERENCE MANUAL6.16.5.8 Handling Transactions with USB Device PeripheralUser can use interrupt or poll USB_INTSTS to monitor the USB transactions. When transactionsoccur, USB_INTSTS will be set by hardware and send an interrupt request to CPU (if relatedinterrupt enabled), or user can poll USB_INTSTS to get these events without interrupt. Thefollowing is the control flow with interrupt enabled.When USB host has requested data from a device controller, user needs to prepare related datain the specified endpoint buffer in advance. After buffering the required data, user needs to writethe actual data length in the specified USB_MXPLDx register. Once this register is written, theinternal signal “In_Rdy” will be asserted and the buffering data will be transmitted immediatelyafter receiving associated IN token from Host. Note that after transferring the specified data, thesignal “In_Rdy” will be de-asserted automatically by hardware.USB_IRQIn_RdyData InSetup PID Data Setup ACK PID IN PID NAK PID IN PID Data 0/1 ACK PIDUSBBus PacketsSetup Received Setup Handled by FirmwareSet by Hardware Clear by FirmwareSet by Firmware Clear by HardwareFigure 6.16-4 Setup Transaction Followed by Data IN TransactionAlternatively, 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 iscompleted, hardware will record the data length in specified USB_MXPLDx register and de-assertthe internal signal “Out_Rdy”. This will avoid hardware accepting next transaction until usermoves out the current data in the related endpoint buffer. Once users have processed thistransaction, the specified USB_MXPLDx register needs to be written by firmware to assert thesignal “Out_Rdy” again to accept the next transaction.USB_IRQOut_RdyOUT PID Data 0/1 ACK PID OUT PID NAK PID OUT PID Data 0/1 ACK PIDUSBBus PacketsRead Data from BufferSet by Hardware Clear by FirmwareSet by Firmware Clear by HardwareClear by HardwareFigure 6.16-5 Data Out Transfer