Wednesday, July 13, 2011

IOIO Manager Unleashes the Power of Firmware Upgrades

Exciting news once again, folks!
Since the original design of IOIO, it was planned to make it capable of upgrading its own software, by pulling updates from the Android device it is connected to. This gives a lot of flexibility for where the upgrades come from, be it the Web, a file containing custom firmware that a user has built or even embedded inside an Android application that needs the IOIO to behave in some non-standard way.
To achieve that, the IOIO firmware included a bootloader, which kicks in on every IOIO restart and checks for new firmware. For security purposes, it has been decided that the bootloader will only get its upgrades from a single application, called the IOIO Manager, and check that this application is authentic by enforcing it to be signed be the official IOIO key (i.e. by me). Alas, this IOIO Manager had not yet been born when IOIO was first released, and this cool feature, although available on every IOIO firmware, remained dormant. Until yesterday, that is!
The IOIO Manager application is now available on the Android Market. Install it by scanning the QR code below or by clicking it:

Installing New Application Firmware Using the Bootloader

This is the most common use case: the IOIO Manager application lets you maintain a library of application images, and then choose the one you want installed on the IOIO at any point in time. Once selected, the IOIO will pull this image after its next restart. This takes less than two seconds and does not require any additional hardware (such as a programmer).
To remove all doubt: this upgrade mode works great with the existing bootloader version, which all current IOIO owners have. At least in the near future, the bootloader is not expected to change, and those users are able to use IOIO manager to receive upgrades!

Upgrading the Bootloader

The bootloader cannot upgrade itself by design. This is in order to protect the user from accidentally bricking the board by installing a faulty image that renders the bootloader invalid. My original thought was that the bootloader will never have to be modified anyway. Errrrr, wrong! When designing the bootloader I figured that since the bootloader already contains all the code for establishing an ADB connection to the phone, it might as well provide this service to the application and save the code duplication. While this seemed reasonable enough back then, I overlooked something important - what if the application wants to use some other protocol over USB? One example is of course Open Accessory. Moreover, what if I found a bug in the bootloader, or want to introduce an optimization? Bottom line - we need a way to upgrade the bootloader from time to time and for that we must have a programmer.
Wait, what?
But the SparkFun page specifically used to say "you'll never need a programmer", until we figured out this is true only 99% of the time. And yes, we could just fix the bootloader design bug and have the new units shipped with a better bootloader, but what about the users that already bought it and don't have a programmer? I wanted to be as fair as possible to these people who were first to believe in my product, so I decided to go the extra mile...
So you need a programmer, no doubt about that, but who said you need an off-the-shelf programmer? Let's make one out of a IOIO! And so I did. And it works! So right now, if you want to reprogram your IOIO's bootloader, all you need is another IOIO, be it your friend's or your fellow hacker. Well, people can still argue this is not a free solution in all cases, but I hope they will appreciate I really did anything I could to make things better for them.
Here's what it looks like when one IOIO programs another:
Simply connect 5 wires (two of which are supply and ground) between them, select the image and go!

New Possibilities

First, this new feature opened the gate for me to start pushing new features to IOIO on a regular basis. Some of which have been itching me to release for quite some time.
Next, this allows people interested in modifying the code running on the IOIO to do so very easily as well as to distribute the firmware they are producing for others to install with no trouble. I'm really curious to see what will come out of this.
For more information, read the detailed guide to the IOIO Manager on the IOIO Wiki.

P.S. in retrospect I realized this is a homage to an older project of mine: AVR programmer using the PICMAN (the great-grandfather of the IOIO)


  1. So we will be able to convert our IOIO to an ADK compatible device with another IOIO and an Android phone? Awesome!
    Thx soo much for your effort.

  2. Wow, I can't wait to try it...

    However, is the original boot-loader that is shipped with the board, able to do this or does it need to be upgraded itself first ?

    I vaguely remember having read something along these lines, but I hope I'm wrong...:)


  3. @trandi
    Since you're the second person asking, it's probably my fault not making it clear enough (I'll update the post):
    IOIO Manager works with the stock bootloader shipped by SparkFun. The only thing released so far that needs a programmer (or a second IOIO) is the ADK beta, which is currently not in the main line of development, but will be some day, when OpenAccessory matures a little.

    So the next firmware upgrades will be usable by everybody. Then I might make a bootloader change in preparation for an official OpenAccessory release.

    Thanks for raising this.

  4. Thanks Ytai, it's clear now and it's good news....


  5. Would it be possible for you to advise, whether this IOIO board can be connected to a thermal printer so that an android application can print to the printer.

    Second question is = is there anything specific that needs to be done to print non latin scripts specifically Indic scripts (assuming Android version supports it) in the above setup.

  6. @Krishna
    Both answers really depends on the specific printer's interface. If you can provide more information I might be able to help.
    Kindly continue the discussion on the ioio-users list

  7. Hi Ytai

    You are a expert of android. I have a block issue about android and hope for some advise. Thanks a lot.:)

    I plan to do the communication between telosb and android phone which is nexus S4G. Telosb is a sensor based on tinyos.Below is the datasheet of telosb.

    Telosb has a USB port which is acturally a serial port converted by FTDI chip.It need 2.7-3.6V, 23mA to power up.
    My plan is to connect them with a microUSB to OTG cable(I bought one just now).

    What should I do about the driver and other issues?

    Do I need the IOIO board to connect them?

    I really appreciate your help.

  8. @Liang,
    First, it seems like this device has WiFi support, have you considered communicating with the Android over WiFi?
    Second, I don't know of any Android devices with OTG support. Moreover, very few Android devices have host mode (only Android 3.0+ has the APIs and even then, not every device actually implements them.
    If WiFi isn't an option, your best bet is probably to bypass the FTDI and connect directly to the RX/TX lines using IOIO. You'll need to figure out the right speed, stop bits, parity, etc.
    You can supply the device from IOIO's 3.3V line if you want.

  9. Thank you for your response.Yes, WiFi isn't an option for me. Sparkfun just told me they would not have stock of IOIO available for the next 4 weeks.....

    Someone who did some work of nexus S OTG mode told me it did not have a connection to Vbus.So it has no means of driving power to Vbus. That is the hardware block issue.

    I can power the sensor by battery. I just want to use android to send and receive data from the sensor. Is there any other way for me to do this? Does it must need the OTG mode to do this?

    Thanks a lot.

  10. I just found someone did this with IOIO.

  11. @Ytai

    But I do not have IOIO now.As I said, I can power the sensor by battery. I just want to use android to send and receive data from the sensor. Is there any other way for me to do this? Does it must need the OTG mode to do this?


  12. @Liang
    I don't know the board you're using well enough. I seem to recall that some phones (including the Nexus) can overload their USB port to be used as serial port, using some resistors on the USB pins. You'll have to search the Web for more info. However, you'll have to root your phone and modify it's OS in order to access this data on your app probably, and you'd need to bypass the FTDI chip.
    I've also encountered OS mods that enabled some Android models to function as USB hosts. You'd have to find / implement drivers for FTDI to run on the phone probably.
    I don't know what the goals of your project are. However, I think that at least time-/effort- wise, IOIO or a similar solution (such as MicroBridge) is probably your best way forward.

  13. @Ytai

    My goal is just to do a app on phone to get data from sensor. There is a problem,Sparfun just told me IOIO will not have new stock until 4 weeks later. At that time, I need to finish this project....So I need to see whether MicroBridge works for me.

    I have a basic question here. For the android part, it use fsa9480 as the usb switch. For my sensor, it use FTDI as a UART-usb converter. The reason to bypass the FTDI chip is to connect the UART signal directly between sensor and phone,right?

  14. I don't know much about fsa9480.
    What I meant is that a USB device (as your Android is) cannot possible connect to another USB device.
    So you need either something to be a host to talk to your Android device (e.g. a IOIO or a MicroBridge), or use a non-standard trick to cause your Android to speak UART on its USB jack.
    In either of these solutions, you'd need something to speak to your sensor board too. Once again, you need a USB host OR you can bypass it's FTDI chip and get UART, which is probably easier to handle.

    If you have further questions, let's take this discussion to email (ytaibt at the mail service offered by Google)

  15. @Liang
    BTW, at the moment SparkFun seem to have about 30 in stock and there are several other online vendors who buy IOIO from SparkFun, stock it an resell it, so you should have no problem obtaining one if you wish.

  16. @Ytai

    Hi, Ytai. Sorry for the delay reply. Yes, I got IOIO yesterday. I am so lucky that they have new stock. Next week I will start work on it.So many midterms these week...

    I will discuss you to email later.

    I really appreciate your help.Thanks.