🛠 USB host MAX3421E : diagnostic et pièges d'alimentation

Arduino Mega ADK (Rev3) · avance · Schéma : IMG-mega-adk-avance-1-mega-adk-usb-host-max3421e.svg — Chaîne d'alimentation : USB 500 mA partagé vs alimentation externe 1,5 A, polyfuse 500 mA du port USB-A, puce MAX3421E et broche 7 réservée (RST)

Objectives

Understand and troubleshoot the USB host part of the board: the MAX3421E controller (Maxim/Analog Devices) soldered onto the board, connected to the ATmega2560 SPI bus (MISO 50, MOSI 51, SCK 52, SS 53 + ICSP pin), with a USB-A port protected by a 500 mA resettable polyfuse. We cover the three classic pitfalls: the "OSCOKIRQ failed to assert" error, the reset pin conflict (D7 vs PJ2), and the power budget when connecting real peripherals.

Verified facts and open conflict: the official page states that the MAX3421E RST is on digital pin 7 ("do not use Digital pin 7"), while the USB Host Shield 2.0 library maps BOARD_MEGA_ADK with MAX_RESET on PJ2 and INT on PE6, commenting "These pins are not broken out on the Arduino ADK". Do not wire anything to these functions yourself; follow the official schematic for your revision.

Hardware

Complete Code

// mega-adk-usb-host-diagnostic.ino — Board: "Arduino Mega ADK"
// Diagnostic minimal du MAX3421E : init, révision, puis scan d'adresse.
#include <Usb.h>
#include <usbhub.h>

USB Usb;

void setup {
  Serial.begin(115200);
  delay(1000);                       // laisser l'auto-reset DTR se calmer
  Serial.println(F("== Diagnostic MAX3421E =="));
  if (Usb.Init == -1) {
    Serial.println(F("OSCOKIRQ failed to assert"));
    Serial.println(F("-> MAX3421E muet : verif. alim 3,3V interne, broche 7"));
    Serial.println(F("   occupee par un montage, ou variant de broches (PJ2)"));
    while (1);
  }
  Serial.print(F("MAX3421E revision = "));   // le chip répond : SPI OK
  Serial.println(Usb.getRevision, HEX);
  Serial.println(F("Host OK. Branchez un peripherique USB-A."));
}

void loop {
  Usb.Task;
  static uint8_t etatPrecedent = 0xFF;
  if (Usb.getUsbTaskState != etatPrecedent) {
    etatPrecedent = Usb.getUsbTaskState;
    Serial.print(F("Etat USB (tache) = 0x"));
    Serial.println(etatPrecedent, HEX);
  }
}

Expected Verification

Without a device: "Host OK" followed by a stable USB task state (host waiting). With a flash drive or keyboard: the console traces a state change when enumeration starts. In case of OSCOKIRQ, the test is binary: either the internal 3.3 V has collapsed (external power supply too low, short circuit on 5V/3V3), or the chip is not selected (wrong pin mapping according to the library), or it is dead. Reminder: never back-power via the 5V/3.3V pins, "can damage your board".

Common Errors

  1. OSCOKIRQ failed to assert interpreted as a software bug: it is almost always hardware — the MAX3421E crystal not starting, a dead chip, or pin 7 hijacked by a shield or wire.
  2. Forgetting that the MAX3421E permanently occupies the shared SPI bus: an SD card reader or any SPI device requires deselecting the USB host during your transfers, otherwise data will be corrupted on both sides.
  3. Powering the board via USB while charging a phone on the host port: 500 mA for everyone; the announced budget of 1.5 A (750 + 750) assumes an external power supply ≥ 1.5 A.
  4. Input > 12 V "because it works": the linear regulator heats up and eventually shuts down; the recommended range is 7–12 V (limits 6–20 V).
  5. Tripped polyfuse mistaken for a permanent failure: the USB-A port cuts out on overcurrent and then resets; unplug the short-circuited device and wait a few seconds.
  6. Standard USB host shield examples compiled as-is: the SS is PB4 (D10) in them, whereas the ADK wires the MAX3421E differently — always select the library's board variant.

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials