C
C
constv2012-09-11 20:05:44
Arduino
constv, 2012-09-11 20:05:44

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.
I'm running a test sketch
#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
"StartError: OSCOKIRQ failed to assert" exception.
I ask those who have come across this host or are competent in this area to suggest how to “make friends” this host with the Arduino Mega 2560.
Thank you in advance!

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Alexey Zhurbitsky, 2012-09-11
@blo

Which USB Host Shield Library is being used. 1.0 or 2.0 ?

C
constv, 2012-09-12
@constv

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

And with Samsung Galaxy S (I9000) official firmware 2.3.6 kernel version 2.6.35.7:
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

As I understand it, Tab is recognized and starts reading messages, but there are problems with Galaxy S.
Please explain what is wrong with Galaxy S, how to deal with it?

C
constv, 2012-09-12
@constv

I also forgot to write that the mega was powered from the power supply

C
constv, 2012-09-12
@constv

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 question

Ask a Question

731 491 924 answers to any question