USB Interrupt Transfers are a transmission method in the USB protocol designed specifically for low data volume, periodic, and real-time requirement scenarios. They are mainly used for devices to actively report status changes or send small batches of data to the host, balancing response speed and reliability. The following is a detailed explanation from aspects such as core functions, transmission characteristics, workflow, and application scenarios:
I. Core Functions
The core of interrupt transfers is to realize the “active notification” from the device to the host, which is suitable for scenarios where device status changes are not frequent but require timely response from the host, such as:
- Events of input devices (keyboards, mice) like key presses/movement;
- Value updates of sensors (temperature, humidity);
- Status feedback of small control devices (gamepads, scanners).
II. Transmission Characteristics
- Small data volume: The amount of data transmitted in a single transfer usually does not exceed the maximum packet length of the endpoint (≤8 bytes for low-speed devices, ≤64 bytes for full-speed devices, ≤1024 bytes for high-speed devices), to complete interactions quickly.
- Periodic triggering: The host and the device agree on a fixed polling interval (e.g., 10ms, 20ms). The host actively queries the device at intervals to check if there is data to transmit, ensuring real-time performance.
- Reliability guarantee: It adopts error detection and retransmission mechanisms (similar to control transfers). If data transmission fails, the host will retry during the next query to avoid data loss.
- Mainly unidirectional: Usually device→host (input), and in a few scenarios, it supports host→device (output, such as feedback of control commands).
- Medium priority: Higher than bulk transfers (no real-time requirements) and lower than isochronous transfers (high real-time requirements, such as audio/video).
III. Endpoints and Configuration
Interrupt transfers rely on the device’s Interrupt Endpoint, which needs to be pre-configured with the following key parameters:
- Polling Interval: The time period (in ms) at which the host queries the device. A smaller interval means a faster response speed (but occupies more bus bandwidth). For example:
- The interval for keyboards/mice is usually 10ms (the host queries once every 10ms);
- The interval for sensors can be set to 100ms (adjusted according to the data update frequency).
- Max Packet Size: The maximum amount of data supported by the endpoint in a single transfer, defined by the device according to its own needs (e.g., the mouse endpoint is set to 4 bytes, which is sufficient to store coordinate changes).
IV. Workflow
- Initialization configuration: During device enumeration, the device declares parameters such as the polling interval and maximum packet length of the interrupt endpoint to the host through control transfers, and the host records and saves these parameters.
- Periodic polling: The host actively sends a “query request” to the device’s interrupt endpoint at the agreed interval to check if there is data to transmit.
- Data transmission:
- If the device has data (e.g., a key is pressed), it sends the data to the host through the interrupt endpoint;
- If the device has no data, it returns a “no data” signal, and the host waits for the next interval.
- Error handling: If a data error is detected during transmission (e.g., checksum failure), the host re-requests the data during the next query until it succeeds or the retry limit is reached.
V. Comparison with Other Transfer Modes
| Transfer Mode | Core Advantages | Real-time Performance | Data Volume | Typical Applications |
|---|---|---|---|---|
| Interrupt | Periodic polling, timely response | Medium | Small | Keyboards, mice, sensors |
| Isochronous | High real-time performance, no retransmission | High | Medium/Large | Audio, video streams |
| Bulk | Efficient bandwidth utilization, no fixed interval | Low | Large | USB drives, hard disks, printers |
| Control | Device configuration and management | No requirement | Very small | Device enumeration, command interaction |
VI. Typical Application Scenarios
- Input devices: Keyboard key triggers, mouse movement/clicks, gamepad joystick/button status;
- Small peripherals: Scanner progress feedback, printer fault alarms;
- Sensors: Real-time data from heart rate monitors, value updates from temperature and humidity sensors;
- Medical devices: Measurement results from blood glucose meters, parameter adjustment feedback from hearing aids.
Summary
Interrupt transfers, through the design of “periodic polling + small batch data + reliable retransmission”, strike a balance between real-time response and bus efficiency. They are the core transmission method in USB systems for handling devices with “low-frequency status changes”, ensuring that user operations (such as key presses and mouse movements) can be quickly recognized and processed by the host.
























Leave a comment