1

i'm trying to communicate with Arduino board (Duemilanove) from Android 3.1 device with USB-host support using Android USB Host API.

The goal is to communicate with the board in the same way as via Serial.

I follow this manual (http://android.serverbox.ch/?p=427) but have few problems (f.e. failed to claim interface) and of coarse dev guide (http://developer.android.com/reference/android/hardware/usb/package-summary.html) but no luck.

The questions are:

  1. how to prepare arduino board (modify firmware) - interruptions or smth?
  2. how to check if it's okay with arduino board (f.e. enumerate USB interfaces and verify that it supports needed. what tools can be used?
  3. how to find needed interface (what are interface class/protocol/subclass)
  4. what can be the reason when interface cannot be claimed? (faced with that)
4ntoine
  • 19,816
  • 21
  • 96
  • 220

1 Answers1

0
  1. The arduino Duemilanove board has only a build in FTDI FT232RL USB serial converter. So you don't have to deal with the USB device side. From the AVR controller point of view it is simply an asynchronous serial port. Find out to which UART it is connected to and use it. Maybe you want to implement a simple echo (transmit all received characters again) as a first test.

  2. Use lsusb command under linux to check out the usb device descriptor.

  3. Read about USB in USB in a nutshell or in the official specification to find out how it works (especially chapter 9). Without doing so you can't go on. You would not understand anything. Then go on and read about CDC class devices in the usb class section.

  4. It might not exist (if you rely on the interface index without checking the device descriptor) or the android kernel has claimed the interface because there is a native driver for that interface. In this case you can call UsbDeviceConnection.claimInterface with true as second argument to disconnect the kernel driver first.

Alexander
  • 1,068
  • 6
  • 22
  • This is an answer in terms of traditional linux USB, not in terms of the unique Android Host APIs that the question asks about. – Chris Stratton Feb 06 '13 at 15:51
  • Android to arduino communication is much simpler using bluetooth module HC 05, if that is ok for you then here is the code example given in the article posted http://stackoverflow.com/a/30275750/526438 – Sadanand May 16 '15 at 12:37