That's super weird, but as long as things work now, I cannot argue... Sorry
for your trouble, at least you've hopefully learned something new in the
process :)

On Wed, Sep 2, 2015 at 1:51 PM, Iovine Francesco <[email protected]>
wrote:

> Last update. I managed to recompile the firmware using MPLAB X and XC16,
> to download it and... everything works perfectly. I guess sparkfun uses
> some weird firmware image.
> Anyway my problems seem over: I switch my instrument on, and this powers
> on both my board and the IOIO  together, and the tablet always handshakes
> correctly.
>
> Thanks for your help
> Cheers.
>
> Il giorno domenica 30 agosto 2015 18:28:09 UTC+2, Ytai ha scritto:
>>
>> I tested both 5.04 and 5.05 in accessory mode yesterday and everything
>> works OK on my setup. Is this possibly a power supply problem, either
>> having a poor supply or having the trim-pot on the IOIO not fully clockwise?
>> I can imagine how transients on the power line might cause protocol
>> corruption.
>>
>> And no, I don't currently have a debug build available. It's a good idea!
>>
>> On Sun, Aug 30, 2015 at 5:38 AM, Iovine Francesco <[email protected]>
>> wrote:
>>
>>> I downloaded library 5.4, tested it in my android code but the problems
>>> continued.
>>> I installed the precompiled HalloIOIO.apk app version 5.4 but nothing
>>> changed.
>>>
>>> I tried one more thing: removed all the accessory aware apps and tried
>>> to power off/power on the IOIO: the protocol works perfectly and *always* I
>>> get the popup from Android showing the "
>>> https://github.com/ytai/ioio/wiki/ADK"; url so at least the accessory
>>> handshake works correctly, although the problems I documented are later on
>>> the protocol sequence.
>>>
>>> Quick question: is there a firmware version in DEBUG_MODE available? It
>>> would be useful, otherwise I have to set all the PIC compilation
>>> environment up. Following the sequence of debugging messages on a serial
>>> line would be very useful.
>>>
>>> Thanks in advance.
>>>
>>>
>>> Il giorno sabato 29 agosto 2015 18:56:36 UTC+2, Iovine Francesco ha
>>> scritto:
>>>>
>>>> I will ASAP.
>>>> Thanks a lot.
>>>>
>>>>
>>>> Il giorno sabato 29 agosto 2015 18:36:06 UTC+2, Ytai ha scritto:
>>>>>
>>>>> Can you check if this is happening to you when using v5.04 software?
>>>>> v5.05 has not yet been rigorously tested. You can use the precompiled
>>>>> binaries initially.
>>>>> On Aug 28, 2015 12:40 AM, "Iovine Francesco" <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> 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.
>>>>>>
>>>>> --
>>> 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.
>>>
>>
>> --
> 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.
>

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

Reply via email to