Arduino Due and ADK 2012

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?

djjoshuad:
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?

I use stock rom with rooted.
The GS3/Nexus 7 recognized the Due as "connected to a USB accessory". But ADK 2012 couldn't recognize the Due.
Connection:
PC-->USB Cable-->Programming Port on Due
Nexus 7/GS3-->USB Cable-->OTG-->Native Port on Due.

In that case it must be the way the Due is representing itself. What sketch have you loaded on the Due?

djjoshuad:
In that case it must be the way the Due is representing itself. What sketch have you loaded on the Due?

ADK 2012 should recognize the Due on Nexus 7. But waited a long time more than 5 minutes, ADK 2012 could not start correctly, it was forced stopped.
GS3 still could not recoginze the Due. I have loaded the sketch from Ardroid on this post.

ADK2012 is looking for a specific device, namely the ADK demo board that they handed out at I/O. The device identifies itself by sending strings to android. If you use the constants in the example from mikepparks, adk2012 should "see" the board... although of course none of the testing features will work by default since none of those circuits exist (unless you put them there).

amberjack1394:
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.

Why don't the mac/windows tools use the same port for programming?

they do. rather, they can. This is just how he did it.

I have my Due working with sound from a Galaxy Nexus but the quality is pretty poor. I put a 1KHz tone on my phone and played it through the Due and it quickly becomes apparent that there is something wrong. There are gaps in the audio which don't seem to be periodic. On the scope I see small gaps about a millisecond long. The gaps happen about every 100msec (or so). After the gap, the output continues at the same voltage which makes me think the dac might be sending the same value during the gap until more data is available. Anyone else observe this?

nwscfox1:
I have my Due working with sound from a Galaxy Nexus but the quality is pretty poor. I put a 1KHz tone on my phone and played it through the Due and it quickly becomes apparent that there is something wrong. There are gaps in the audio which don't seem to be periodic. On the scope I see small gaps about a millisecond long. The gaps happen about every 100msec (or so). After the gap, the output continues at the same voltage which makes me think the dac might be sending the same value during the gap until more data is available. Anyone else observe this?

Can you control volume when audio out via Due? I could not adjust volume when output audio via Due.

The volume over the usb seems to be fixed but there is a line in the code on Due that claims to be a volume adjustment; after combining the left and right channel, they multiply by a value and the comment is something about volume adjustment.

ardroid:

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.

When use ADK2012 IDE for Due, do you copy board definition from Arduino IDE 1.5.1 to ADK2012 IDE? Since pin array of Arduino Due is different from Google ADK2. For example, Blink sketch will not blink LED if you choose board Google ADK2, because Google ADK2 define PC9 as pin 13, Arduino Due use PB27 as pin 13. I copy directory hardware/arduino/sam/variants/arduino_due_x from Arduino IDE 1.5.2 to ADK2012 IDE and select it as board, but some errors happen during compiling. Do you know have any idea or experience about this issues? Thanks.

I am in the same boat as lier. Can someone describe the process for compiling and uploading sketches from the ADK 2012 IDE to the Due? Uploading from Arduino IDE works fine for me but not the ADK.

Hi,

I am trying the ADK2012 code on Due and facing the following Compiling Error. I saw someone mention the problem, but could not find a way to resolve it.

"C:\Users\xyz\Desktop\arduino-1.5.2-windows\arduino-1.5.2\hardware\arduino\sam\variants\arduino_due_x/libsam_sam3x8e_gcc_rel.a(uotghs.o): In function UOTGHS_Handler': uotghs.c:(.text.UOTGHS_Handler+0x0): multiple definition of UOTGHS_Handler'
ADK2\usbh.c.o:C:\Users\xyz\Desktop\arduino-1.5.2-windows\arduino-1.5.2\libraries\ADK2/usbh.c:684: first defined here
collect2: ld returned 1 exit status"

So, did anyone got around the UOTGHS_Handler conflict yet?
I was able to compile and upload just fine with the ADK2012 IDE version, but not with 1.5.2
I had to use the native port, which requires me to press erase before the upload and also requires me to disconnect the usb cable to plug the OTG cable.
I'd love to be able to upload through the programming port instead and use bossac instead of adk2install.
So, if anyone was able to get around the UOTGHS_Handler issue, please let me know or pm me.
Thanks in advance.

Ok, I just wanted to post my progress.
I was able to compile and upload the terminal code posted on the original thread to a Due board using IDE 1.5.2 using the programming port.
The original ADK2012 IDE required the native port.
After digging for a few days and comparing with the Google released ADK2012, I realized the problem is with the arduino reset code built-in on the libs to erase the flash when native port is used for programming (AKA open serial at 1200bps).
By having this code enabled all the time will disable the native port from ever being able to act as OTG port.
But the trick is that if this code is not enabled, you won't be able to erase flash and upload using native port on a single shot. You will need to press the ERASE button.
In my case, I'm never planning on using the native port for uploading code anyway, so my solution works out great for me.
My solution was to create a new board reference in the boards.txt file and remove the flags for the CDC serial on native port.

New_Board.name=My Own Board
New_Board.upload.tool=bossac
New_Board.upload.protocol=sam-ba
New_Board.upload.maximum_size=524288
New_Board.upload.use_1200bps_touch=true
New_Board.upload.wait_for_upload_port=false
New_Board.upload.native_usb=false
New_Board.build.mcu=cortex-m3
New_Board.build.f_cpu=84000000L
New_Board.build.core=arduino
New_Board.build.extra_flags=-D__SAM3X8E__ -mthumb
New_Board.build.ldscript=linker_scripts/gcc/flash.ld
New_Board.build.variant=arduino_due_x
New_Board.build.variant_system_lib=libsam_sam3x8e_gcc_rel.a

And add an ifdef on the USBCore.cpp to disable the CDC code.

#ifdef USBCON

Original USBCore.cpp code goes inside the ifdef. I can't add or the post is too long and exceeds the maximum allowed length of forum, which is 9500 characters.

#endif // USBCON

Thanks for your post, its really helpful for a newbie like me. I just need to know how did you connect speaker. I have this speaker as shown in the attached image. Can I directly connect it to DAC0 and GND pins of Arduino? if not please suggest.

image (1).jpeg

DO NOT connect directly your speaker to the DAC pin.
Please, read and follow the following updated tutorial.

Regards!