The overall throughput of LE is at best 1MBps and probably less even if the UART baud rate can be higher.
It cannot send all the bytes of a full CAN bus (even in Binary), but might be able to do something if there were compression (with loss in the first few packets to establish the dictionary). There are usually few CAN addresses, and often data doesn't change at all or only a few bits.

administrators

The BLE112 is flashed and ready to use. If you use a LE scan tool such as LightBlue it will find the CBT BLE112. Right now I'm processing the CAN packets on the MCU and sending the computed values to one of 8 'sensor' characteristics. Their is also a characteristic for reading and writing to the UART. You can find the specific UUIDs here:
https://github.com/CANBus-Triple/CBT-BLE112-Firmware/blob/master/gatt.xml

Derek can you please confirm that BT filtering is functional in 0.4.4. Using Light Blue I'm able to talk to the MCU UART port no problem.. I can send 01 01 and 01 10 01 to my heart's content and receive valid responses while subscribing.

However, I can't get BT filtering to send anything over at all... I've got a simple register I monitor over USB that I filter with 03 01 01 28 but when I try 04 01 28 (or any number of other filters that are completely valid over USB) I do not get any data back.

It's almost like BT filtering isn't implemented.

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.

I was finally able to flash BLE firmware, and discovered that <i>conn_interval</i> is 39ms on my Android Phone, so the problem is not in that parameter.

I suggest a custom middleware implementation. I am having good results unleashing 0x03 0x01 0x01, suppressing Serial1 output in SerialCommand.h, and constructing custom results for just the data I want in my own middleware class.

administrators

Good stuff going on in this thread!

Yeah connection interval should be around 40ms, it's controlled by the host OS.

@Emanuele‌ - if you could share some code as to how you connected to the CBT over bluetooth that would be great.

I am able to connect to the device and discover the services, both using debug tools and the iOS app I'm testing, but I just can't get any data from the CBT.

I tried modifying the BLE112 firmware to add a serial RX characteristic but that didn't help.

I need to be able to pass serial data between the CBT and the connected Bluetooth device using Serial1 on the CBT.

Any help you can offer would be most appreciated!

@Emanuele‌ - if you're still having trouble updating the BLE firmware, and you're trying to follow the steps on Derek's page to update over USB, I found the way to get it working was to send the 0802 command to the CBT over USB serial BEFORE sending the '1' to the DFU characteristic over Bluetooth. That's contrary to the order on Derek's instruction page, but swapping that order worked for me.

I haven't had to touch the embedded BT firmware.

Grab Derek's latest commit from master. He's improved BT throttling considerably over the past week.

Use x03 x01 for filtering. The x04 stuff is abandoned.

Thanks @ShellDude‌ - are you using your own (developed) app/code to connect to the CBT over bluetooth, or Derek's standard app?

I'm using his app on OSX for sniffing over USB and my own Android app for final implementation using BTLE.

I'll be publishing full source, including my custom CBT middleware shortly.

My app is working quite well now. I am implementing some OBD II communication through CAN messages, following Wikipedia Article on OBD II (https://en.wikipedia.org/wiki/OBD-II_PIDs).
If I've time I will publish the code during this weekend.
I used this library (Cordova plugin) for BLE: https://github.com/randdusing/BluetoothLE

I have to say the same ... CBT is the car hacking tool of 21st century!

I say this only having hacked into a single bus. Just wait till I'm opening windows and doors from my watch!

One additional note.. I'm not using cross platform stuff.

All my work ioutside of ardruino is pure Android because I loathe iOS.

Ironically I absolutely love OSX.

What Bluetooth characteristic(s) are you connecting to from your Android device to talk with the CBT? That's the bit I can't get working at the moment.

administrators

Hah! I too hate iOS and love OSX!

Hey James, check here for some quick info on the characteristics: https://www.canb.us/tutorials/Bluetooth LE, Sensors and you

@jamesatfish‌, serial communication service UUID is 7a1fb359-735c-4983-8082-bdd7674c74d2
I subscribed to its characteristic b0d6c9fe-e38a-4d31-9272-b8b3e93d8657 (with indicate method), and send commands to its other characteristic b0d6c9fe-e38a-4d31-9272-b8b3e93d8658 (with notify method).
But they are interchangeable. You can also use the same characteristic to write and receive data (subscribe).

Yeah, I'm only using notify. Works good enough for everything I need to do.

Here is the source code for my app: https://github.com/eiannone/CBT-Diagnostic
To ease dealing with OBD protocol I implemented mask filtering on firmware for CAN messages id. That's because ODB II CAN messages id are only in the range from 0x7E8 to 0x7EF. You can find it in my <a href="https://github.com/eiannone/CANBus-Triple/tree/can-mask">v0.5.1 can-mask branch</a>.
I suggest also to disable bluetooth rate limiting, in order to avoid missing some CAN packets when you receive quick responses from the car.
The apk is here: https://github.com/eiannone/CBT-Diagnostic/releases/download/0.1alpha/android-debug.apk

  • 27
    Posts
  • 24319
    Views

Looks like your connection to CANBus Triple was lost, please wait while we try to reconnect.