Go Down

Topic: Problem w/ USB-Host Shield (Read 1 time) previous topic - next topic


I have a problem with my new usb host shield. I'm relatively new to the arduino platform, so I could use your help ;)

Here it is:
I've bought a shield (http://www.circuitsathome.com/products-page/arduino-shields/usb-host-shield-2-0-for-arduino) and assembled it. I also checked the solderings. But when I attach it to my Arduino, it just gives no response. This is the example sketch I am running:
Code: [Select]
#include <avr/pgmspace.h>
#include <avrpins.h>
#include <max3421e.h>
#include <usbhost.h>
#include <usb_ch9.h>
#include <Usb.h>
#include <usbhub.h>
#include <avr/pgmspace.h>
#include <address.h>
#include <hidboot.h>
#include <printhex.h>
#include <message.h>
#include <hexdump.h>
#include <parsetools.h>

class MouseRptParser : public MouseReportParser
virtual void OnMouseMove (MOUSEINFO *mi);
virtual void OnLeftButtonUp (MOUSEINFO *mi);
virtual void OnLeftButtonDown (MOUSEINFO *mi);
virtual void OnRightButtonUp (MOUSEINFO *mi);
virtual void OnRightButtonDown (MOUSEINFO *mi);
virtual void OnMiddleButtonUp (MOUSEINFO *mi);
virtual void OnMiddleButtonDown (MOUSEINFO *mi);
void MouseRptParser::OnMouseMove(MOUSEINFO *mi)
    Serial.print(mi->dX, DEC);
    Serial.print(" dy=");
    Serial.println(mi->dY, DEC);
void MouseRptParser::OnLeftButtonUp (MOUSEINFO *mi)
    Serial.println("L Butt Up");
void MouseRptParser::OnLeftButtonDown (MOUSEINFO *mi)
    Serial.println("L Butt Dn");
void MouseRptParser::OnRightButtonUp (MOUSEINFO *mi)
    Serial.println("R Butt Up");
void MouseRptParser::OnRightButtonDown (MOUSEINFO *mi)
    Serial.println("R Butt Dn");
void MouseRptParser::OnMiddleButtonUp (MOUSEINFO *mi)
    Serial.println("M Butt Up");
void MouseRptParser::OnMiddleButtonDown (MOUSEINFO *mi)
    Serial.println("M Butt Dn");

USB     Usb;
USBHub     Hub(&Usb);

uint32_t next_time;

MouseRptParser                               Prs;

void setup()
    Serial.begin( 115200 );

    if (Usb.Init() == -1)
        Serial.println("OSC did not start.");
    delay( 200 );
    next_time = millis() + 5000;

void loop()

The only output I get is the initial "Start".

I did a little research and found that the Method Usb.getUsbTaskState gives me an error code 19, which is related to an error called "USB_DETACHED_SUBSTATE_ILLEGAL".

I am working with an Arduino Mega (ATMega 1280) and the Arduino Library by "Circuits@Home" (https://github.com/felis/USB_Host_Shield_2.0).

I would be very grateful if you could help me!

PS: If you need more information, just tell me.
PPS: aaand forgive me if my english is bad -.-


There are lots of ways to configure that shield. How have you configured it (solder bridges)? Have you connected the ICSP header? Can you make a photo of your finished shield on place on the Mega and post it here?

I dont have anything configured at all ('cause I didn't find instructions). The ICSP-Pins are connected. Here is an image:


I did a little research and found that the Method Usb.getUsbTaskState gives me an error code 19, which is related to an error called "USB_DETACHED_SUBSTATE_ILLEGAL".

This at least means that a communication with the shield takes place (this is from a register value of 0x0C).

I dont have anything configured at all ('cause I didn't find instructions).

This is OK, because the standard configuration is for 5V and SS->pin10, INT->pin9, which seems to be the default for the Mega board anyway. On the picture you haven't connected anything to the shield. What kind of device are you testing with?


I've tested it with everything I could find here. USB-Sticks, Keyboards, Mice and my Android-Smartphone. Of course I used the example Sketches related to my device (Mass Storage, HID, ADK). But the error code appears always. Even if there is no device connected. As long as the shield is connected and powered up I get this error code.

Btw. Thanks for trying to help. You're the first one that does ;)



Have you tried board_qc sketch yet -> https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/board_qc/board_qc.pde . This is what I use to check the boards before shipping. Try it and post the results. You will see GPIO error - just skip it.


the result I get is the following:

Code: [Select]
Circuits At Home 2011
USB Host Shield Quality Control Routine
Reading REVISION register... Die revision invalid. Value returned: FF
Unrecoverable error - test halted!!
0x55 pattern is transmitted via SPI
Press RESET to restart test

But there is no error I could skip ;)


The SPI interface is not working, likely due to bad soldering of 2x3 header. You need to double-check the solder job here - remove the flux and use a magnifier. Also, check continuity between boards. If you have an oscilloscope, this article shows how to troubleshoot SPI on USB host shield -> https://www.circuitsathome.com/mcu/arduino/usb-shield/troubleshooting-arduino-usb-host-shield

Mhm. I checked the solderings. They are fine. The connection between the pins on the shield and the pins on the board are also established. So you are saying the shield's hardware is broken? or the ICSP on my Arduino?


I'm not saying it's broken. What I can see is SPI is not receiving, I can't say which direction is not working or even if a clock is reaching the MAX3421E, all I see is all ones instead on number 03. To troubleshoot further you need an oscilloscope with >10MHz BW.

You can send the shield back, I'll test it and replace it if defective. But I almost never see defective SPI and very often see bad soldering.

Mhm. Ya. Well I checked the solderings. If I'm not completely incompetent (which is possible, but I don't think so ;) ) the solderings are okay.
And since I neither have an oscilloscope nor am from America (Germany) I think I just have to accept that it doesn't work. -.- Maybe I'll try to send it back to my supplier (lipoly)..

Thanks for your help!


Hello !

I hope is not off-topic...

Can I use the UBSHost to control a function generator (i know it's  ASCII comands) with USB port with FT245 (like FT232) ?


Tim Stamp

I had this same problem, and after inspecting my soldering I notice I hadn't added a pin for the GND connection :)

Go Up