38.6.2.6 Address Setup

The USB device address is set up according to the USB protocol.

  • After all kinds of resets, the USB device address is 0
  • The host starts a SETUP transaction with a SET_ADDRESS (addr) request
  • The user writes this address to the USB Address (USBHS_DEVCTRL.UADD) field, and writes a zero to the Address Enable (USBHS_DEVCTRL.ADDEN) bit, so the actual address is still 0
  • The user sends a zero-length IN packet from the control endpoint
  • The user enables the recorded USB device address by writing a one to USBHS_DEVCTRL.ADDEN

Once the USB device address is configured, the controller filters the packets to accept only those targeting the address stored in USBHS_DEVCTRL.UADD.

USBHS_DEVCTRL.UADD and USBHS_DEVCTRL.ADDEN must not be written all at once.

USBHS_DEVCTRL.UADD and USBHS_DEVCTRL.ADDEN are cleared:

  • On a hardware reset
  • When the USBHS is disabled (USBHS_CTRL.USBE = 0)
  • When a USB reset is detected

When USBHS_DEVCTRL.UADD or USBHS_DEVCTRL.ADDEN is cleared, the default device address 0 is used.