Skip to main content

usb

Availability

Device

Description

The usb object represents a Universal Serial Bus (USB) interface. It is currently supported only on the imp005 module (Murata part number LBWA1UZ1GC-901) and the impC001, on which it is instantiated automatically as a property of the hardware object:

  • imp005 — hardware.usb
  • impC001 — harware.usbAB

Due to the way USB is implemented in the imp005’s on-board Broadcom MCU, an imp005 USB connection will not operate unless pin W and pin R are driven or pulled high. Pin R will already be driven high if you are using it as an active-high USB load switch. However, pin W should not be used for GPIO purposes in products which also require USB connectivity.

Limitations

Currently, impOS’ USB support is limited to just one USB device connected to the imp005 or impC001 at any one time. The imp005 and impC001 do not support the use of USB hubs. In addition, the maximum number of interfaces is four, with a maximum of three endpoints per interface.

Restriction Value
Maximum number of devices connected 1
Maximum number of interfaces 4
Maximum number of endpoints per interface 3

Certain classes of USB error, such as unending bulk transfers and halted control transfers, require that the bus be reset. This is done by disabling and re-enabling (re-configuring) the bus by calling usb.disable() and then calling usb.configure() to reconfigure the connected device. For more information on determining the source of USB errors and implementing recovery methods, please see Understanding USB Errors.

Library

We have now released a Squirrel library which provides a wrapper for the imp API’s usb object and its methods. Please see the library documentation here.

Member Entities

The usb object has the following member methods: