Arduino GIGA R1 USB Host Guide: Keyboards, Mice, USB Drives and Host Power

Arduino GIGA R1 USB host guide: enable the USB-A host port, connect keyboards, mice and USB flash drives, use Arduino_USBHostMbed5 or USBHostGiga, understand the 500 mA host limit and avoid common USB-host pitfalls.

The Arduino GIGA R1 WiFi includes something that most Arduino boards do not:

This allows the board to act as the USB host and communicate with peripherals such as:

  • USB keyboards;
  • USB mice;
  • USB flash drives;
  • some USB serial devices;
  • other supported USB-class peripherals.

The physical architecture is:

That distinction is important. The USB-A connector is the one intended for plugging peripherals into the GIGA.

Quick USB Reference

Function GIGA R1 WiFi
USB host connector USB-A
USB device/programming connector USB-C
Host power enable PA15 / internal D92
USB-A current limit Approximately 500 mA
Mass storage library Arduino_USBHostMbed5
Keyboard/mouse low-speed library USBHostGiga (currently ALPHA)
Typical flash-drive filesystem FAT

What Does USB Host Mean?

USB always has a host side and a device/peripheral side.

A normal Arduino connected to a PC is usually:

With the GIGA USB-A port, the roles change:

The host is responsible for:

  • supplying bus power;
  • detecting the device;
  • enumerating it;
  • loading the appropriate USB class driver;
  • transferring data.

The USB-A Port Must Be Powered

On GIGA, host-port power is controlled by:

The current Arduino board variant also maps this internal signal as:

Official GIGA examples typically enable host power with:

Without host power, a connected USB device may not enumerate at all.

USB Host Power Example

This powers the VBUS side of the USB-A connector.

USB-A Current Limit

Arduino documents an approximate USB host current limit of:

Do not assume the GIGA can power any USB peripheral.

Devices that can exceed this budget include:

  • portable hard drives;
  • some SSD enclosures;
  • USB Wi-Fi adapters;
  • USB cameras;
  • high-power hubs;
  • devices with motors or heaters.

Use a Powered USB Hub for Higher-Power Devices

If a peripheral needs more power than the GIGA should supply, use:

The hub then supplies the peripheral current rather than loading the GIGA host port.

The USB-A Port Does Not Power the Board

The USB-A connector is the:

not the normal board-power input.

Power the GIGA through:

  • USB-C;
  • VIN;
  • appropriate regulated board power.

Two Main USB Host Library Paths

At the moment, GIGA USB host projects commonly use two Arduino libraries depending on the peripheral.

Arduino_USBHostMbed5

This library is used for Mbed-based USB host applications such as:

  • USB mass storage;
  • supported HID devices;
  • other Mbed USB host classes.

It is the library used by official Arduino examples that mount USB flash drives.

USBHostGiga

Arduino also maintains:

specifically to address limitations with low-speed USB devices such as many keyboards and mice.

Arduino currently labels this library:

and warns that its API is minimal and subject to change.

Why Keyboard Support Can Be Confusing

Many simple USB keyboards operate as:

and not every GIGA host stack has handled those devices equally well.

This is why a keyboard may fail with one host library but work with:

instead.

For a current project, always test the exact keyboard or mouse you intend to use.

USB Keyboard Example

The current Arduino USBHostGiga keyboard example uses:

and starts the keyboard with:

Minimal Keyboard Sketch

This reads keyboard HID events and converts supported keys to ASCII.

Not Every Key Maps to ASCII

A USB keyboard reports HID key events, not ordinary text characters.

Keys such as:

  • Shift;
  • Ctrl;
  • Alt;
  • function keys;
  • arrow keys;
  • media controls;

need to be handled as HID events rather than simply treated as characters.

USB Mouse Support

The USBHostGiga API also provides a:

class.

The basic pattern is:

A mouse normally reports:

  • X movement;
  • Y movement;
  • wheel movement;
  • button states.

USB Flash Drives

For USB mass storage, the common GIGA approach uses:

This lets the GIGA mount a normal FAT-formatted USB flash drive and access files.

Required Includes for USB Storage

Create the mass-storage and filesystem objects:

Connect the USB Drive

First enable host power:

Then wait for the storage device:

Mount the Filesystem

Once mounted, normal C-style file access can be used through the mounted path.

Complete USB Flash Drive Example

Writing a File to USB

Once mounted, a normal pattern is:

This makes USB flash drives useful for:

  • data logging;
  • configuration files;
  • CSV export;
  • audio files;
  • firmware/assets;
  • large captured datasets.

Reading a File

Always Close Files

USB storage is not the same as writing to RAM.

Always:

after writing.

If power is removed while buffers are still unwritten, the filesystem can be corrupted.

Unmount Before Removing a Drive

Where your application allows it, unmount or otherwise stop filesystem activity before physically removing the flash drive.

This is especially important for:

  • continuous logging;
  • database-style files;
  • large buffered writes.

FAT Is the Normal Choice

Arduino examples use:

so a FAT-formatted USB drive is the simplest option.

Do not assume:

will automatically work just because the GIGA can electrically enumerate the drive.

USB Device Detection Is Not the Same as Class Support

A very common misunderstanding is:

That is not how USB works.

The host software needs support for the device’s USB class and protocol.

Devices Likely to Be Easier

Standardised classes are generally easiest:

  • HID keyboard;
  • HID mouse;
  • mass storage;
  • some CDC serial devices.

Devices That May Need Special Drivers

Examples include:

  • webcams;
  • printers;
  • USB audio interfaces;
  • vendor-specific measurement equipment;
  • game controllers with unusual HID reports;
  • proprietary adapters.

For these devices, a custom USB host driver or lower-level work may be required.

USB Serial Devices

The USBHostGiga library currently contains a:

class for supported host-side serial communication.

The basic pattern is:

However, USB serial adapters vary widely.

Do not assume that every FTDI, CP210x, CH340 or vendor-specific adapter is automatically supported by the same class driver.

USB Hub Support

A physical hub can be useful for:

  • external power;
  • connecting multiple peripherals;
  • reducing load on the GIGA VBUS supply.

But software support for:

depends on the USB host stack.

Do not assume desktop-PC-style hub behaviour without testing your exact library and peripherals.

USB Host on M7 or M4?

The GIGA has two processor cores:

and USB-related hardware is a shared resource.

A host peripheral should have one clear core owner.

Do not initialise the same USB host controller independently from both cores.

A Good Dual-Core Architecture

For example:

This avoids hardware ownership conflicts.

USB Data Logging Architecture

A particularly good GIGA use case is:

This separates:

from:

Audio from a USB Drive

Arduino’s current AdvancedAnalog examples demonstrate:

using:

This is a useful example because it combines:

  • USB mass storage;
  • file I/O;
  • buffering;
  • DAC output.

USB-C Is Not the Same as USB-A Host

The two connectors have different normal roles.

USB-C

USB-A

If you plug a keyboard into the USB-C connector with a random passive adapter, you should not assume the software and hardware role automatically matches the USB-A host path.

Common Mistake 1: Forgetting PA15

Symptom:

Check:

Common Mistake 2: Using the Wrong Library for a Low-Speed Keyboard

If:

does not detect a basic keyboard or mouse, test the current:

library.

Remember that Arduino currently labels it ALPHA, so APIs may change.

Common Mistake 3: Expecting Any USB Drive Filesystem to Work

Use a simple FAT-formatted drive first.

Do not start troubleshooting host enumeration with a complex filesystem or encrypted drive.

Common Mistake 4: Drawing Too Much Current

If a USB device:

  • keeps reconnecting;
  • resets under load;
  • works only sometimes;

power can be the problem.

Use a powered hub for devices approaching or exceeding the USB-A current budget.

Common Mistake 5: Treating USB as UART

USB is not simply:

with a different connector.

The host must:

  • enumerate the device;
  • read descriptors;
  • select a class driver;
  • configure endpoints;
  • manage USB transfers.

Common Mistake 6: Assuming a USB Device Class Is Supported

Always check the host library before choosing hardware for a project.

A device may be:

but still unusable because:

Troubleshooting Checklist

Which Library Should You Start With?

USB device Starting point
Flash drive / mass storage Arduino_USBHostMbed5 + FATFileSystem
Low-speed keyboard USBHostGiga
Mouse USBHostGiga
USB serial USBHostGiga HostSerial where compatible
Unusual/vendor-specific device Check for a class-specific driver; custom work may be needed

Quick Reference

Final Thoughts

The GIGA R1 WiFi’s USB-A host port is a genuinely useful feature because it allows an Arduino-class board to connect directly to real USB peripherals.

The easiest applications are:

  • keyboard input;
  • mouse input;
  • USB flash-drive logging;
  • supported USB serial devices.

The important rules are:

For storage, start with Arduino_USBHostMbed5 and a FAT-formatted USB drive.

For low-speed keyboards and mice, Arduino’s newer USBHostGiga library is often the more appropriate route, but it is still currently labelled ALPHA.

For complex or vendor-specific USB devices, expect to investigate the device class and driver support rather than assuming the USB connector alone guarantees compatibility.

For the complete hardware mapping, see our Arduino GIGA R1 WiFi pinout guide. If you are dividing USB and real-time work between processors, see the GIGA R1 M7/M4 dual-core guide.

Share your love