与Arduino的Andr​​oid电子通讯 [英] Communicating with Arduino from Android

查看:144
本文介绍了与Arduino的Andr​​oid电子通讯的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图采用Android USB主机API与Arduino板(Duemilanove)的安卓3.1设备与USB主机支持进行交流。

的目标是与板相同的方式,经由串行通信。

我要按照本手册( http://android.serverbox.ch/?p=427),但有几个问题(FE没有权利要求接口)和粗开发指南(的 http://developer.android.com/reference/android/hardware/usb/package-summary.html ),但没有运气。

的问题是:

  1. 如何prepare Arduino板(修改固件) - 中断或不服
  2. 如何检查它的好与Arduino板(FE枚举USB接口并验证其是否支持必要的。什么工具可以用?
  3. 如何找到需要的接口(什么是接口类/协议/子)
  4. 在什么可以当不能声称接口的原因是什么? (面临着)
解决方案
  1. Arduino的Duemilanove板上只有一个建立在FTDI FT232RL USB串口转换器。所以你不必处理USB设备端。从看AVR控制点那简直就是一个异步串行口。找出哪些UART它连接到并使用它。也许你想实现一个简单的echo(再次发送接收到的字符)作为第一个测试。

  2. 使用的的lsusb 的linux下的命令检查出的USB设备描述符。

  3. 了解更多关于USB 在USB简而言之或的在官方规范找出它是如何工作(特别是第9章)。如果不这样做,你不能去。你不会明白的事情。 然后去和阅读CDC类设备在USB类部分

  4. 这可能不存在(如果你依赖的接口索引,而不检查设备描述符)或Android的内核声称该接口,因为有该接口一个本地驱动程序。在这种情况下,您可以拨打 UsbDeviceConnection.claimInterface 与真正的第二个参数先断开内核驱动程序。

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)

解决方案

  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.

这篇关于与Arduino的Andr​​oid电子通讯的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆