Pages: [1]   Go Down
Author Topic: Arduino Mega 2560 + Sparkfun USB Host Shield  (Read 1279 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

I would like to connect a USB jostick to my Arduino, but I don't success having USB working.
This very simple code dosn't work (it always write "Error" to the serial) :

Code:
#include <Usb.h>

USB usb;

void setup() {
  Serial.begin(9600);
 
  if(usb.Init() == -1) {
    Serial.println("Error");
  } else {
    Serial.println("OK");
  }
}

void loop() {
}

Any suggestion ?

In addition to this test, after having tried quite a lot of things, I tried to communicate directly to the MAX3421E chip via SPI. The communication works, I success accessing the general purpose pins, but any USB request, for exemple sending a control packet to get the descriptor, returns "0x03" error in HSRLT register (wich should mean "reserved" ???).

Thanks for your help.

Stéphane.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

I have now a usb init working !

The problem was in Usb.h file. Line 61 indicates that for "Official Arduinos", including Mega, the SS pin is #10, and RESET pin is #9. In my case, the "official" SS pin (even if it could be something else) is #53, and i pluged RESET to pin #42.

So after this update, I have the init working :

Code:
#ifdef BOARD_BLACK_WIDDOW
typedef MAX3421e<P6, P3>                MAX3421E;               // Black Widow
#elif defined(BOARD_TEENSY_PLUS_PLUS)
typedef MAX3421e<P9, P8>        MAX3421E;       // Teensy++ 2.0 & 1.0
#elif defined(BOARD_MEGA_ADK)
typedef MAX3421e<P53, P54>              MAX3421E;               // Arduino Mega ADK
#else
// typedef MAX3421e<P10, P9>            MAX3421E;               // Official Arduinos (UNO, Duemilanove, Mega, 2560  <<--- Modified line
typedef MAX3421e<P53, P42>              MAX3421E;               // Official Arduinos (UNO, Duemilanove, Mega, 2560
#endif

This code now will only work with my configuration, but I can modify it in the future if necessary.

Stéphane
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey,

I have changed the part <P10,P9> to <P53,P9>

1. Is keeping the P9 wrong?

I am currently not getting the required output with the P9 still in place.

Currently getting:


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



2. Oleg's code states that P9 is the INT pin. What is the INT pin? Where is it located on the Mega 2560?

Logged

Pages: [1]   Go Up
Jump to: