History: usbh_base

This page describes all changes made to the usbh_base package, the USB Host base, since its release.


3.24 (2021-06-16, 18:10):

  • ISO feedback IN endpoint poll rate was not handled correctly. For these endpoints poll rate is defined in bRefresh field of Endpoint Descriptor instead of bInterval.

3.23 (2021-03-30, 12:11):

  • Fixed typos.

3.22 (2020-10-26, 14:00)

  • Port manager now stops the host controller after transfers are stopped by the low level driver. Previously the host controller was stopped before this, potentially causing a faulty behavior if the host controller driver was not able to stop transfers after host controller stop.

3.21 (2020-05-18, 19:26):

  • Fix at revision 3.16 (remove active transfers when Host Controller is stopped) was incorrectly removing transfers for all devices connected to the root HUB when any device was removed from a port connected to an external HUB, potentially corrupting communication with any active device.

3.20 (2020-03-18, 17:13):

  • Expanded t_usbh_port_inf with release (bcdDevice) field.
  • Config option added to round down the polling interval to the greatest power of 2 that is smaller then the original or equal.

3.19 (2020-02-24, 16:56):

  • Code could crash if disconnect happened during enumeration.

3.18 (2019-09-13, 12:00):

  • C++ compiler errors eliminated.

3.17 (2018-08-27, 16:30):

  • Static analysis issues eliminated.

3.16r2 (2019-07-11, 14:05):

  • Default configuration option value for OTG (USBH_OTG_SRPHNP_SUPPORT) set to 0.

3.16 (2019-06-28, 13:40):

  • Active transfers are removed when Host Controller is stopped. This caused issues when restarting a host controller after being stopped while there were active transfers.

3.15 (2019-05-29, 18:30):

  • OTG SRP and HNP support added.

3.14r2 (2018-08-29, 18:17):

  • Document HTML link added to the documentation folder.
  • History and document files renamed to the package name.

3.14 (2018-06-19, 13:29):

  • Hard-coded constant value replaced by a macro (USBH_SETUP_SIZE).

3.13 (2017-09-25, 07:49):

  • Compiler warnings eliminated.

3.12 (2017-06-29, 10:34):

  • Compiler warnings eliminated.


  • Static analyzer warnings were eliminated (CodeSonar).


  • Compiler warnings were eliminated.


  • Fixed the case when there are no more free resources when a new device is connected.


  • warnings removed.


  • Host controller stop could fail to work correctly if a device was plugged to a port and USBH_MAX_EXT_HUBS was not set.


  • usbh_test_mode_port() operation fixed for ports on a HUB directly connected to the root HUB.


  • connection is reported in port information for connected but not enumerated devices.
  • devices reconnected to the root HUB during enumeration didn't enumerate correctly.
  • usbh_test_mode_device() returned success when invalid port handle was passed as a parameter.


  • works with USBH_MAX_EXT_HUBS set to zero.


  • usbh_get_port_inf_port() function added to gain information of a device based on the host controller ID and port path.


  • warnings removed.


  • usbh_test_mode_dev() and usbh_test_mode_port() introduced to be able to enable test mode on HS devices and ports.


  • warnings removed.


  •  Enumeration failure occurred if usbh_get_port_inf() was called from connection notification callback.


  •  Fast connect-disconnect problem fixed.
  •  Suspend call for an already suspended device was handled incorrectly.


  •  Incorrect mount could happen for a device connected to the root HUB in case a device was unplugged just before the new connection.
  •  usbh_get_string() was fixed.


  • Remote wakeup request incorrectly caused re-enumeration.


  • Fix for non-RTOS mode stop/suspend/resume all RTOS/non-RTOS mode.


  • Many fixes to avoid issues with suspend, resume, re-enumeration, disconnection or HC stop occurring simultaneously.
  • Fix to generate disconnection events for downstream devices of a disconnected HUB.
  • Possibility to suspend/resume a HUB with downstream devices.
  • Fix to allow the use of a device connected to an FS HUB via an HS HUB.


  • Added support for enabling Remote Wakeup capability on devices supporting it.


  • Mutex protection added around control channel transfers. Required to avoid simultaneous access from class drivers are allowed to execute control channel transfers from different tasks (e.g. HID).


  • Suspend/resume checks if the option is available in the host controller. Without this fix the system could crash if the HC didn't support suspend or resume.
  • Warnings removed on 16-bit microcontrollers.


  • When ports are removed host controller delete address function received incorrect device address if the device was not in addressed state, as a consequence if stop/delete was called during enumeration of a device the system could lock up waiting for a mutex and also memory could have been locked forever in hcc_mem module.
  • Lock timeout mutex at usbh_delete() to make sure it is unlocked before deletion.
  • Warnings removed.


  •  usbh_state(), usbh_get_vid_pid(), usbh_get_port_path() functions removed and usbh_get_port_inf() function introduced.


 - timeout task: addition of 0x100 to subtraction of current frame number and previous frame number in case of cframe overflow removed.


  • Non-blocking transfer could be stopped in case of suspended device due to an uninitialized variable in _usbh_transfer_start().


  • Suspend/resume handling implementation fixed, all blocking transfers directed to a suspended device will be aborted with USBH_ERR_SUSPENDED error code and all non-blocking transfers will be placed to a pending queue and restarted when the device resumes.
  • Handles remote wakeup.
  • usbh_state() function added.


  • Enumeration failed callback added.


  • Locks mutexes at usbh_delete() to make sure mutexes are unlocked before deleting them.


  • Preserve toggle for:

           - multi-packet transfers advanced by the common part

            - parts of Get Device Descriptor.


  •  usbh_timeout_task changed to be able to handle time slicing. Problem occurred if transfer initiated by a task of the same priority level as the timeout task timed out and the scheduler instead of finishing the timeout task switched to the task that started the transfer. This could crash the system.


  • Warning fixed.


  • In case of an error occurs when transfer is started the error code is also written to the transfer structure, without this some class drivers could become unoperational if called from a lower priority task than usbh_pmgr_task.


  • usbh_get_vid_pid() function introduced.
  • usbh_reenumerate() function introduced.
  • usbh_register_config_select_cb() introduced.


  • psp_endianness.h used instead of psp_endiness.h.
  • usbh_utils uses usbh_base version number (not separated any more).


Earlier fixes in usbh_utils (for reference):


  • get_next_dsc() removed and get_next_cfg_dsc() added instead. This new function will be able to process any size of configuration descriptor without the need of a buffer that can hold the whole descriptor.


  •  Check function prototypes by including its header file.


  • Use get_next_cfg_dsc() instead of get_next_dsc() to process next descriptor in the config.
  • Removed some needless transfer variable sets from usbh_receive_control_b and usbh_send_control_b.


  • Pending transfers are executed in FIFO order (before it was LIFO) this is required for correct ISO operation.
  • If a device failed to enumerate and another device was plugged (without plugging the bad device) the new device couldn't enumerate either.


  • return codes changed from enum to #define.
  • notification callback has return code now, in case the user needs to tell any state to the class driver.
  • USBH_TIMEOUT_CONTROL_IN changed from 500 to 5000 ms, found some devices where data is returned only 2seconds later to the setup packet.
  • USBH_TIMEOUT_CONTROL_NODATA changed from 100ms to 1000ms for the same purpose as USBH_TIMEOUT_CONTROL_IN.
  • needless version number checks removed.
  • NTF codes changed from enum to #define.


  • Check function prototypes by including its header file.


  • Suspend/resume crashed on a root HUB that doesn't support suspend/resume.


  • FS device could fail to mount in a multi host controller EHCI and OHCI combination. This was fixed and the enumeration code was reorganized.


  • USBH_ERR_INVALID_SIZE error code introduced
  • Common code (usb_host.c) reorganized due to a bug that could cause never ending transfers in case TRANSFER_FULL error was returned by the host controller and all pending transfers were finished before current transfer was added to pending queue.
  • Pending and timeout mutex introduced instead of global pmgr_mutex for clearer understanding.


  • OAL resource initialization changed. It will free resources from init in case of failure.


  • Initial release.