2
votes

Hi members of stackoverflow.com!

I try to build an app in Android that can upload HEX file generated by avr-gcc. I installed the AndAVR this chaintool http://code.google.com/p/andavr/

to run avrdude (in root devices with USB-OTG cable) I use this command in mobile terminal:

/data/data/jackpal.androidterm/local/bin/avrdude -F -V -c arduino -p m2560 -P /dev/bus/usb/002/001  -b 115200 -C /data/data/jackpal.androidterm/local/etc/avrdude.conf -U flash:w:/sdcard/megademo/Blink1.cpp.hex

and after Read this post Android cannot talk to Arduino using AVRDUDE I try the solution and change the /dev/bus/usb/002/002 by /dev/ttyACM0.

/data/data/jackpal.androidterm/local/bin/avrdude -F -V -c arduino -p m2560 -P /dev/ttyACM0  -b 115200 -C /data/data/jackpal.androidterm/local/etc/avrdude.conf -U flash:w:/sdcard/megademo/Blink1.cpp.hex

But avrdude answer me with:

avrdude: ser_open(): can't open device "unkown". No such file or directory. 

I have a Arduino Mega 2560 and Mega ADK 2560 R3, both boards have a ATmega2560 microcontollers and I have a:

  • Samsumg Galaxy S2 run Android 4.1.2 stock with root
  • Samsumg Galaxy S3 run Android 4.1.2 stock with root
  • Samsumg Galaxy Tab Note 10.1 run Android 4.1.2 stock without root
  • Asus Transfomer Pad TF700T run Android 4.2.1 stock without root

the problem is that Samsung devices doesn't enumerate the Arduino board and the Asus tab yes.

In all devices I run the command in mobile terminal:

cat /proc/tty/drivers

and Asus present the specific driver:

ACM /dev/ttyACM 166 0-31 serial

this driver doesn't show in Samsung devices, well this driver is essential to upload the hex file to Arduino board, so How can I install this driver in Samsung devices? or how can I upload the hex file?

Android in all devices create a file in /dev/bus/USB/002/xxx where xxx is the Arduino board or other USB device.

Best regards!

1

1 Answers

1
votes

If you want to use this method, you need to load the cdc_acm kernel module - which probably was not supplied with your device, so you will have to build it. And then create the corresponding /dev/ttyACM0 device node, since the daemon that would do that on a desktop linux probably isn't there. You will need root to do these things, and moderately close kernel sources to compile from.

Another approach might be to implement CDC_ACM type communication in user mode from an Android app using the Android USB Host APIs if those are supported on your device. This would be a more "android style" solution, but would require some changes to avrdude, since it will have to do communication via an Android-aware backend service packaged in an app.

Also note that CDC_ACM is used by the recent arduinos (Uno, etc) and a minority of clones; older Arduino boards and the majority of clones use FTDI USB-serial converters and require ftdi driver modules or protocols.