Android 4.2.2: Arduino connected to OTG port detected as media device instead of USB accessory

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Android 4.2.2: Arduino connected to OTG port detected as media device instead of USB accessory

2,871 Views
fabiof
Contributor IV

Hi

I'm working with the latest freescale android version 4.2.2 on a custom board with i.MX6DL. Every time I tried to connect the Arduino 2 board through USB OTG port android detect it as media device. Debugging the kernel code I found that enable debug messages inside the file arcotg_udc.c cause android to detect Arduino as USB accessory as shoud correctly be. It seem the debug messages introduce some delay that allow the device to be detected correctly. To be more specific the problem is the indetification string (manufacturer, model, description and so on) sent from arduino device are not received correctly and I can see this error in the terminal:

acc_complete_set_string, err -108

Since android can not know the type of device assign media device as default. Currently I'm not able to figure out the problem yet.

Someone have a suggestion for this issue?

Thank you

Labels (2)
4 Replies

840 Views
weiping_liu
NXP Employee
NXP Employee

Hi ,

    If you can't connect to i.mx android 4.x  with accessory. we suggest you  modify your try accessory mode as below:

send    GET_PROTOCOL_VERSION

delay 1ms

send    STRING_VENDOR,     

delay 1ms

send  STRING_NAME,

delay 1ms

send STRING_LONGNAME,

delay 1ms

  send  STRING_VERSION,

delay 1ms

send  STRING_URL

delay 1ms

send  STRING_SERIAL,

delay 1ms

#ifdef  USE_USB_AUDIO

   send ACCESSORY_AUDIO

delay 1ms

#endif

   send ACCESSORY_START

delay 1ms

The delay time ,you can adjust it for your accessory .

840 Views
YixingKong
Senior Contributor IV

Fabiof

Has your issue resolved? If yes, please close the DI, othewise keep working with Shaojun with your issue. We will clsoe a DI if no activity in 3 days.

Thanks,

Yixing

0 Kudos

840 Views
shaojun_wang
NXP Employee
NXP Employee

You need to check the Arduino 2 board usb timing, or change usb cable.

The usb accessory function has been verified on FSL K60 and K70 devices.

0 Kudos

840 Views
fabiof
Contributor IV

Hi

Both i.MX and Arduino are in the same board, no cable is necessary. Arduino communicate with android using interna firmwarre based to Arduino development libraries. I found a workaround that seem to work into the android code but I really don't like it. When you said "usb timing" what do you eman exactly? I need to modify something into the arduino firmware code?

0 Kudos