The Arduino GIGA R1 WiFi includes something that most Arduino boards do not:
|
1 2 3 4 |
a dedicated USB-A host port |
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:
|
1 2 3 4 5 6 7 8 9 |
USB-C → programming → USB device / peripheral role USB-A → USB host role |
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:
|
1 2 3 4 5 6 7 8 |
PC → host Arduino → device |
With the GIGA USB-A port, the roles change:
|
1 2 3 4 5 6 7 8 |
GIGA → host keyboard / mouse / USB drive → device |
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:
|
1 2 3 4 |
PA15 |
The current Arduino board variant also maps this internal signal as:
|
1 2 3 4 5 |
D92 → USB HOST ENABLE |
Official GIGA examples typically enable host power with:
|
1 2 3 4 5 |
pinMode(PA_15, OUTPUT); digitalWrite(PA_15, HIGH); |
Without host power, a connected USB device may not enumerate at all.
USB Host Power Example
|
1 2 3 4 5 6 7 8 9 10 |
void setup() { pinMode(PA_15, OUTPUT); digitalWrite(PA_15, HIGH); } void loop() { } |
This powers the VBUS side of the USB-A connector.
USB-A Current Limit
Arduino documents an approximate USB host current limit of:
|
1 2 3 4 |
500 mA |
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:
|
1 2 3 4 5 6 |
GIGA USB-A → powered USB hub → peripheral |
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:
|
1 2 3 4 |
host output |
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:
|
1 2 3 4 |
USBHostGiga |
specifically to address limitations with low-speed USB devices such as many keyboards and mice.
Arduino currently labels this library:
|
1 2 3 4 |
[ALPHA] |
and warns that its API is minimal and subject to change.
Why Keyboard Support Can Be Confusing
Many simple USB keyboards operate as:
|
1 2 3 4 5 |
USB Low Speed 1.5 Mbit/s |
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:
|
1 2 3 4 |
USBHostGiga |
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:
|
1 2 3 4 5 6 7 |
#include "USBHostGiga.h" Keyboard keyb; HostSerial ser; |
and starts the keyboard with:
|
1 2 3 4 |
keyb.begin(); |
Minimal Keyboard Sketch
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
#include "USBHostGiga.h" Keyboard keyboard; void setup() { Serial.begin(115200); pinMode(PA_15, OUTPUT); digitalWrite(PA_15, HIGH); keyboard.begin(); } void loop() { if (keyboard.available()) { auto event = keyboard.read(); char c = keyboard.getAscii(event); if (c) { Serial.print(c); } } } |
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:
|
1 2 3 4 |
Mouse |
class.
The basic pattern is:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
#include "USBHostGiga.h" Mouse mouse; void setup() { pinMode(PA_15, OUTPUT); digitalWrite(PA_15, HIGH); mouse.begin(); } void loop() { if (mouse.available()) { auto event = mouse.read(); // inspect movement/buttons } } |
A mouse normally reports:
- X movement;
- Y movement;
- wheel movement;
- button states.
USB Flash Drives
For USB mass storage, the common GIGA approach uses:
|
1 2 3 4 5 6 |
Arduino_USBHostMbed5 FATFileSystem USBHostMSD |
This lets the GIGA mount a normal FAT-formatted USB flash drive and access files.
Required Includes for USB Storage
|
1 2 3 4 5 6 |
#include <Arduino_USBHostMbed5.h> #include <DigitalOut.h> #include <FATFileSystem.h> |
Create the mass-storage and filesystem objects:
|
1 2 3 4 5 |
USBHostMSD msd; mbed::FATFileSystem usb("usb"); |
Connect the USB Drive
First enable host power:
|
1 2 3 4 5 |
pinMode(PA_15, OUTPUT); digitalWrite(PA_15, HIGH); |
Then wait for the storage device:
|
1 2 3 4 5 6 |
while (!msd.connect()) { delay(100); } |
Mount the Filesystem
|
1 2 3 4 5 6 7 8 9 10 11 |
int err = usb.mount(&msd); if (err) { Serial.print("Mount failed: "); Serial.println(err); while (1); } |
Once mounted, normal C-style file access can be used through the mounted path.
Complete USB Flash Drive Example
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
#include <Arduino_USBHostMbed5.h> #include <DigitalOut.h> #include <FATFileSystem.h> USBHostMSD msd; mbed::FATFileSystem usb("usb"); void setup() { Serial.begin(115200); while (!Serial) { } pinMode(PA_15, OUTPUT); digitalWrite(PA_15, HIGH); Serial.println("Insert USB drive"); while (!msd.connect()) { delay(100); } int err = usb.mount(&msd); if (err) { Serial.println("USB mount failed"); while (1); } Serial.println("USB drive mounted"); } void loop() { } |
Writing a File to USB
Once mounted, a normal pattern is:
|
1 2 3 4 5 6 7 8 9 10 |
FILE *file = fopen("/usb/data.txt", "w"); if (file) { fprintf(file, "GIGA USB test\n"); fclose(file); } |
This makes USB flash drives useful for:
- data logging;
- configuration files;
- CSV export;
- audio files;
- firmware/assets;
- large captured datasets.
Reading a File
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
FILE *file = fopen("/usb/data.txt", "r"); if (file) { int c; while ((c = fgetc(file)) != EOF) { Serial.write(c); } fclose(file); } |
Always Close Files
USB storage is not the same as writing to RAM.
Always:
|
1 2 3 4 |
fclose(file); |
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:
|
1 2 3 4 |
FATFileSystem |
so a FAT-formatted USB drive is the simplest option.
Do not assume:
|
1 2 3 4 5 6 7 |
NTFS APFS ext4 exFAT |
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:
|
1 2 3 4 5 |
USB plug fits → therefore Arduino can use device |
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:
|
1 2 3 4 |
HostSerial |
class for supported host-side serial communication.
The basic pattern is:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
HostSerial usbSerial; void setup() { usbSerial.begin(); } void loop() { while (usbSerial.available()) { Serial.write( usbSerial.read() ); } } |
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:
|
1 2 3 4 5 6 7 8 |
hub + multiple downstream devices + multiple USB classes |
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:
|
1 2 3 4 5 |
M7 M4 |
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:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
M7 → USB host → filesystem → UI → Wi-Fi M4 → sensors → motors → CAN RPC → exchange commands/data |
This avoids hardware ownership conflicts.
USB Data Logging Architecture
A particularly good GIGA use case is:
|
1 2 3 4 5 6 7 8 9 10 11 |
M4 → acquire sensors → process data → send blocks through RPC M7 → receive blocks → write to USB flash drive |
This separates:
|
1 2 3 4 |
time-critical acquisition |
from:
|
1 2 3 4 |
slow filesystem writes |
Audio from a USB Drive
Arduino’s current AdvancedAnalog examples demonstrate:
|
1 2 3 4 5 6 7 |
USB flash drive → FAT filesystem → WAV file → GIGA DAC |
using:
|
1 2 3 4 5 6 |
Arduino_USBHostMbed5 Arduino_AdvancedAnalog FATFileSystem |
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
|
1 2 3 4 5 6 7 |
programming power serial USB device / HID |
USB-A
|
1 2 3 4 5 6 |
USB host powers peripheral enumerates peripheral |
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:
|
1 2 3 4 5 6 |
USB device does nothing no LED no enumeration |
Check:
|
1 2 3 4 5 |
pinMode(PA_15, OUTPUT); digitalWrite(PA_15, HIGH); |
Common Mistake 2: Using the Wrong Library for a Low-Speed Keyboard
If:
|
1 2 3 4 |
Arduino_USBHostMbed5 |
does not detect a basic keyboard or mouse, test the current:
|
1 2 3 4 |
USBHostGiga |
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:
|
1 2 3 4 5 |
RX TX |
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:
|
1 2 3 4 |
electrically valid USB |
but still unusable because:
|
1 2 3 4 |
no class driver exists |
Troubleshooting Checklist
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
1. Confirm GIGA is powered normally. 2. Confirm device is plugged into USB-A. 3. Enable PA15 host power. 4. Check the peripheral's current requirement. 5. Try a simple known-good device. 6. Use the correct host library. 7. For storage, use FAT first. 8. Check Serial Monitor output. 9. Avoid hubs until direct connection works. 10. Do not let both M7 and M4 own USB. |
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
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
Arduino GIGA R1 WiFi USB Host Host connector: USB-A Device/programming connector: USB-C Host power enable: PA15 internal D92 Enable: pinMode(PA_15, OUTPUT); digitalWrite(PA_15, HIGH); Host current: approximately 500 mA Mass storage: Arduino_USBHostMbed5 USBHostMSD FATFileSystem Keyboard/mouse: USBHostGiga currently ALPHA Keyboard API: Keyboard.begin() Keyboard.available() Keyboard.read() Keyboard.getAscii() Mouse API: Mouse.begin() Mouse.available() Mouse.read() Storage connection: msd.connect() Filesystem: usb.mount(&msd) USB host should be owned by one processor core. |
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:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
USB-A → host USB-C → programming/device PA15 HIGH → enables host power 500 mA → approximate host current limit USB device support → depends on class driver/library |
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.