Arduino Due and ADK 2012

Ensure you selected the right com port and read above about the erase button.

Thanks Aleu!

It should be correct com port(Arduino Due programming port on PC). And I pressed the erase button before uploading.

It seems that Due was not recognized by ADK2012 IDE after erasing (erasing done).

IDE should prompt like below if it uploads successfully?
.....
Verify successful
Set boot flash true
CPU reset.

Hello, All
I did it!!!
I changed port to Native USB for uploading sketch into Due. Now I am enjoying the music from Nexus 7.

Thanks Aleu, Ardroid and all!!

Another question:
I just use left channel or right channel to DAC0. Is it possible to use both of left and right channel? Thanks.

Google's ADK2012 sample actually merge left/right channel into one and output to DAC0. Yes it is possible separate L/R to DAC0/1. I am thinking about actually doing so. However, I am currently woking on attaching bluetooth HCI module. I will let you know once it done.

-Kevin

jangofei:
Great! I have the following questions:

  1. Which Arduino IDE do you use? arduino-1.5.1r2? or adk2012_ide-win32-20120629?
  2. What app do you use on Nexus 7 to transfer data to Due?
  3. Is DC to supply power a must? Arduino Due can't work when I use a DC--3.3V & 2.0A. What DC do you use?
  1. Used ADK2012 IDE from Google
  2. This Terminal App, http://labs.arduino.cc/uploads/ADK/ArduinoTerminal/ThibaultTerminal_ICS_0001.apk
  3. You can use computer's USB power and I've tested 12V DC external power also. It works either way. (Arduino DUE has some issue with USBVSB (USB Master power control) That's why usbh.c needs to updated to work properly on DUE.

I appreciate your sharing! I couldn't do it if no your help. Is it possible to share BT if you have done? I am interested everything in ADK2012. Thanks.

Hi all,
I just confirmed upload of modified ADK2012 to DUE on both Mac and Win in my desk.
Mac:
Macbook Pro 10.6 with JDK 6 DUE: program port
Win:
Windows7 64bit DUE: native port (BOSSA Program port (COM**))
Thanks to aleu and jamgofei and all.

For 2ch playback, "process audio" in accessory.c seems starting point to understand and modify.
Never forget erase button :slight_smile:

Sho

Thanks your summary.

New question:
Can’t change the volume on Nexus 7 when output audio via MicroUSB. The default volume is max volume. Do you have any ideas about it? Thanks.

Not nearly impressive but I managed to get the ADK 2012 app and the 2011 DemoKit to recognize Kevin/ardroid's sketch. This might be handy to someone or it might be completely useless. Having a control app already developed might be useful to someone.

It is worth noting, however, that this is working with the default ADK implementation that comes with Arduino 1.5.1r2 and is missing pretty much every feature available in the ADK 2012 libraries (BT, LEDs, etc). Some work would need to be done to get this library working on a vanilla Due rather than the ADK device.

Changing the version number between 1.0 and 2.0 while keeping ACCESSORY_STRING_NAME set to "DemoKit" will allow you to use the 2011 and 2012 ADK test apps, if you so desire.

#include "Arduino.h"
#include "variant.h"
#include <stdio.h>
#include <adk.h>

// 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  "2.0"
#define ACCESSORY_STRING_URL    "http://www.android.com"
#define ACCESSORY_STRING_SERIAL "0000000012345678"

#define RCVSIZE 128

USBHost Usb;
ADK adk(&Usb,ACCESSORY_STRING_VENDOR,ACCESSORY_STRING_NAME,ACCESSORY_STRING_LONGNAME,ACCESSORY_STRING_VERSION,ACCESSORY_STRING_URL,ACCESSORY_STRING_SERIAL);

void setup(void)
{
  Serial.begin(115200);
  cpu_irq_enable();
  printf("\r\nADK demo start\r\n");
  delay(200);
}


void loop()
{
  uint8_t buf[RCVSIZE];
  uint32_t nbread = 0;
  char helloworld[] = "Hello World!\r\n";

  Usb.Task();
  
  if (adk.isReady()) {
    adk.write(strlen(helloworld), (uint8_t *)helloworld);
    
    delay(1000);
    
    adk.read(&nbread, RCVSIZE, buf);
    if (nbread > 0) {
      printf("RCV: ");
      for (uint32_t i = 0; i < nbread; ++i) {
        printf("%c", (char)buf[i]);
      }
      printf("\r\n");
    }
  }
}

If you're trying to duplicate the hardware for some reason, it might be worth checking this out.

Thanks.
Is it possible to output Audio from ADK2011 board?

Got following error when I compiled your code above on ADK2012 IDE or Arduino 1.5.1r2.

C:\Users\user\AppData\Local\Temp\build5437525985664053003.tmp\sketch_jan11a.cpp.o
sketch_jan11a.ino:4: fatal error: ADK.H: No such file or directory
compilation terminated.

It looks like it might be a file name issue. Try changing "ADK.H" to "adk.h". If that doesn't work, check your "hardware/arduino/sam/libraries/USBHost/" directory. If the "adk.h" exists, something else might be wrong.

Please pardon the ignorance, as I'm just now getting started with this piece of the Arduino world (ADK on Due).

I noticed that in ADK Archives | Arduino Blog the author mentions: "The ADK2012 is based on the upcoming Arduino Due platform" - This seems to imply that ADK2012 should be directly compatible with the Due... has this not proven to be true?

djjoshuad:
Please pardon the ignorance, as I'm just now getting started with this piece of the Arduino world (ADK on Due).

I noticed that in ADK Archives | Arduino Blog the author mentions: "The ADK2012 is based on the upcoming Arduino Due platform" - This seems to imply that ADK2012 should be directly compatible with the Due... has this not proven to be true?

I'm by no means an expert on that so someone with more knowledge of the matter should feel free to correct me.

The Due hardware is close to, if not exactly, identical to the ADK2012 kit if you take away all the bells and whistles. I've managed to get the Due working with the ADK2012 app, albeit with some latency issues. This is probably due to the 1.5.1r2 libs not supporting the newer ADK features.

The problem I've had, to my limited understanding, is that the version of the Arduino IDE that they're using for the ADK2012 resources doesn't take into account some of the quirks of the Due (eg. the 1200bps pulse prior to flashing). With the standard Arduino IDE (1.5.1r2), the libs are currently supporting the 2011 protocol. They're similar but there may be some extra functionality that will need to be added in. Trying to use Google's libs in the beta IDE fails since the ADK class names conflict and, fixing that, there's some issues with the conflicting of UOTGHS_Handler to be handled.

I know it's not meant to be exactly 1:1 functional with the ADK hardware but being able to use some of the functionality of that kit would be handy, especially the USB Audio parts. I've tried making some attempts at it but I don't know enough about the hardware to make any sort of real effort at porting all of the functionality over. Some idea about how the ADK libs function would be helpful to those of us wanting to attempt this.

Thanks for the reply. I may put some effort into this as well, although I'm (obviously) less in-the-know than you are. I have two Due boards on my bench that are just begging to become android-controlled thermostats for my house. There has been some great work done over at androidthermostat.com and while they have focused on the IOIO, I plan to port the accessory interface of their app to ADK2012 and (hopefully) the Due.

After doing a bit of digging around, it looks like a successful and familiar way to do this would be to use Processing for both the android side and the arduino side. Have you tried this combo or had any luck getting it to work?

Thanks. I resoved it. I should choose correct board--Arduino Due. Compiled successfully after I choosed board--Arduino Due.

Succeeded to upload your code into the Due. But the Nexus 7 or GS3 can't recognize the Due with ADK 2012/2011. Can you do it? Thanks.

The GS3 and the Nexus 7 can both recognize the Due with ADK 2012, I've tested with both. Are you running a custom ROM or kernel? Perhaps one that leaves out USB accessory mode?