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.
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)
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