I'm trying to implement bluetooth communication with CBT on Android, too.
I'm developing an OBD diagnostic app with <a href="http://www.ionicframework.com/">Ionic framework</a> (borrowing the idea and structure from @Derek offical app) and currently I'm able to connect to CBT, and successfully send / receive data with an Android smartphone. I can share the code if anyone is interested.
I'm also able to activate DFU mode on BLE chip (writing to the specific characteristic).
The app can send log commands and CAN packets but sometimes it gets corrupted data.
One thing that seems strange to me, and could be the cause of corrupted data, is the timer event in BLE code, which is responsible to take data received on UART from MCU and send it over bluetooth (see <a href="https://github.com/CANBus-Triple/CBT-BLE112-Firmware/blob/master/script.bgs#L155">hardware_soft_timer event</a> in BLE firmware script).
This timer is activated when a device is connected via bluetooth, on <a href="https://github.com/CANBus-Triple/CBT-BLE112-Firmware/blob/master/script.bgs#L207">line 207 of the bgscript</a>:
<blockquote>call hardware_set_soft_timer((32768/1000) * conn_interval / 4, 2, 0)</blockquote>
The first argument is the time interval (expressed in 1/32768 seconds) on which the timer event will be fired.
Its value depends on <i>conn_interval</i> variable, which is set by the connected device. Android set this value to 7.5ms (see http://stackoverflow.com/questions/21398766/android-ble-connection-time-interval), so the resulting interval will be less than 2ms!
So apparently the <i>hardware_soft_timer</i> event may be firing too fast.
I will try to change its value, but until now I was not able to update firmware to BLE chip.
last edited by