English
Language : 

PIC18F44J50-I Datasheet, PDF (372/562 Pages) Microchip Technology – 28/44-Pin, Low-Power, High-Performance USB Microcontrollers
PIC18F46J50 FAMILY
22.5 USB Interrupts
The USB module can generate multiple interrupt condi-
tions. To accommodate all of these interrupt sources,
the module is provided with its own interrupt logic struc-
ture, similar to that of the microcontroller. USB interrupts
are enabled with one set of control registers and
trapped with a separate set of flag registers. All sources
are funneled into a single USB interrupt request, USBIF
(PIR2<4>), in the microcontroller’s interrupt logic.
Figure 22-7 provides the interrupt logic for the USB
module. There are two layers of interrupt registers in
the USB module. The top level consists of overall USB
status interrupts. These interrupts are enabled and
flagged in the UIE and UIR registers, respectively. The
second level consists of USB error conditions, which
are enabled and flagged in the UEIR and UEIE
registers. An interrupt condition in any of these areas
triggers a USB Error Interrupt Flag (UERRIF) in the
top level.
Interrupts may be used to trap routine events in a USB
transaction. Figure 22-8 provides some common
events within a USB frame and their corresponding
interrupts.
FIGURE 22-7:
USB INTERRUPT LOGIC FUNNEL
Second Level USB Interrupts
(USB Error Conditions)
UEIR (Flag) and UEIE (Enable) Registers
Top Level USB Interrupts
(USB Status Interrupts)
UIR (Flag) and UIE (Enable) Registers
BTSEF
BTSEE
BTOEF
BTOEE
DFN8EF
DFN8EE
CRC16EF
CRC16EE
CRC5EF
CRC5EE
PIDEF
PIDEE
SOFIF
SOFIE
TRNIF
TRNIE
IDLEIF
IDLEIE
UERRIF
UERRIE
STALLIF
STALLIE
ACTVIF
ACTVIE
USBIF
URSTIF
URSTIE
FIGURE 22-8:
EXAMPLE OF A USB TRANSACTION AND INTERRUPT EVENTS
USB Reset
URSTIF
Start-of-Frame (SOF)
SOFIF
From Host From Host
SETUP Token Data
To Host
ACK
From Host
IN Token
To Host
Data
From Host
ACK
From Host
OUT Token
From Host
Empty Data
Transaction
To Host
ACK
Set TRNIF
Set TRNIF
Set TRNIF
Transaction
Complete
RESET
Differential Data
SOF
SETUP DATA STATUS
SOF
Control Transfer(1)
1 ms Frame
Note 1: The control transfer shown here is only an example showing events that can occur for every transaction. Typical
control transfers will spread across multiple frames.
DS39931D-page 372
 2011 Microchip Technology Inc.