Bluetooth communication using Hardware tester app crashes I2C communication with other devices?

36 views
Skip to first unread message

Vincent Nadon

unread,
Jan 22, 2015, 4:02:22 PM1/22/15
to ioio-...@googlegroups.com
Hi,

I have a problem with Bluetooth communication using Hardware tester app. It crashes I2C communication with other devices attached to IOIO microcontroler. Is this normal?

Thanks for your help!

Vincent

Ytai Ben-Tsvi

unread,
Jan 25, 2015, 3:13:06 PM1/25/15
to ioio-...@googlegroups.com

This app is not related to the official IOIO codebase. You better contact the author with this question.

--
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 ioio-users+...@googlegroups.com.
To post to this group, send email to ioio-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ioio-users.
For more options, visit https://groups.google.com/d/optout.

Vincent Nadon

unread,
Jan 28, 2015, 12:04:32 PM1/28/15
to ioio-...@googlegroups.com
Using another Android App my colleagues and I created (based on IOIO examples) makes also the I2C crash. It seems that the Android Apps are trying to take the I2C connexion over and therefore shut downs everything else. It even reboots the micro controller in order to obtain the bluetooth connexion.

Maybe I don't put the following code in the right place? ( it is placed in my main function in main.c before my other function calls)


  while(1){
/************Bluetooth Communication***********/


BOOL connected = ConnectionTasks();
    if (!connected
        && state > STATE_OPEN_CHANNEL) {
      // just got disconnected
      log_printf("Disconnected");
      SoftReset();
      state = STATE_INIT;
    }
    switch (state) {
      case STATE_INIT:
        handle = INVALID_CHANNEL_HANDLE;
        state = STATE_OPEN_CHANNEL;
         //_LATD3 = 0;
        break;

      case STATE_OPEN_CHANNEL:
        if ((handle = OpenAvailableChannel()) != INVALID_CHANNEL_HANDLE) {
          log_printf("Connected");
          state = STATE_WAIT_CHANNEL_OPEN;
        }
         //_LATD3 = 0;
        break;

      case STATE_WAIT_CHANNEL_OPEN:
       if (ConnectionCanSend(handle)) {
          log_printf("Channel open");
          AppProtocolInit(handle);
          state = STATE_CONNECTED;
        }
        //_LATD3 = 0;
        break;

      case STATE_CONNECTED:
        AppProtocolTasks(handle);
        break;

      case STATE_ERROR:
        ConnectionCloseChannel(handle);
        SoftReset();
        state = STATE_INIT;
        // _LATD3 = 0;
        break;
    }
/************ END Bluetooth Communication***********/

Ytai Ben-Tsvi

unread,
Jan 28, 2015, 12:30:38 PM1/28/15
to ioio-...@googlegroups.com
Are you aware of the fact that you're using the IOIO in a way that is very different from its intended usage? If this is unintentional, better read the wiki. Otherwise, in order to help you I need some context and specifically, what you're trying to do, how you were thinking about doing it and why you need custom firmware as opposed to using the standard one.

Vincent Nadon

unread,
Jan 29, 2015, 6:43:58 AM1/29/15
to ioio-...@googlegroups.com
I am aware that I am using the IOIO pic (PIC24) in a different way from it's intended usage. What I do specifically with the PIC24 is as follows:

1) I program some DSPs during bootup. To do so I use I2C protocol between the Pic and the DSPs.

2) I have created some functions on the Pic to control the DSPs.

3) I have a rotary switch to control the Pic and start some of the functions I created and therefore controlling the DSPs through I2C.

4) We have an Android App that one of my colleague started based on the IOIO libraries. The colleague is now working abroad and I need to customize everything for my needs in my project. Mainly what I want to do is control my DSPs through the IOIO (PIC24) with Bluetooth or USB and gather the data that I read with the Pic send it to the Android App so that I am able to see it as a Graph.

We already have some functions in the Android App that can control the DSPs through the Pic, but they are not very practical since I would need to copy every function I created in the Pic into the Android App. So I instead I want to simply use the functions I already programmed in the Pic through the Android App. I would like to still be able to control the Pic with my rotary switch if possible.

The main problem that I have now is to make the communication from the Android App to the PIC24 work using the IOIO libraries, without interrupting the functionnality of I2C to initialize the DSPs (program them).

I am attacking this next week, it is quite a challenge for me.

Ytai Ben-Tsvi

unread,
Feb 1, 2015, 1:22:55 AM2/1/15
to ioio-...@googlegroups.com
If you want my honest opinion, I have a good guess that converting your code to Java would be way easier than the way you're approaching it. It will also have the benefit of being able to upgrade the firmware and IOIOLib very easily in the future without having to port the code.

If you're insisting on doing it the hard way, what I would do is:
  1. Make sure you are able to build and install the standard firmware on the IOIO.
  2. Read both firmware protocol.c file and the software IOIOProtocol.java file and make sure you understand how the protocol works and then what is the overall sequence of how a Java call on the Android eventually gets to the proper function on the IOIO and how functions on the IOIO can send data that eventually shows up on the Android.
  3. Add your custom functions to the standard firmware and plumb them through in a similar fashion. Make sure you don't collide with the standard firmware on resources, such as the I2C buses, etc.

Vincent Nadon

unread,
Feb 2, 2015, 10:36:33 AM2/2/15
to ioio-...@googlegroups.com
Hi,

Thanks for your help! 

After thinking about it, in the end I would probably end up copying every function in Java anyways to update the Libraries. So I will simply transcode my micro controller functions in Java as you said.

I started slowly to do so, but I see some errors about incompatible IOIO version in my LogCat...?

I get the same error message as in the following post https://groups.google.com/forum/#!msg/ioio-users/5rziYMOYouc/kVK_lic10qMJ except I have a different IOIO bootloader version. I think it's because I'm using the most recent version of the IOIOLib for Android with an older version of the bootloader. To fix the problem I need compatible bootloader files to compile in MPLab which I can't find on the IOIO page. Is it possible to get them?

Here is the LogCat error message I get:

02-02 16:32:13.558: I/IncomingState(25002): IOIO Connection established. Hardware ID: SPRK0016 Bootloader ID: IOIO0306 Firmware ID: IOIO0326

02-02 16:32:13.558: V/IOIOImpl(25002): Querying for required interface ID

02-02 16:32:13.598: E/IOIOImpl(25002): Required interface ID is not supported

02-02 16:32:13.598: E/IOIOBaseApplicationHelper(25002): Incompatible IOIO firmware

02-02 16:32:13.598: E/IOIOBaseApplicationHelper(25002): ioio.lib.api.exception.IncompatibilityException: IOIO firmware does not support required firmware: IOIO0005

02-02 16:32:13.598: E/IOIOBaseApplicationHelper(25002): at ioio.lib.impl.IOIOImpl.checkInterfaceVersion(IOIOImpl.java:208)

02-02 16:32:13.598: E/IOIOBaseApplicationHelper(25002): at ioio.lib.impl.IOIOImpl.waitForConnect(IOIOImpl.java:135)

02-02 16:32:13.598: E/IOIOBaseApplicationHelper(25002): at ioio.lib.util.IOIOBaseApplicationHelper$IOIOThread.run(IOIOBaseApplicationHelper.java:58)

Thanks again!

Vincent

Ytai Ben-Tsvi

unread,
Feb 2, 2015, 11:03:22 AM2/2/15
to ioio-...@googlegroups.com

You don't need to upgrade the bootloader, only the application firmware. For your (old) version of the board, this is done using the IOIO manager application, which unfortunately requires you to be using an Android <4.1. This is only a one-time process, you'd be able to use the IOIO with any Android later.

Vincent Nadon

unread,
Feb 2, 2015, 11:12:35 AM2/2/15
to ioio-...@googlegroups.com
I think I have to consider myself more of a IOIO developer than a IOIO user ;)

I have an application firmware that my colleagues and I took from one of your versions and included some of our code to boot our DSPs. So indeed this Application firmware might be outdated for the newer IOIOLib in Android. I think I need the newest version of the Application firmware that you have as an MPLab project so I can modify it to include my code to boot my DSPs.

Is that possible?

Ytai Ben-Tsvi

unread,
Feb 2, 2015, 11:14:31 AM2/2/15
to ioio-...@googlegroups.com

It's all on GitHub. I thought it's been agreed that you can do everything you need with the stock firmware, but up to you...

Ytai Ben-Tsvi

unread,
Feb 2, 2015, 11:15:09 AM2/2/15
to ioio-...@googlegroups.com

Alternatively, you can use a v3.x version of IOIOLib.

Vincent Nadon

unread,
Feb 2, 2015, 1:28:01 PM2/2/15
to ioio-...@googlegroups.com
I changed for V3.3 Android IOIOLib and it works like a charm now! :)

Thanks a lot, your help is very appreciated! :D
Reply all
Reply to author
Forward
0 new messages