MCCI TrueTask® USB Stack

For more information:

Ohad Beit-On


Embedded USB Host Stack: TrueTask® USB

TrueTask USB block diagram

TrueTask® USB is a portable embedded USB host stack. It supports USB 3.0 and USB 2.0 host controllers, as well as USB 3.0 and USB 2.0 hubs. It has been tested at the USB-IF PIL as part of xHCI certification in multiple designs, and has shipped to over 20 million PC customers. TrueTask USB also includes a portable embedded USB device stack, the MCCI USB DataPump, that has been deployed in nearly a billion products.

What is a USB platform?

The notion of a software platform is familiar: it’s a design environment that allows code to be written that is subsequently unaffected by changes to the operating system, CPU, compiler, and so forth. In the embedded system world, Linux is a good example of a a platform for application programs.

For reasons of efficiency, USB system code (the host and device stacks, the class and protocol drivers, and the management code) normally resides in the operating system kernel. Unfortunately, most operating systems that serve as application platforms do not serve as good system software platforms. In Linux, for example, the kernel APIs are not stable, and may change from kernel version to kernel version ( may be different than, for example). Windows has similar differences between major versions. For a system vendor, this is very inconvenient, because (at best) multiple source versions must be maintained; bug fixes and system-specific adaptations cannot be automatically applied to any given environment, but must be scrutinized for correctness.

This is particularly a problem when it comes to USB host stacks. By its nature, USB is an open standard. No matter how well tested and supported a stack is, patches may be required to support a new and popular device that deviates from USB standards (but just happens to work with Windows or MacOS X). This presents problems. If the stack is from a commercial vendor, often you must update to the latest version to get all the corrections. However, if the stack is not designed to be a platform, you will have to modify your code; and you may have to re-port the stack onto your platform. This may not be practical, because extensive testing may be required.

If working with Linux, the problem can be even more difficult. Because of changes in kernel APIs, it is usually not practical to port the entire USB stack back to an earlier kernel version. Instead bug fixes must be identified, and then back ported. However, fixes may depend on other corrections made to the stack; so they may not work by themselves. Furthermore, fixes in the enumeration code may cause other devices to stop working.

How TrueTask USB provides a USB platform

TrueTask USB is different than a traditional embedded USB host stack, in that it’s designed based on a foundation ofstable APIs. These APIs are designed portably, so that the C code using them is portable across CPUs, operating systems, and host/device controller register models. They are also designed to be stable over time, so that code written with one version of TrueTask USB will be reusable with subsequent versions. Furthermore, they’re internally stable as well. This means that a change, for example, in the host controller driver will not affect TrueTask USB code in any other layer; only minimal retesting is needed.

One way in which MCCI ensures that APIs are stable is by eliminating conditional compiles in our C code. The second way is by prohibiting use of OS header files except in the wrapper modules that bridge between TrueTask USB APIs and the local platform APIs. In addition to greatly simplifying compile-time configuration management, these practices force our code to depend on the inter-module APIs for managing all CPU, OS and hardware variations, rather than using “#if” and compile-time variables.

Dual Role Host/Device Support

It is increasingly common to multiplex a single physical USB connector to operate it either as a host or device. To support this, TrueTask USB has complete support for dual-role USB 2.0, dual-role USB 3.0, and USB 2.0 On The Go, based on the MCCI USB DataPump. The following block diagram illustrates the configuration for a dual-role USB 2.0 or USB 3.0 host/device.

TrueTask USB includes role-switching support for root hub and Microchip role-switch hubs, in support of Apple CarPlay.

TrueTask USB block diagram

Block diagram, TrueTask USB Host + Device Stack

TrueTask USB Features

Supported USB standards
USB 1.1, USB 2.0, HSIC USB, USB 3.0, USB 3.1, SSIC USB
Supported speeds
Low speed, full speed, high speed, USB 3.0 SuperSpeed, and USB 3.1 SuperSpeed Plus.
Supported hubs
USB 1.1, USB 2.0 (including transaction translators), USB 3.0, USB 3.1
Supported operating systems
  • Windows (8.1, 8, 7, Vista, XP, 32 and 64 bit, desktop and embedded editions)
  • Linux and Android (x86, Arm, PowerPC, SH)
  • Non-OS / pre-boot / post-crash environments using MCCI’s “os/none” (any supported architecture)
  • Embedded RTOS (including Nucleus, ThreadX, uITRON, and MQX)
Local OS USB Host Stack Emulations

Local OS Host Stack Emulations are available for Windows and Linux. These emulations allow TrueTask USB to support “in-box” class drivers shipped with the local operating system.

On Windows, this allows direct test and validation of new USB controller designs with a minimum of effort. The TrueTask USB host controller driver (HCD) API is a platform API, and allows direct test of non-EHCI/xHCI architectures such as the Synopsys DesignWare OTG USB 2.0 core using the full variety of Windows devices.

When developing an embedded system, this allows first testing the host drivers, hub drivers, enumeration logic and applications using Windows. When the software is moved to the embedded system, any variations are systematic and easy to track down.

Local OS USB Device Stack Emulations
Supported CPU architectures
ARC, ARM, MIPS, PowerPC, SH family, Tensilica
Supported compilers
Any compiler with ANSI C-89 support.
Supported Host/Device Controllers
  • xHCI 0.96 and 1.0 (Renesas, Asmedia, TI, Synopsys) for USB 2.0 and USB 3.0.
  • Renesas R8A66587 USB 2.0 host/device controller (either standalone or embedded in Renesas SH or RX processors).
  • Renesas RZ1 SOC.
  • Synopsys DesignWare USB 2.0 host/device controller (versions 1.6 and later)
  • Synopsys xHCI combined with Synopsys USB 3.0 device controller
TrueTask USB Host Class Drivers
Hub, Composite, Local OS bridge, Ethernet Control Model (ECM), Ethernet Emulation Model (EEM), Network Control Model (NCM), Mass Storage (BOT), Human Interface Device (HID) keyboard and mouse
TrueTask USB Device Protocols
ADB, USB Audio 1.0 and 2.0, Abstract Control Model (ACM), Ethernet Control Model (ECM), Ethernet Emulation Model (EEM), Device Firmware Update (DFU), HID, MBIM, MCPC GL-004/005, Mass Storage BOT and UASP, SIC (Still Interface Class, for MTP and PictBridge), Local OS bridge, RNDIS, USB Video class, Wireless Mobile Communication (WMC) ACM, OBEX, Device Management, MDLM
Networking Architecture
MCCI’s ECM, EEM and NCM support are based on a common API for host and device, called the “Abstract NIC” API. This API isolates the client code from the details of whether the product is working as a host as a device, and whether the USB transport is using ECM, EEM, or NCM.
Runtime memory architecture
TrueTask USB is completely reentrant, and allocates memory dynamically at run time. The architecuture supports arbitrarily many instances of TrueTask USB, host and device controllers, class drivers, and protocol instances. TrueTask USB has no global or static variables.
Runtime memory allocation policy
Selected at design time. TrueTask USB can pre-allocate all needed RAM at boot time, dynamically allocate from a fixed pool, or dynamically allocate from system pool. Pre-allocating at boot time allows for deterministic behavior for a given USB tree size, and for graceful failure if the pre-determined maximum tree size is exceeded. Dynamic allocation results in more efficient memory allocation at the sacrifice of determinism. The two dynamic variants differ in their impact on remaining system memory; the fixed pool reserves a constant amount of memory, increasing predictability.
Synchronization and concurrency control
TrueTask USB makes minimal assumptions about the underlying OS. TrueTask USB uses event driven processing, with the assumption that two events are not dispatched concurrently. On multi-core systems with multiple host/device controllers, typically one instance is created per independent controller. The synchronization model is portable from the simplest pre-boot / post-crash case (“os/none”), through classic RTOS models to highly concurrent multi-CPU models such as the Windows kernel. Although the model is simple, testing on Windows shows that TrueTask USB is as fast as, or faster than, stacks that are coded using the native Windows synchronization APIs.
Business Model
TrueTask USB is an OEM product, so pricing normally includes the rights to distribute in conjunction with another product. Pricing for distribution rights is negotiated based on volume. MCCI supports royalty, annual subscription, or one-time fee per project. Support is available based on annual contracts.
Compilers for C/C++Real Time Operating SystemsDebuggers & JTAG EmulatorsEmbedded Software Testing solutionsMiddleware & SW componentsHW Testing solutions – Boundary-Scan (JTAG) & FunctionalProtocol and Bus Analyzers & StimulatorsHome of CANopen, EtherCAT, PowerLink, ProfiNet– SW Protocols, devices & SolutionsIn-Circuit/Parallel Engineering & Production Device Programmers (Flash/EPROMs/CPLDs…)Video & Audio SW CODECs components

For more information: Ohad Beit-On 054-2584032