Hi Ytai, wonderful environment that of IOIO. Congrats! For my purposes I bought two boards from sparkfun and this is the configuration I use.
IOIOLib: IOIO0505 Application firmware: IOIO0500 Bootloader firmware: IOIO0401 Hardware: SPRK0020 I have already written an app interfacing to a board developed by me using an USB->serial converter (FDDI chip) that needs OTG. As I need to power my tablet from USB, I decided to use IOIO like a USB->UART interface to my board that additionally powers the tablet in HOST mode. As an introductory exercise, I developed a simple app called TerminalIOIO ( https://github.com/fjovine/TerminalIOIO ) that works fine, at least during the normal compile, install cycle. I was using the Blutooth and, as I wanted to study your code, I compiled the IOIO classes directly in my AndroidStudio project. Then I started integrating your code in my App and it worked fine in the normal AndroidStudio compile, install cycle and direct USB connection. But when I try to use it directly on the tablet (no compilation before) I have the following problem. I switch the power on: this powers both my board and IOIO. The tablet notifies the presence of an accessory USB and launches my app that sometimes is able to configure the IOIO and successfully performs the handshake with my board but very frequently it hangs. I used a different type of tablet having the same problems. Then I used my smart phone (alcatel onetouch) and again sometimes the handshake works, sometimes not. I thought that I had some compilation problems, so I downloaded the pre-compiled HelloIOIO-debug-unaligned.apk from App-IOIO0505.zip and I launched it in all the possible configurations (two tablets and phone), experimenting always the same random behavior: I always get the notification (AccessoryUSB) but very frequently no connection happens. I decided to instrument a bit your code with some logging comments, the most significant of which is inside the *run* method in the *IOIOProtocol* class. Here is the code: *LocalLogger.i* is a static method that doubles messages both on Android Logger and queue them up to be shown through http (I have a small http server running for remote manipulations) The message in Italian means "character received". ... @Override public void run() { super.run(); setPriority(MAX_PRIORITY); int arg1; int arg2; int numPins; int size; byte[] data = new byte[256]; try { while (true) { arg1 = readByte(); LocalLogger.i(TAG, "Ricevuto carattere "+Integer.toHexString (arg1)); //<----------------------------- switch (arg1) { case ESTABLISH_CONNECTION: if (readByte() != 'I' || readByte() != 'O' || readByte() != 'I' || readByte() != 'O') { throw new IOException("Bad establish connection magic"); } byte[] hardwareId = new byte[8]; byte[] bootloaderId = new byte[8]; byte[] firmwareId = new byte[8]; readBytes(8, hardwareId); readBytes(8, bootloaderId); readBytes(8, firmwareId); ... Attached you will find two logs (in OpenOffice spreasheet format) that show what happens. Focusing the bytes received from IOIO, this is the sequence I have when the connection works 1. 0x0 - ESTABLISH_CONNECTION 2. 0x2 - CHECK_INTERFACE 3. 0xD - UART_CONFIG 4. 0xF - PIN_UART And this makes perfectly sense with what I need. This is the sequence when the connection is not established 1. 0x0 - ESTABLISH_CONNECTION 2. 0x1 - SOFT_RESET 3. 0x0 - ESTABLISH_CONNECTION 4. 0x1 - SOFT_RESET Sometimes something different happens - 0x1 - SOFT_RESET - 0x0 - HARD_RESET - 0x1 - SOFT_RESET - 0x1 - SOFT_RESET - 0x1 - SOFT_RESET Whenever ESTABLISH_CONNECTION is received, the firmware versions from IOIO are correctly decoded. But the reception of the SOFT_RESET keeps the connection hanged. If the first received command is SOFT_RESET, I see the exception Protocol error: [ioio.lib.impl.IOIOProtocol$ProtocolError: java.lang.NullPointerException at ioio.lib.impl.IOIOProtocol$IncomingThread.run(IOIOProtocol.java:944) Caused by: java.lang.NullPointerException at ioio.lib.impl.IncomingState.handleSoftReset(IncomingState.java:243) at ioio.lib.impl.IOIOProtocol$IncomingThread.run(IOIOProtocol.java:733) ] that I have found in other messages on this forum: this depends on the fact that when 0x1 (soft_reset) is received the protocol tries to access some objects that have still not been instantiated. I made at least a whole week of experimentation with different conditions, using both the IOIO boards I own, but the result is more or less this one: when I cannot connect the SOFT_RESET is there. As additional info, I have *never* had this problem after switching off the ADB USB interface, as needed while developing (Android Studio connected) So I am blocked. Can you please help me? Thanks in advance. Additional info Tablet 1: Low cost tablet running Android 4.2.2 Tablet 2: Low cost tablet running Android 4.4.2 Phone: Alcatel One touch running Android 4.1.1 -- You received this message because you are subscribed to the Google Groups "ioio-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/ioio-users. For more options, visit https://groups.google.com/d/optout.
NOK_ACCENSIONE_02.ods
Description: application/vnd.oasis.opendocument.spreadsheet
NOK_ACCENSIONE_03.ods
Description: application/vnd.oasis.opendocument.spreadsheet
OK_ACCENSIONE_03.ods
Description: application/vnd.oasis.opendocument.spreadsheet
