Arduino Mega 2560 + Sparkfun USB Host Shield


hello,

i connect usb jostick arduino, don't success having usb working.
this simple code dosn't work (it write "error" serial) :

code: [select]

#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 test, after having tried quite lot of things, tried communicate directly max3421e chip via spi. communication works, success accessing general purpose pins, usb request, exemple sending control packet descriptor, returns "0x03" error in hsrlt register (wich should mean "reserved" ???).

thanks help.

stéphane.

hello,

i have usb init working !

the problem in usb.h file. line 61 indicates "official arduinos", including mega, ss pin #10, , reset pin #9. in case, "official" ss pin (even if else) #53, , pluged reset pin #42.

so after update, have init working :

code: [select]

#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 work configuration, can modify in future if necessary.

stéphane


Arduino Forum > Using Arduino > Networking, Protocols, and Devices (Moderator: fabioc84) > Arduino Mega 2560 + Sparkfun USB Host Shield


arduino

Comments

Popular posts from this blog

CS5 Adobe Media Encoder: Encode failed because the source duration is nil.

cf_sql_integer vs cf_sql_bigint vs cf_sql_int??

localhost/joomla15/administrator doesnt work - Joomla! Forum - community, help and support