scan-hote-usb.ino
Thanks to the MAX3421E, the Mega ADK speaks USB as a host to a peripheral — the reverse of its usual target role. This scan prints the VID/PID of whatever you plug into the USB-A port: step one before any driver.
Hardware required
An Arduino Mega ADK Rev3 (ATmega2560 + MAX3421E USB host chip with a Type-A port; digital pin 7 is reserved for the MAX3421E reset). 1 low-power 5 V USB device (USB stick, mouse, second Arduino in bootloader…).
Wiring
Nothing: the device plugs straight into the USB-A port; never use pin D7 (MAX3421E reset).
How it works
Usb.Init starts the host controller; the USB state machine enumerates the device and getDevDescr exposes its vendor/product id. Select « Arduino Mega ADK » in the IDE. For USB host/ADK work, install the USB Host Shield 2.0 library; do not use D7. The USB-A port powers the accessory at 5 V.
Going further
Once you know the VID/PID, look up the device class (HID, storage…) in the USB Host Shield 2.0 docs for the matching driver.
scan-hote-usb.ino
// Inversion de role : la Mega ADK devient maitre USB (MAX3421E).
// Bibliotheque : USB Host Shield 2.0 (Arduino IDE > Gestionnaire).
#include <Max3421e.h>
#include <Usb.h>
USB Usb;
void setup() {
Serial.begin(115200);
while (!Serial);
if (Usb.Init() == -1) { Serial.println(F("MAX3421E introuvable")); while (1); }
Serial.println(F("Hote USB pret (D7 reserve au reset MAX3421E)"));
}
void loop() {
uint8_t etat = Usb.getUsbTaskState();
if (etat == USB_STATE_RUNNING) {
USB_DEVICE_DESCRIPTOR dev;
Usb.getDevDescr(); // remplit devDesc
Serial.print(F("Appareil actif VID=0x"));
Serial.print(devDesc.idVendor, HEX);
Serial.print(F(" PID=0x"));
Serial.println(devDesc.idProduct, HEX);
} else {
Serial.print(F("Etat USB: 0x"));
Serial.println(etat, HEX);
}
delay(2000);
}