Skip to main content
Indian medical device engineer testing SEGGER emUSB-Host on an STM32H7 board with USB mass storage stick and barcode scanner attached for patient ID capture

SEGGER emUSB-Host for Indian Medical and Industrial Products on STM32H7 and i.MX RT

GSAS Editorial · · 9 min read

Every Indian medical-device and industrial-controller team eventually hits the same mid-project surprise: the product specification quietly says “must accept a USB stick for patient data export” or “must support a USB barcode scanner for point-of-care patient ID” or “must print to a USB receipt printer at the factory-floor station,” and the firmware engineer suddenly realizes the Cortex-M part they picked does not just need USB device mode, it needs to act as a USB host. That is a very different problem, and it is where most in-house USB stacks quietly fall apart. On Cortex-M4/M7/M33 targets running at tens of thousands of shipped units per year, the commercial answer Indian OEMs converge on is SEGGER emUSB-Host, licensed through GSAS Micro Systems as India’s authorized engineering partner for SEGGER Microcontroller GmbH.

This post walks through why rolling your own USB Host stack is a trap, which class drivers emUSB-Host ships, how it pairs with emFile and embOS on typical Indian Cortex-M hardware, and the four Indian product categories where the commercial licence pays for itself inside the first production run.

Why rolling your own USB Host stack is a trap

USB Device mode, where your Cortex-M part pretends to be a CDC serial port, a HID device, or a mass-storage volume to a host PC, is difficult but manageable. Every silicon vendor ships a free reference device stack for their USB OTG peripheral, and Indian teams have been using these for years to implement firmware-update ports and configuration interfaces.

USB Host mode is a different category of work. The host side of the protocol has to enumerate arbitrary plugged-in devices, speak multiple class protocols, manage power and hub topologies, and recover from the huge space of malformed device behaviour that ships in consumer USB peripherals. The pieces an in-house stack has to implement, test, and maintain in perpetuity:

  • USB 2.0 protocol handling. Enumeration, addressing, configuration, transfers (control / bulk / interrupt / isochronous), suspend and resume, split transactions for full-speed devices behind a hub.
  • Class drivers. Mass Storage Class (MSC), HID (keyboards, mice, barcode scanners, game controllers), CDC (USB-to-serial adapters and modems), Printer Class, CCID (smart-card readers), MTP (media transfer), Audio, Video, and a vendor-specific class for any peripheral that does not implement a standard class.
  • Hub support. Real-world USB sticks and scanners end up behind bus-powered hubs on industrial panels, and the host stack has to enumerate through the hub correctly.
  • Power management. VBUS switching, overcurrent handling, port power budgets.
  • Error recovery. Noisy USB connections, partially-failed devices, devices that enumerate twice, devices that NAK indefinitely, the real world is full of these, and an in-house stack has to handle every case without locking up the target.

Each of these is non-trivial on its own. Taken together, they are a multi-year engineering program, and for an Indian medical-device OEM working to an IEC 62304 software-of-unknown-provenance boundary, every line of USB stack code you own is a line you have to justify to a notified body. The commercial alternative, a certified, field-hardened stack with a vendor on the other end of a support contract, is how Indian teams keep the calendar in one piece.

SEGGER emUSB-Host: what is in the box

emUSB-Host is SEGGER’s commercial USB Host stack, shipped with full source as a royalty-free per-product licence. The class-driver coverage Indian OEMs care about:

  • Mass Storage Class (MSC): read and write USB sticks and external SSDs. Combined with SEGGER emFile it gives you a full FAT32 / exFAT read-write volume on the host side in about 30 KB of flash for the combined stack.
  • HID: USB keyboards, mice, barcode scanners, and game controllers. This is the path Indian point-of-care diagnostic devices take when the specification calls for a USB barcode scanner at the bedside.
  • CDC (ACM): USB-to-serial adapters, 3G/4G modems, and vendor-specific virtual COM ports. Indian industrial teams use CDC to pull data from legacy RS-232 instruments through a USB adapter.
  • Printer class: USB receipt printers on industrial floor stations and medical devices that print a report strip.
  • CCID: USB smart-card readers for identity verification at pharmacy dispensing units and clinical workstations.
  • MTP: Android phones and cameras as media sources for field data collection.
  • Audio, Video, and vendor-specific class drivers for specialized peripherals.

Check the current emUSB-Host class driver matrix on the SEGGER product page before scoping a specific Indian product, since the supported list evolves release to release. The short version: if the peripheral speaks a standard USB class, emUSB-Host almost certainly has a driver for it, and if it is vendor-specific, SEGGER will either add the driver under the commercial licence or hand you the vendor-class template to implement it yourself.

Pairing emUSB-Host with emFile for USB mass storage

Reading a FAT32 patient-data stick from a Cortex-M target needs two pieces: the USB Host stack that enumerates the stick as a block device, and a FAT/exFAT file system that reads and writes files on that block device. emFile plugs into emUSB-Host MSC as its block driver. The integration looks like this from application code:

// Initialize USB Host stack
USBH_Init();
// Add MSC class driver
USBH_MSD_Init();
// Wait for stick to enumerate and register with emFile as volume "msd:"
FS_Init();
// Open a file on the plugged-in stick
FS_FILE * f = FS_FOpen("msd:\\patient_report.pdf", "wb");
FS_Write(f, report_buffer, report_len);
FS_FClose(f);

For a Bengaluru medical-device team building an ECG or spirometry product that exports a session report to a USB drive, this three-layer stack (emUSB-Host + MSC class driver + emFile) is what unblocks the “export to USB” feature on the product specification. For a Chennai industrial-controller team building a data-logger that swaps historical logs with a maintenance laptop via a USB stick, same stack, same pattern.

The alternative, writing your own block-device glue between an in-house USB Host stack and an open-source FAT library, is another few weeks of work and a block-device boundary that does not appear in any regulatory artefact. emUSB-Host + emFile is a single commercially-supported unit, which is exactly what an IEC 62304 evidence package wants.

Pairing emUSB-Host with embOS or running bare-metal

emUSB-Host is designed to run on top of an RTOS or on bare-metal. On bare-metal it uses a cooperative polling model where the application calls USBH_Task() from the main loop, which processes any pending USB events. On an RTOS it runs as a dedicated task, typically called from SEGGER embOS but equally happy on FreeRTOS or Zephyr if that is what the Indian team has already committed to.

The embOS pairing is what most Indian medical and industrial teams pick for production for two reasons: deterministic task scheduling (so the USB Host task does not starve the safety-critical control loop), and the fact that a single commercial SEGGER middleware contract covers both embOS and emUSB-Host, which simplifies procurement. The embOS bootloader post has more on the embOS deployment pattern Indian teams are using on STM32 and nRF52.

For a Pune defence-electronics programmer reading encrypted image sticks in the field, the production choice is almost always embOS + emUSB-Host + emFile + emCrypt for the AES-XTS layer underneath the file system, a full commercial-supported stack from the USB port to the decrypted payload.

Four Indian product categories where the licence pays back inside the first production run

The commercial emUSB-Host licence is royalty-free per product, which means you pay once per product line and ship as many units as you like over the program lifetime. The four Indian product categories where this pays back fastest:

  • Point-of-care diagnostic devices accepting USB barcode scanners for patient ID. Indian hospital chains want barcode-scanned patient wristbands at every device interaction, for medication reconciliation, sample labelling, and ECG/spirometry sessions. The device has to be a USB host for a plug-and-play HID scanner. emUSB-Host HID driver does this in a few hundred lines of integration code and the scanner vendor does not need to be coordinated with in advance.
  • Bengaluru medical-device teams building ECG, spirometry, or patient monitors that export reports to USB drives. The specification says “export session report as PDF to a USB stick” and the product team has six weeks to implement it. emUSB-Host MSC + emFile makes that a three-day job, not a three-month project.
  • Chennai industrial-controller teams that accept USB-Host data exchange with maintenance laptops. The use case is “plant engineer walks up with a USB stick, plugs it in, and the controller writes the last seven days of historical logs to it as a CSV.” Same stack as above, different file format.
  • Pune defence-electronics programs reading encrypted image sticks in the field. A soldier plugs a pre-provisioned USB stick into an in-vehicle unit; the unit reads the encrypted image over USB MSC, decrypts it through emCrypt, and loads it into operational memory. The USB Host layer has to be reliable, the file system has to be reliable, and the provenance of every line of code has to be auditable, emUSB-Host is the only stack Indian defence contractors we work with will sign off on for this class of program.

Target silicon: what Indian teams actually ship on

emUSB-Host ships with drivers for the common Cortex-M4/M7/M33 USB OTG peripherals Indian teams pick:

  • STM32H7 series (H743, H753, H723, H735) with the Synopsys USB OTG HS peripheral. The most common target for Indian medical-device HMI-plus-USB-Host designs because of the graphics pipeline, the Ethernet MAC, and the USB OTG all being on a single part.
  • NXP i.MX RT crossover MCUs (RT1060, RT1170) with their EHCI-compatible USB Host controllers. See the i.MX RT crossover post for the J-Link side of the debug story.
  • Nordic nRF5340 (high-speed USB) for Indian wireless product teams who want USB Host on a Bluetooth-capable target.
  • Renesas RA6 / RA8 for Indian industrial teams on the Renesas line.
  • Microchip SAM E70 / SAM V71 for automotive-grade USB Host workloads.

On every one of these, emUSB-Host’s hardware abstraction is already written, tested, and supported. Dropping it into a new Cortex-M target is a days-of-integration job, not a months-of-development job.

Further reading

To scope a USB Host integration for your Indian medical-device, industrial-controller, or defence-electronics product, or to licence emUSB-Host commercially for a Cortex-M4, Cortex-M7, or Cortex-M33 target, contact GSAS Micro Systems in Bengaluru, Chennai, Hyderabad, Pune, Mumbai, or Delhi NCR and our engineering team will walk you through the class-driver selection, the emFile integration, and the commercial licensing.

Interested in SEGGER tools?

Talk to our application engineers for personalized tool recommendations.

Stay in the Loop

Get monthly compliance updates, product insights, and engineering best practices delivered to your inbox.