Android cannot talk to Arduino using AVRDUDE

北慕城南 提交于 2019-12-30 07:14:12

问题


I am using AVRDUDE for Android (http://code.google.com/p/andavr/). I can compile the C code. I can run

$ avr-gcc -Os -DF_CPU=16000000UL -mmcu=atmega328p -c -o led.o led.c
$ avr-gcc -mmcu=atmega328p led.o -o led
$ avr-objcopy -O ihex -R .eeprom led led.hex

all without issues. Then I try to run:

avrdude -F -V -c arduino -p ATMEGA328P -P /dev/bus/usb/002/002  -b 115200 -C /data/data/jackpal.androidterm/local/etc/avrdude.conf -U flash:w:led.hex

The result is:

avrdude: ser_open(): can't open device "/dev/bus/usb/002/002"; Permission denied
loctl("TIOCMGET"): Invalid argument

avrdude done. Thank you.

The situation is similar when I run:

avrdude -F -V -c arduino -p ATMEGA328P -P /dev/bus/usb/002/001  -b 115200 -C /data/data/jackpal.androidterm/local/etc/avrdude.conf -U flash:w:led.hex

I can confirm that /dev/bus/usb/002/002 is the Arduino device connected with the OTG cable. Before connecting, I run

ls -l /dev/bus/usb/002/

and I get:

total 0

After I connect the Arduino via USB to my tablet I run the command:

ls -l /dev/bus/usb/002

and I get

crw-rw----   1 0   1018  180,128 Mar 24 07:53 001
crw-rw----   1 0   1018  180,129 Mar 24 07:53 002

This clearly shows me that the Arduino is connected. I would love to know if anyone can see what I am doing wrong.

PS: I am trying to create an Android application that allows Arduino programming directly from an Android tablet.


回答1:


It says 'permission denied' and you do not seem to be using a root shell. Try 'su' and then the command that failed. If your phone is not rooted, I don't think it could work.

I'm not even sure if it will work right when you are root, so please post the result! My guess is that it won't if your phone does not act as usb host (only some can)




回答2:


I'm not expert. But don't you need a USB shield for communicating with Arduino - Android via cables? Both are slaves (so when Android/Arduino are plugged into the PC, the PC controls it). Try USB Host Shield 2.0 For Arduino.

Again, I could be wrong. I hope this helps.



来源:https://stackoverflow.com/questions/15596376/android-cannot-talk-to-arduino-using-avrdude

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!