>From experience, this behavior sometimes occurs as result of saturating the BT bandwidth with some dongles. Each analog input you open generates an additional ~1.25kB/s of data. Your options are either:
- Try different dongles. Some experience this behavior more than others. - Modify the firmware to reduce the analog sample rate (currently hard-coded at 1kHz): https://github.com/ytai/ioio/blob/master/firmware/app_layer_v1/adc.c#L90 On Mon, Oct 30, 2017 at 11:43 AM, Et Dev <[email protected]> wrote: > Hello Ytai, > > I am using IOIO bluetooth interface connected to my app running on Samsung > Note 4 device (other devices Note3/2 and S3 all have same issues too). > Inspite of devices being in close proximity and no other possible > interference (signal-free facility), I do see sporadic IOIO library > notifying of disconnects. On closer inspection, it seems a protocol error > which somehow manifests into a disconnect. There are times when there is no > such disconnect for more than 20 minutes and there are times when the > disconnect happens within a minute. Moreover, once the disconnect happens, > it keeps on disconnecting frequently - usually within a minute. Here is a > summary trace of the logcat dump of the failure (- see complete trace at > end of this mail). > > 10-28 19:46:12.519 13132 13882 E IOIOProtocol: Protocol error: > 10-28 19:46:12.519 13132 13882 E IOIOProtocol: > ioio.lib.impl.IOIOProtocol$ProtocolError: > Received unexpected command: 0xff > 10-28 19:46:12.519 13132 13882 E IOIOProtocol: at > ioio.lib.impl.IOIOProtocol$IncomingThread.run(IOIOProtocol.java:928) > 10-28 19:46:12.529 13132 13882 D IOIOImpl: Physical disconnect. > 10-28 19:46:12.529 13132 13882 V BluetoothIOIOConnection: Client initiated > disconnect > > *Hardware Configuration:* > Project uses IOIO [Hardware ID: SPRK0020 Bootloader ID: IOIO0401 Firmware > ID: IOIO0506] in following configuration: > 15 digital output pins [Open-Drain]: 3, 6, 7, 10, 11, 12, 13, 14, > 18, 19, 20, 21, 22, 23, 24 > 6 analog input pins: 41,42, 43, 44, 45, 46 > 3 TWI sets [100KHz]: 1, 2, 4, 5, 25, 26 > > *Application processing*: > > - *[Re]Connect-setup*: MyService extends IOIOService. In > createIOIOLooper(String connectionType, Object extra), it checks if > connection-type is bluetooth and creates an IOIOLooper. Setup in this > looper instantiates DigitalOutput, AnalogInput and TwiMaster. Henceforth, > loop() does Thread.sleep(500). All the digital outputs are also set to > false state. The IOIO board and these controls are saved by the service for > future use. If this is a reconnect, old IOIO board and controls are > discarded and new board and controls take their place. > - *Monitor-input:* Once application is ready, application starts three > threads - each monitoring a two AnalogInput in a loop with a sleep of > 10secs in loop and 1 sec between the two inputs. These threads may be > started either as part of IOIOLooper.setup processing (if app is ready) or > later by application UI thread (if app gets ready later on). The TWI > devices may be used in lieu of the Analog-inputs here but I have disabled > them for now. > - *Operate-outputs:* A thread-pool performs application processing and > based on application business logic, worker pool threads operate the > DigitalOutputs. > - *Disconnect-cleanup*: On disconnect, MyService discards the IOIO > board and the DigitalOutput, AnalogInput and TwiMaster(100KHz). > > *Additional Observations*: > > - Disabling the *Operate-outputs* does not have any effect - IOIO > still disconnects. > - Disabling the *Monitor-input *and *Operate-outputs *seems to > eliminate disconnects. The IOIO board is essentially left unused for > extended period. > - Once the protocol error happens, the application keeps getting > frequent disconnects (within a minute). > - Completely stopping the application and restarting the application > can sometimes prolong the disconnect - however, this is not always true. > - I have disabled the TWI sets for now as they seem to make debugging > harder and more unpredictable. > > *Request: * > > - Please help me identify what may cause these protocol errors and > recommend a way to debug these diisconnects. > - Do you recommend changes in my application structure that can > improve the reliability - stopping/restarting some threads, consolidating > some threads etc. > - Is there a way to resume operation reliably after a disconnect? > > *Complete Logcat filtered for IOIO*: > 10-28 19:38:30.459 13132 13132 I IOIOBaseApplicationHelper: Using IOIOLib > version: IOIO0507 > 10-28 19:38:30.459 13132 13132 D IOIOConnectionRegistry: Successfully > added bootstrap class: ioio.lib.impl.SocketIOIOConnectionBootstrap > 10-28 19:38:30.479 13132 13132 D IOIOConnectionRegistry: Successfully > added bootstrap class: ioio.lib.android.accessory. > AccessoryConnectionBootstrap > 10-28 19:38:30.529 13132 13132 D IOIOConnectionRegistry: Successfully > added bootstrap class: ioio.lib.android.bluetooth. > BluetoothIOIOConnectionBootstrap > 10-28 19:38:30.549 13132 13132 D IOIOConnectionRegistry: Successfully > added bootstrap class: ioio.lib.android.device.DeviceConnectionBootstrap > 10-28 19:38:31.219 13132 13791 D IOIOImpl: Waiting for IOIO connection > 10-28 19:38:31.229 13132 13791 V IOIOImpl: Waiting for underlying > connection > 10-28 19:38:31.279 13132 13791 V BluetoothIOIOConnection: Attempting to > connect to Bluetooth device: IOIO (8A:22) > 10-28 19:38:32.859 13132 13791 V BluetoothIOIOConnection: Established > connection to device IOIO (8A:22) address: 00:1B:DC:06:8A:22 > 10-28 19:38:32.869 13132 13791 V IOIOImpl: Waiting for handshake > 10-28 19:38:32.869 13132 13882 I IncomingState: IOIO Connection > established. Hardware ID: SPRK0020 Bootloader ID: IOIO0401 Firmware ID: > IOIO0506 > 10-28 19:38:32.889 13132 13791 V IOIOImpl: Querying for required interface > ID > 10-28 19:38:32.919 13132 13791 V IOIOImpl: Required interface ID is > supported > 10-28 19:38:32.919 13132 13791 I IOIOImpl: IOIO connection established > 10-28 19:38:32.929 13132 13791 D MyApp: Starting IOIO Manager > 10-28 19:38:33.119 13132 13791 I MyApp: Started IOIO Managers > 10-28 19:46:12.519 13132 13882 E IOIOProtocol: Protocol error: > 10-28 19:46:12.519 13132 13882 E IOIOProtocol: > ioio.lib.impl.IOIOProtocol$ProtocolError: > Received unexpected command: 0xff > 10-28 19:46:12.519 13132 13882 E IOIOProtocol: at > ioio.lib.impl.IOIOProtocol$IncomingThread.run(IOIOProtocol.java:928) > 10-28 19:46:12.529 13132 13882 D IOIOImpl: Physical disconnect. > 10-28 19:46:12.529 13132 13882 V BluetoothIOIOConnection: Client initiated > disconnect > 10-28 19:46:50.119 13132 13791 D MyApp: Stopping IOIO Manager, > disconnected=true > 10-28 19:46:50.119 13132 13791 I MyApp: Stopped IOIO Manager, > disconnected=true > 10-28 19:46:50.119 13132 13791 D IOIOImpl: Waiting for IOIO connection > 10-28 19:46:50.119 13132 13791 V IOIOImpl: Waiting for underlying > connection > 10-28 19:46:50.129 13132 13791 V BluetoothIOIOConnection: Attempting to > connect to Bluetooth device: IOIO (8A:22) > 10-28 19:46:50.789 13132 13791 V BluetoothIOIOConnection: Established > connection to device IOIO (8A:22) address: 00:1B:DC:06:8A:22 > 10-28 19:46:50.789 13132 13791 V IOIOImpl: Waiting for handshake > 10-28 19:46:50.789 13132 6282 I IncomingState: IOIO Connection > established. Hardware ID: SPRK0020 Bootloader ID: IOIO0401 Firmware ID: > IOIO0506 > 10-28 19:46:50.799 13132 13791 V IOIOImpl: Querying for required interface > ID > 10-28 19:46:50.829 13132 13791 V IOIOImpl: Required interface ID is > supported > 10-28 19:46:50.829 13132 13791 I IOIOImpl: IOIO connection established > 10-28 19:46:50.829 13132 13791 D MyApp: Starting IOIO Manager > 10-28 19:46:51.109 13132 13791 I MyApp: Started IOIO Managers > 10-28 19:47:12.509 13132 6282 E IOIOProtocol: Protocol error: > 10-28 19:47:12.509 13132 6282 E IOIOProtocol: > ioio.lib.impl.IOIOProtocol$ProtocolError: > Received unexpected command: 0xff > 10-28 19:47:12.509 13132 6282 E IOIOProtocol: at > ioio.lib.impl.IOIOProtocol$IncomingThread.run(IOIOProtocol.java:928) > 10-28 19:47:12.509 13132 6282 D IOIOImpl: Physical disconnect. > 10-28 19:47:12.509 13132 6282 V BluetoothIOIOConnection: Client initiated > disconnect > 10-28 19:49:12.029 13132 13791 D MyApp: Stopping IOIO Manager, > disconnected=true > 10-28 19:49:12.029 13132 13791 I MyApp: Stopped IOIO Manager, > disconnected=true > 10-28 19:49:12.039 13132 13791 D IOIOImpl: Waiting for IOIO connection > 10-28 19:49:12.039 13132 13791 V IOIOImpl: Waiting for underlying > connection > 10-28 19:49:12.049 13132 13791 V BluetoothIOIOConnection: Attempting to > connect to Bluetooth device: IOIO (8A:22) > 10-28 19:49:12.799 13132 13791 V BluetoothIOIOConnection: Established > connection to device IOIO (8A:22) address: 00:1B:DC:06:8A:22 > 10-28 19:49:12.799 13132 13791 V IOIOImpl: Waiting for handshake > 10-28 19:49:12.809 13132 11268 I IncomingState: IOIO Connection > established. Hardware ID: SPRK0020 Bootloader ID: IOIO0401 Firmware ID: > IOIO0506 > 10-28 19:49:12.809 13132 13791 V IOIOImpl: Querying for required interface > ID > 10-28 19:49:12.819 13132 13791 V IOIOImpl: Required interface ID is > supported > 10-28 19:49:12.819 13132 13791 I IOIOImpl: IOIO connection established > 10-28 19:49:12.819 13132 13791 D MyApp: Starting IOIO Manager > 10-28 19:49:13.099 13132 13791 I MyApp: Started IOIO Managers > 10-28 19:49:42.419 13132 11268 E IOIOProtocol: Protocol error: > 10-28 19:49:42.419 13132 11268 E IOIOProtocol: > ioio.lib.impl.IOIOProtocol$ProtocolError: > Received unexpected command: 0x8f > 10-28 19:49:42.419 13132 11268 E IOIOProtocol: at > ioio.lib.impl.IOIOProtocol$IncomingThread.run(IOIOProtocol.java:928) > 10-28 19:49:42.419 13132 11268 D IOIOImpl: Physical disconnect. > 10-28 19:49:42.419 13132 11268 V BluetoothIOIOConnection: Client initiated > disconnect > 10-28 19:49:46.989 13132 13791 D MyApp: Stopping IOIO Manager, > disconnected=true > 10-28 19:49:46.989 13132 13791 I MyApp: Stopped IOIO Manager, > disconnected=true > 10-28 19:49:46.999 13132 13791 D IOIOImpl: Waiting for IOIO connection > 10-28 19:49:46.999 13132 13791 V IOIOImpl: Waiting for underlying > connection > 10-28 19:49:47.009 13132 13791 V BluetoothIOIOConnection: Attempting to > connect to Bluetooth device: IOIO (8A:22) > 10-28 19:49:47.239 13132 13791 V BluetoothIOIOConnection: Established > connection to device IOIO (8A:22) address: 00:1B:DC:06:8A:22 > 10-28 19:49:47.239 13132 13791 V IOIOImpl: Waiting for handshake > > -- > 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 https://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 https://groups.google.com/group/ioio-users. For more options, visit https://groups.google.com/d/optout.
