I'm getting issues when switching the OTG bus between the USB port for ADB and the SAM3X for ADK. I have a working sketch, which connects as an Android accessory; however, when I switch the OTG bus to the USB port to load a new app and switch back again, the same sketch running on the SAM3X won't connect as an accessory - rather it connects as a USB debug connection. I've tried switching this via both the GUI and setting the GPIO pins manually as described in http://www.udoo.org/docs/Android/UDOO_Switch_Between_Adb_Debug_And_ADK_Connection and get the same issue either way. Has anyone experienced a similar issue or have any ideas what may be causing it?
So it turned out to be a problem in the Arduino sketch. There was a delay(1000) at the end of the loop, which apparently stops Android recognising it as an accessory. I suspect there is some kind of timeout in Android that this breaks.