Mega ADK - Ubuntu 12.04 : Upload Error

Hi all..

I apologize in advance for the bad English, I'm Italian and I had to ask for help from San.Google

I recently bought an arduino MEGA ADK.

I have Ubuntu 12.04 on a PC.

I followed the guide in the preparation of google environment.

http://developer.android.com/tools/adk/adk2.html

Now the program Arduino IDE displays the following menu:

Tools -> type of arduino I find only "Google ADK2."

In the tools menu -> serial port'm just voice / dev/ttyUSB0

In the tools menu -> programmer I find only the voice SAM-BA

When I try to load the sketch "Blink" i see the following messages:

(My IDE is in Italian)

Dimensione del file binario dello sketch: 5.172 bytes (su un massimo di 524.288 bytes)
/home/mattia/ADK2012_IDE/hardware/tools/adk2install /home/mattia/ADK2012_IDE/hardware/tools/adk2tool ttyUSB0 /home/mattia/ADK2012_IDE/hardware/tools/bossac /tmp/build2794466990337209217.tmp/sketch_sep10a.cpp.bin
/home/mattia/ADK2012_IDE/hardware/tools/adk2tool /dev/ttyUSB0 erase
/home/mattia/ADK2012_IDE/hardware/tools/bossac --port=ttyUSB0 -w -b /tmp/build2794466990337209217.tmp/sketch_sep10a.cpp.bin
No device found on ttyUSB0
/home/mattia/ADK2012_IDE/hardware/tools/adk2tool /dev/ttyUSB0 reset

If I try to load it in verbose mode :

processing.app.debug.RunnerException
at processing.app.debug.BasicUploader.uploadUsingProgrammer(BasicUploader.java:222)
at processing.app.debug.BasicUploader.uploadUsingPreferences(BasicUploader.java:57)
at processing.app.Sketch.upload(Sketch.java:1699)
at processing.app.Sketch.exportApplet(Sketch.java:1658)
at processing.app.Sketch.exportApplet(Sketch.java:1630)
at processing.app.Editor$DefaultExportAppHandler.run(Editor.java:2389)
at java.lang.Thread.run(Thread.java:679)

I've tried several guides to resolve the problem but I did not get any results.

The arduino device on Ubuntu 12.04 should show as "/dev/ttyACM0". Insure your user is a member of the dialout group. This post shows how to check and change.
http://arduino.cc/forum/index.php/topic,122254.0.html

BTW, My IDE shows the Mega 2560/ADK as a standard selection in boards.

I forgot to mention, I do not use the IDE version from the Ubuntu repository. I downloaded IDE v1.0.1 from the Arduino site, unpacked it in a local directory, made a link to the arduino shell script in that directory, and moved the link to my desktop.

Hi SurferTim, and tanks for the reply..

Yes i am member of dialout group so i think that it's ok..

My IDE isn't from Arduino site or Ubuntu repository, but it is from Google ADK2 guide..

(Android Peripherals and Accessories  |  Android Open Source Project)

Now i tryed to download the IDE from Arduino site (v1.0.1 ) and i am able to upload the blink sketch ,

but i cant use google api to connect arduino with android..

.. because on upload i can see that errors :

/home/mattia/sketchbook/libraries/ADK2/v_vorbisfile.c: In function ‘ov_open’:
/home/mattia/sketchbook/libraries/ADK2/v_vorbisfile.c:800: error: ‘ftell’ undeclared (first use in this function)
/home/mattia/sketchbook/libraries/ADK2/v_vorbisfile.c:800: error: (Each undeclared identifier is reported only once
/home/mattia/sketchbook/libraries/ADK2/v_vorbisfile.c:800: error: for each function it appears in.)
/home/mattia/sketchbook/libraries/ADK2/v_vorbisfile.c: In function ‘ov_test’:
/home/mattia/sketchbook/libraries/ADK2/v_vorbisfile.c:822: error: ‘ftell’ undeclared (first use in this function)

ADK2/v_vorbisfile.c are libraries from google, and this is the ov_open function :

int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes){
  ov_callbacks callbacks = {
    (size_t (*)(void *, size_t, size_t, void *))  fread,
    (int (*)(void *, ogg_int64_t, int))              _fseek64_wrap,
    (int (*)(void *))                             fclose,
    (long (*)(void *))                            ftell
  };

  return ov_open_callbacks((void *)f, vf, initial, ibytes, callbacks);
}

And this is mi test sketch :

the 13^ led go up if the board is connected ( USB ) with the device..

#include "Arduino.h"
#include <ADK.h>

ADK L;

int led = 13; // led to blink when recive something
int led_status = 0; // set default led status

// ADK1 usb accessory strings
#define ACCESSORY_STRING_VENDOR "Google, Inc."
#define ACCESSORY_STRING_NAME   "DemoKit"
#define ACCESSORY_STRING_LONGNAME "DemoKit Arduino Board"
#define ACCESSORY_STRING_VERSION  "1.0"
#define ACCESSORY_STRING_URL    "http://www.android.com"
#define ACCESSORY_STRING_SERIAL "0000000012345678"

void adkPutchar(char c){Serial.write(c);}
extern "C" void dbgPrintf(const char *, ... );

void setup(void)
{

  delay(1000); // prevent serial error
  
  pinMode(led, OUTPUT);   
  
  L.adkSetPutchar(adkPutchar);
  L.adkInit();
  
  // set the old accessory strings
  L.usbSetAccessoryStringVendor(ACCESSORY_STRING_VENDOR);
  L.usbSetAccessoryStringName(ACCESSORY_STRING_NAME);
  L.usbSetAccessoryStringLongname(ACCESSORY_STRING_LONGNAME);
  L.usbSetAccessoryStringVersion(ACCESSORY_STRING_VERSION);
  L.usbSetAccessoryStringUrl(ACCESSORY_STRING_URL);
  L.usbSetAccessoryStringSerial(ACCESSORY_STRING_SERIAL);
  
  L.usbStart();
  
}

void loop()
{
  
  if (L.accessoryConnected()) {

      led_status = HIGH;   

  } else {
    
      led_status = LOW;
      
  }
  
  digitalWrite(led, led_status);
  
  L.adkEventProcess();
  
}

After some research I realized that i have to use the ADK's IDE to allow for the connection between Android and Arduino.

The problem remains, therefore, the following:

/home/mattia/ADK2012_IDE/hardware/tools/bossac --port=ttyUSB0 -w -b /tmp/build2794466990337209217.tmp/sketch_sep10a.cpp.bin
No device found on ttyUSB0

bossac cant find ttyUSB0...

In my /dev/ root there is not any ttyUSB0, but i can find a ttyACM0..

I tryed to create an Hard Link ( ln ttyACM0 ttyUSB0 ) in dev directory but it keeps giving me the same error..

There is nobody who is able to use Arduino ADK by connecting it to a Android Device via USB with google libraries?

Anyone who can give me some suggestions?

I'm having exactly the same problem as you!!! "no device found". I really hope someone can help us with this!!

My regular Arduino IDE works in Ubuntu. I think it has to do with the ADK IDE. Maybe where we are running it from (the home folder), maybe the version of java running the script? maybe Ubuntu is the problem maybe wwe should try another version of Linux?

Hi All..

I finally solved the problem ..

I opened a question in the forum in Italian and I have found the answers, this is the link

Arduino Forum.

My Arduino is a Mega ADK and so the corrects library are Google ADK 2011, then this is the guide to follow (Periferiche e accessori Android  |  Android Open Source Project) and not this (Android peripherals and accessories  |  Android Open Source Project).

I also recommend to follow this guide:

If you did everything correctly, after you create the file accessory_filter.xml, connecting arduino and the phone should open a window stating that the connection is ok.

alexDroid:
My regular Arduino IDE works in Ubuntu. I think it has to do with the ADK IDE. Maybe where we are running it from (the home folder), maybe the version of java running the script? maybe Ubuntu is the problem maybe wwe should try another version of Linux?

Ubuntu is ok as a system, just be sure to configure it properly for the correct version of ADK and see that it works.

Not all devices Andorid work with the ADK , for example :

My Desire Z with Andorid 2.3.3 does not work.

My asus eee pad does work.