You are here

USB State Machine

Like any other USB device, Bootloader processes standard USB requests and reacts to events at USB bus. USB bus events processing is implemented as a state machine in usb_state_machine subprogram in boot.asm file.

Bootloader reacts to the following events:

ATTACH and DETACH

Attachment to USB bus and detachment. At attachment (ATTACH) internal state is reset to default values and Bootloader enters the wait mode for RESET command. At detachment (DETACH) Bootloader enters attachment wait mode.

RESET

USB bus reset. When bootloader receives the RESET command it configures Endpoint 0 and enters USB initialization mode. During initialization host assigns to device a unique, different from zero address (enumeration).

SUSPEND and RESUME

Switch to energy saving mode and exit it. When bootloader receives SUSPEND command it stops processing USB requests and enters the energy saving mode. Bootloader exits energy saving mode when it receives RESUME command.

IDLE

Switch to inactive state. When bootloader receives IDLE command it enters the inactive state. To exit from inactive state RESET command must be received.

STALL

Reaction to unsupported requests or errors at USB bus.