ytai/ioio — Issue #2: IOIOLIB V-1.0 applications not compatible Firmware ID IOIO0200, IOIO0300
Author: rdunning0823
Created: 2011-11-19 13:57:44+00:00
State: open

IOIO applications built using the IOIOLIB version 1 (git hash id f2e3eabc1433b49b81e48805c06cf57685b842ef from April 27, 2011) are not compatible with IOIO Boards using newer Firmware ID IOIO0200 and Firmware ID IOIO0300.

Droid User applications built using IOIOLIB version 1 will fail on IOIO Boards with later Firmwares. Additionally, if developers upgrade their IOIOLIBs to version 3, then their applications will fail with IOIO Boards with earlier Firmwares.

This is a compatibility issue and should be corrected so that users are not forced to upgrade their firmware. The solution should allow applications built with IOIOLIB version 1 to run with later firmwares.

Below is a link and copy of the IOIO-Users usergroup discussion that defines the observed incompatibility:
https://groups.google.com/group/ioio-users/browse_thread/thread/2148e1119e221e18
------------------------------
Ytai,
We've been linking the IOIOLib into xcsoar.org our open source project
since June. It has worked successfully. However, it is failing with
IOIO0300 Firmware ID.
We want to remain compatible with Firmware IDs IOIO0100, IOIO0200 and
IOIO0300 so we are using IOIOLib version V-10 (IOIO0001) (from April
27, git hash f2e3eabc1433b49b81e48805c06cf57685b842ef).
This works for Firmware ID IOIO0100 and IOIO0200. However with IOIO
boards running IOIO0300, we get the following error (see code below):
11-18 17:01:14.514 8939 8947 D IOIOImpl: Waiting for IOIO connection
11-18 17:01:14.514 8939 8947 D IOIOImpl: Waiting for underlying
connection
11-18 17:01:14.514 8939 8947 D SocketIOIOConnection: Creating server
socket
11-18 17:01:14.514 8939 8947 D SocketIOIOConnection: Waiting for TCP
connection
11-18 17:01:14.514 8939 8947 D SocketIOIOConnection: TCP connected
11-18 17:01:14.521 8939 8947 D IOIOImpl: Waiting for handshake
11-18 17:01:14.521 8939 8949 I IncomingState: IOIO Connection
established. Hardware ID: SPRK0015 Bootloader ID: IOIO0100 Firmware
ID: IOIO0300
11-18 17:01:14.521 8939 8947 D IOIOImpl: Querying for required
interface ID
11-18 17:01:14.529 8939 8949 V IncomingState:
handleCheckInterfaceResponse(true)
11-18 17:01:14.529 8939 8947 D IOIOImpl: Required interface ID is
supported
11-18 17:01:14.529 8939 8947 I IOIOImpl: IOIO connection established
11-18 17:01:14.529 8939 8947 W IOIOHelper: IOIOJopenUart():0 ENTER
<<-- here it enters the openUart() method below
11-18 17:01:14.529 8939 8947 W IOIOHelper: IOIOJopenUart():0
EXIT <<--- this means it exited from our openUart() method below
successfully.
11-18 17:01:14.537 8939 8949 V IncomingState: handleUartClose(0)
11-18 17:01:14.537 8939 8949 V IncomingState: handleUartClose(1)
11-18 17:01:14.537 8939 8949 V IncomingState: handleUartClose(2)
11-18 17:01:14.537 8939 8949 V IncomingState: handleUartClose(3)
11-18 17:01:14.537 8939 8949 V IncomingState: handleSpiClose(0)
11-18 17:01:14.537 8939 8949 V IncomingState: handleSpiClose(1)
11-18 17:01:14.537 8939 8949 V IncomingState: handleSpiClose(2)
11-18 17:01:14.537 8939 8949 V IncomingState: handleI2cClose(0)
11-18 17:01:14.537 8939 8949 V IncomingState: handleI2cClose(1)
11-18 17:01:14.537 8939 8949 V IncomingState: handleI2cClose(2)
11-18 17:01:14.537 8939 8949 E IOIOProtocol: Protocol error
11-18 17:01:14.537 8939 8949 E IOIOProtocol: java.io.IOException:
Received unexpected command: 0x1b
11-18 17:01:14.537 8939 8949 E IOIOProtocol: at
IOIO.lib.impl.IOIOProtocol$IncomingThread.run(IOIOProtocol.java:616)
11-18 17:01:14.537 8939 8949 V IncomingState: handleConnectionLost()
11-18 17:01:14.537 8939 8949 D SocketIOIOConnection: Client
initiated disconnect
Here is our openUart() method which is using pins are 3=out, 4=in and
baud=4800. This works w/ IOIO Firmware IOIO0100 and IOIO0200 but
fails with IOIO0300. I am not showing the our waitConnect() code
which is successful. The openUart() method below exits successfully,
but appears the incomingThread is causing an exception:
public int openUart(IOIO ioio, int _baud) {
Log.w("IOIOHelper", "IOIOJopenUart():" + ID + " ENTER"); <<<--
see this message in the logcat above
if (!isAvailable) {
Log.e("IOIOHelper", "IOIOJopenUart() is not available: " +
ID);
return -1;
}
ioio_ = ioio;
baudrate = _baud;
try {
uart = ioio_.openUart(inPin, outPin, baudrate,
Uart.Parity.NONE,
Uart.StopBits.ONE);
} catch (ConnectionLostException e) {
Log.w("IOIOHelper", "IOIOJopenUart() Connection Lost. Baud: "
+ _baud, e);
return -1;
} catch (Exception e) {
Log.e("IOIOHelper", "IOIOJopenUart() Unexpected exception
caught", e);
return -1;
}
input = uart.getInputStream();
output = new OutputThread(uart.getOutputStream());
output.setTimeout(5000);
isAvailable = false;
Log.w("IOIOHelper", "IOIOJopenUart():" + ID + " EXIT");
return ID;
}
Do you have any suggestions about how we might fix this without
upgrading to IOIO0003?
Thanks,
Rob
-----------------
Hi,
First, thanks for the excellent explanation of the problem. You provided
enough information for me to understand what's going on.
Apparently you have indeed revealed a bug in backward compatibility. I
think it can be fixed. And I believe it is not at all related to UART but
would happen if you were trying to do other operations as well (or maybe
even without doing anything, but not sure).
I'll try to fix it soon. Would be nice if you can open a (first) bug in the
github site for that.
Out of curiosity - what prevents you from upgrading the boards' firmware?
Most importantly for you, one thing that I *cannot* promise is to back-port
any bugs I'm fixing to early library version, so by running IOIOLib V1.0, I
can actually *guarantee* you that you're using a version with some known
bugs (one of them being in UART, reacting badly to an incoming byte of
0xFF). So by sticking to an early version you're missing not only new
features, but also bug fixes.
Last, I'm so happy to see IOIO being used for this exciting application!
Ytai.