Answer the question
In order to leave comments, you need to log in
Problem connecting usb host shield to Ardiuno Mega 2560?
Hello!
I have Usb host shield and Arduino Mega 2560 . There were problems connecting a bunch of devices Usb host shield+Arduino Mega 2560+Samsung Galaxy S (official firmware 2.3.6). The fact is that the description on the website of the host manufacturer, it seems to me, is not true, namely,
It's compatible with almost Arduinos – not only UNO and Duemilanove, but also big Mega and Mega 2560 work with Standard variant of this shield out of the box. No more SPI re-wiring and code modifications – just solder included stackable connectors (2×3 ICSP connector's female side should be facing down), plug and play!, just copies the description from the site , although the boards are different. As a result, following the instructions in the wiki on the manufacturer's website, it is not possible to make friends with all three devices.
#include <Max3421e.h>
#include <Usb.h>
#include <AndroidAccessory.h>
AndroidAccessory acc("Google, Inc.",
"DemoKit",
"DemoKit Arduino Board",
"1.0",
"http://www.android.com",
"0000000012345678");
void setup();
void loop();
void setup()
{
Serial.begin(115200);
Serial.print("\r\nStart");
acc.powerOn();
}
void loop()
{
byte msg[3];
if (acc.isConnected()) {
Serial.print("Accessory connected. ");
int len = acc.read(msg, sizeof(msg), 1);
Serial.print("Message length: ");
Serial.println(len, DEC);
}
delay(100);
}
, but I don't see anything in the Serial Monitor except for the Answer the question
In order to leave comments, you need to log in
There are successes, in order:
1. I connected the board as shown in the pictures in the blo article , except that I did not bend the legs of TX and RX.
2. I took the libraries from ADK_release_0512 (it didn’t “start” with others)
. Now, about the results on the example of the sketch that I gave above, I have the following log in the Serial Monitor:
With Samsung Galaxy Tab 7.7 (P6800) official firmware 3.2 kernel version 2.6.36:
Device addressed…Requesting device descriptor.
found possible device. swithcing to serial mode
device supports protocol 1
Setup packet error: D
Device addressed… Requesting device descriptor.
found android accessory device
config desc
interface desc
interface desc
C
D
Accessory connected. Message length: -1
Accessory connected. Message length: -1
Accessory connected. Message length: -1
Device addressed…Requesting device descriptor.
found possible device. swithcing to serial mode
Data packet error: 5could not read device protocol version
Device addressed… Requesting device descriptor.
Setup packet error: D
Device descriptor cannot be retrieved. Trying again
and another addition, I forgot to indicate that I corrected the setup function, after reading the wiki on the board, it didn’t work without it, now it looks like this
void setup()
{
pinMode(7, OUTPUT);
digitalWrite(7, LOW);
delay(300);
digitalWrite(7, HIGH);
Serial.begin(115200);
Serial.print("\r\nStart");
acc.powerOn();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question