Low level CAN only showing one ID

167 views
Skip to first unread message

simon.m...@googlemail.com

unread,
May 30, 2017, 11:30:58 AM5/30/17
to OpenXC
Hello everyone,

I have been playing around with my C5BLE and a BMW F21, and I am trying to obtain the steering wheel angle. I can successfully read out engine rpm, vehicle speed etc. via OBD PIDs and using the obd2-scanner I can see which PIDs are available for my vehicle, however it seems as though steering wheel angle is not published via an OBD PID. 

This is why I would like to access the CAN bus via OBD port and reverse engineer the CAN ID for the steering wheel angle (I have some potential candidates, but if anyone knows which CAN ID is used here then that info would be greatly appreciated). Thus far, I have followed the compile instructions for unfiltered CAN and have tried bus speeds of 500/125/100kbs however I can only obtain a single CAN ID with this configuration:

{"timestamp": 1496157353.972905, "data": "0x00f0fcffff", "id": 304, "bus": 1}
{"timestamp": 1496157354.973156, "data": "0x00f0fcffff", "id": 304, "bus": 1}

this just repeats with no data change..
I use the limited data rate and force update to avoid flooding the VI with this "304" ID. 

What I don't understand is why I am not seeing other CAN IDs? 

In addition, if I used the obd2-scanner tool I am, for some reason, able to see more CAN IDs being published (for OBD pid 0x84 as an example):

PID 0x84 responded with: ([{u'status': True, u'timestamp': 1452256841802, u'command_response': u'diagnostic_request'}], [
{u'timestamp': 1452256841461, u'data': u'0x03410d00aaaaaaaa', u'id': 2024, u'bus': 1}, 
 {u'timestamp': 1452256841462, u'name': u'vehicle_speed', u'value': 0}, 
 {u'timestamp': 1452256841471, u'data': u'0x04410c0cfaaaaaaa', u'id': 2024, u'bus': 1}, 
 {u'timestamp': 1452256841472, u'name': u'engine_speed', u'value': 830.5}, 
 {u'timestamp': 1452256841479, u'data': u'0x05f0fcffff', u'id': 304, u'bus': 1}, 
 {u'timestamp': 1452256841481, u'data': u'0x03410422aaaaaaaa', u'id': 2024, u'bus': 1}, 
 {u'timestamp': 1452256841482, u'name': u'engine_load', u'value': 13.333333}, 
 {u'timestamp': 1452256841579, u'data': u'0x05f0fcffff', u'id': 304, u'bus': 1}, 
 {u'timestamp': 1452256841660, u'data': u'0x03410d00aaaaaaaa', u'id': 2024, u'bus': 1}, 
 {u'timestamp': 1452256841661, u'name': u'vehicle_speed', u'value': 0}, 
 {u'timestamp': 1452256841670, u'data': u'0x04410c0cf6aaaaaa', u'id': 2024, u'bus': 1}, 
 {u'timestamp': 1452256841671, u'name': u'engine_speed', u'value': 829.5}, 
 {u'timestamp': 1452256841678, u'data': u'0x05f0fcffff', u'id': 304, u'bus': 1}, 
 {u'timestamp': 1452256841680, u'data': u'0x03410423aaaaaaaa', u'id': 2024, u'bus': 1}, 
 {u'timestamp': 1452256841681, u'name': u'engine_load', u'value': 13.725491}, 
 {u'timestamp': 1452256841740, u'data': u'0x0341057faaaaaaaa', u'id': 2024, u'bus': 1}, 
 {u'timestamp': 1452256841741, u'name': u'engine_coolant_temperature', u'value': 87}, 
 {u'timestamp': 1452256841778, u'data': u'0x05f0fcffff', u'id': 304, u'bus': 1}, 
 {u'status': True, u'timestamp': 1452256841802, u'command_response': u'diagnostic_request'}, 
 {u'timestamp': 1452256841877, u'data': u'0x05f0fcffff', u'id': 304, u'bus': 1}, 
 {u'timestamp': 1452256841909, u'data': u'0x03410d00aaaaaaaa', u'id': 2024, u'bus': 1}, 
 {u'timestamp': 1452256841910, u'name': u'vehicle_speed', u'value': 0}, 
 {u'timestamp': 1452256841919, u'data': u'0x04410c0cf6aaaaaa', u'id': 2024, u'bus': 1}, 
 {u'timestamp': 1452256841920, u'name': u'engine_speed', u'value': 829.5}, 
 {u'timestamp': 1452256841929, u'data': u'0x03410423aaaaaaaa', u'id': 2024, u'bus': 1}, 
 {u'timestamp': 1452256841930, u'name': u'engine_load', u'value': 13.725491}, 
 {u'timestamp': 1452256841977, u'data': u'0x05f0fcffff', u'id': 304, u'bus': 1}, 
 {u'timestamp': 1452256842076, u'data': u'0x05f0fcffff', u'id': 304, u'bus': 1}, 
 {u'timestamp': 1452256842108, u'data': u'0x03410d00aaaaaaaa', u'id': 2024, u'bus': 1}, 
 {u'timestamp': 1452256842109, u'name': u'vehicle_speed', u'value': 0}, 
 {u'timestamp': 1452256842118, u'data': u'0x04410c0cfcaaaaaa', u'id': 2024, u'bus': 1}, 
 {u'timestamp': 1452256842119, u'name': u'engine_speed', u'value': 831}, 
 {u'timestamp': 1452256842128, u'data': u'0x03410422aaaaaaaa', u'id': 2024, u'bus': 1}, 
 {u'timestamp': 1452256842129, u'name': u'engine_load', u'value': 13.333333}, 
 {u'timestamp': 1452256842176, u'data': u'0x05f0fcffff', u'id': 304, u'bus': 1}, 
 {u'timestamp': 1452256842275, u'data': u'0x05f0fcffff', u'id': 304, u'bus': 1}])

Does anyone know how I can compile correctly to show all CAN messages being published? 

Thanks,

Simon Hecker

Eric Marsman

unread,
May 30, 2017, 12:01:42 PM5/30/17
to OpenXC
Hi Simon,

Yes, it should be possible. What does your JSON config look like? Are you following the examples here?


Also include your compile options from the firmware build. We should be able to get this working.

Regards,
Eric

simon.m...@googlemail.com

unread,
May 30, 2017, 2:51:31 PM5/30/17
to OpenXC
Hi Eric,

Thanks a lot for your help.

My JSON file looks exactly like the raw-examples file: 

{   "buses": {
        "hs": {
            "controller": 1,
            "speed": 500000,
            "raw_can_mode": "unfiltered"
        }
    }
}

However I have also tried:
- changing "hs" bus to speed 100000
- manually enabling CAN AF bypass and/or passthrough filter via openxc-control set --bus ....
- adding a second "ms" bus with either speed: 100000 or 125000
- adding specific messages (vehicle speed: 0xD although I am unsure if this is only the OBD PID (taken from obd2.cpp) or also the CAN ID)
- prevent flooding via: "max_message_frequency": 1,  "force_send_changed": true

For compiling I then (pseudo code):
$ openxc-generate-firmware-code --message-set MY_JSON_FILE.json > signals.cpp
$ copy signals.cpp  to vi-firmware/src
$ vagrant init and vagrant up
vagrant@vagrant$ cd vi-firmware/src
vagrant@vagrant:vi-firmware/src $ make clean
vagrant@vagrant:vi-firmware/src $ set environmental variables shown below
vagrant@vagrant:vi-firmware/src $ make
$ flash compiled firmware.hex in build folder using avrdude

Environmental variables:
Compiled with options:
-      CROSSCHASM_C5_BLE   = PLATFORM 
-      1                   = BOOTLOADER 
-      translated_obd2     = ENVIRONMENT_MODE 
-      0                   = TEST_MODE_ONLY 
-      0                   = DEBUG 
-      0                   = MSD_ENABLE 
-      180                 = DEFAULT_FILE_GENERATE_SECS 
-      0                   = DEFAULT_METRICS_STATUS 
-      1                   = DEFAULT_ALLOW_RAW_WRITE_USB 
-      0                   = DEFAULT_ALLOW_RAW_WRITE_UART 
-      0                   = DEFAULT_ALLOW_RAW_WRITE_NETWORK 
-      0                   = DEFAULT_ALLOW_RAW_WRITE_BLE 
-      BOTH                = DEFAULT_LOGGING_OUTPUT 
-      JSON                = DEFAULT_OUTPUT_FORMAT 
-      0                   = DEFAULT_EMULATED_DATA_STATUS 
-      ALWAYS_ON           = DEFAULT_POWER_MANAGEMENT 
-      0x1                 = DEFAULT_USB_PRODUCT_ID 
-      0                   = DEFAULT_CAN_ACK_STATUS 
-      1                   = DEFAULT_OBD2_BUS 
-      1                   = DEFAULT_RECURRING_OBD2_REQUESTS_STATUS 

As far as I understood from the docs this seems to be the correct procedure, but maybe I am missing something.

Cheers,
Simon

Eric Marsman

unread,
Jun 1, 2017, 11:30:40 AM6/1/17
to OpenXC
Hi Simon,

Everything you're doing looks correct to me. I will try to re-create here on a Ford vehicle and see what I get with your exact settings. I may have time tomorrow to try this. 

One think you may want to try is to turn off DEFAULT_RECURRING_OBD2_REQUESTS_STATUS and see if you get any change in CAN data. Shouldn't matter, but not something I typically do.

Regards,
Eric

simon.m...@googlemail.com

unread,
Jun 1, 2017, 11:56:27 AM6/1/17
to OpenXC
Hi Eric,

That would be great thanks!
In the meantime I'll try deactivating the RECURRING_OBD...

Cheers,
Simon

simon.m...@googlemail.com

unread,
Jun 6, 2017, 1:41:10 PM6/6/17
to OpenXC
Hi Eric,

any luck with the raw CAN messages? Could it be that my car (BMW F21) is publishing steering wheel angle on a different CAN bus that is not accessible through the OBD2, or may be firewalled? If so do you know if there is a way to bypass this?

Thanks,
Simon

Eric Marsman

unread,
Jun 16, 2017, 1:58:39 PM6/16/17
to OpenXC
Simon,

Sorry for the delay. Tracked this down to a bug in current master branch of vi-firmware (https://github.com/openxc/vi-firmware/issues/388). Simple solution for you would be to just use latest release vi-firmware (tags/v7.2.0). Or, I've managed to improve performance, but not totally fix the issue in can-oom branch. This works for me on C5 platform.

I've tested the attached (can-oom) branch on a C5 BLE on my Ford and it provides full dumps (see log below) for 5 minutes. You should try this on your vehicle and then see if you can build your own. 

In order to reduce the effects of the issue, you can reduce the amount of CAN you're processing by filtering it to the stuff you care about. 

Good luck. let me know how it goes.

Regards,
Eric

{"timestamp": 1497623742.191, "data": "0x01000001ffe00000", "id": 359, "bus": 1}

{"timestamp": 1497623742.192, "data": "0x1c00000000000000", "id": 514, "bus": 1}

{"timestamp": 1497623742.193, "data": "0x4000000000000000", "id": 516, "bus": 1}

{"timestamp": 1497623742.199, "data": "0x0000000000000000", "id": 118, "bus": 1}

{"timestamp": 1497623742.2, "data": "0x0080000000004e20", "id": 522, "bus": 1}

{"timestamp": 1497623742.201, "data": "0x01000001ffe00000", "id": 359, "bus": 1}

{"timestamp": 1497623742.202, "data": "0x1c00000000000000", "id": 514, "bus": 1}

{"timestamp": 1497623742.203, "data": "0x4000000000000000", "id": 516, "bus": 1}

{"timestamp": 1497623742.21, "data": "0x01000001ffe00000", "id": 359, "bus": 1}

{"timestamp": 1497623742.211, "data": "0x1c00000000000000", "id": 514, "bus": 1}

{"timestamp": 1497623742.212, "data": "0x4000000000000000", "id": 516, "bus": 1}

{"timestamp": 1497623742.219, "data": "0x0000000000000000", "id": 118, "bus": 1}

{"timestamp": 1497623742.22, "data": "0x0080000000004e20", "id": 522, "bus": 1}

{"timestamp": 1497623742.221, "data": "0x0400000000000000", "id": 970, "bus": 1}

{"timestamp": 1497623742.222, "data": "0x01000001ffe00000", "id": 359, "bus": 1}

{"timestamp": 1497623742.223, "data": "0x1c00000000000000", "id": 514, "bus": 1}

{"timestamp": 1497623742.224, "data": "0x4000000000000000", "id": 516, "bus": 1}

{"timestamp": 1497623742.225, "data": "0x1e04000000000000", "id": 1310, "bus": 1}

{"timestamp": 1497623742.229, "data": "0x0000000000000000", "id": 1042, "bus": 1}

{"timestamp": 1497623742.23, "data": "0x01000001ffe00000", "id": 359, "bus": 1}

{"timestamp": 1497623742.231, "data": "0x1c00000000000000", "id": 514, "bus": 1}

{"timestamp": 1497623742.232, "data": "0x4000000000000000", "id": 516, "bus": 1}

{"timestamp": 1497623742.237, "data": "0x0000000000000000", "id": 656, "bus": 1}

{"timestamp": 1497623742.239, "data": "0x0000000000000000", "id": 118, "bus": 1}

{"timestamp": 1497623742.24, "data": "0x0080000000004e20", "id": 522, "bus": 1}

{"timestamp": 1497623742.241, "data": "0x01000001ffe00000", "id": 359, "bus": 1}

{"timestamp": 1497623742.242, "data": "0x1c00000000000000", "id": 514, "bus": 1}

{"timestamp": 1497623742.243, "data": "0x4000000000000000", "id": 516, "bus": 1}

{"timestamp": 1497623742.249, "data": "0x0400000000000000", "id": 970, "bus": 1}

{"timestamp": 1497623742.251, "data": "0x01000001ffe00000", "id": 359, "bus": 1}

{"timestamp": 1497623742.252, "data": "0x1c00000000000000", "id": 514, "bus": 1}

{"timestamp": 1497623742.253, "data": "0x4000000000000000", "id": 516, "bus": 1}

{"timestamp": 1497623742.254, "data": "0xffffffff00000000", "id": 673, "bus": 1}

vi-firmware-CROSSCHASM_C5_BLE.hex

M Muldoon

unread,
Jun 16, 2017, 3:27:48 PM6/16/17
to OpenXC
Hi, are you trying from the OBD 16 pin connector?  Most likely a gateway between all the buses and the DLC connector...find the CANH and CANL line and tee into it directly.

Or if you have access to any BMW tools, Y into the OBD connector with the tool and your openxc and sniff for commands.

Good luck.


On Tuesday, May 30, 2017 at 11:30:58 AM UTC-4, simon.m...@googlemail.com wrote:

simon.m...@googlemail.com

unread,
Jun 22, 2017, 8:23:06 AM6/22/17
to OpenXC
Hi, thanks for the info everyone. 

@Eric, I have tried your attached firmware as well as the can-oom branch, but still no luck. I am only able to see one value repeated when accessing via OBD:

{"timestamp": 1498131073.259375, "data": "0x00f0fcffff", "id": 304, "bus": 1}

This is likely due to a gateway between the CAN and OBD on this vehicle. 

However, I have acquired access to the actual CAN bus behind the instrument cluster, and tried connecting CANH and CANL to the C5BLE interface directly (via two wires). Unfortunately I now get this error:

Can't read from data source -- stopping: ("USB device couldn't be read", USBError(60, 'Operation timed out'))

Can't read logs from data source -- stopping: ("USB device couldn't be read", USBError(60, 'Operation timed out'))

Even though with the same firmware I am able to at least receive ID 304 when connected via OBD port. Are other connections required for the C5BLE interface to function properly, or should it be sufficient to just connect the two CAN? I have compiled with ALWAYS_ON to avoid checking for engine running messages on OBD.


@M Muldoon, yes I was previously trying to read via OBD 16 pin connector, however you are correct that there is a gateway, and only a subset of CAN messages are available on this. I was able to speak with a BMW mechanic and I now have access to the CANH and CANL lines behind the instrument cluster. Thanks!

Cheers,
Simon


Eric Marsman

unread,
Jun 23, 2017, 10:59:38 AM6/23/17
to OpenXC
You will also need power and gnd from OBD-II. Did you have that? You'll want to use pins 5 (GND) and 16 (VDD)

Are you using pins 6 (CANH) & 14 (CANL) on the C5? 

Regards,
Eric

simon.m...@googlemail.com

unread,
Jun 26, 2017, 4:17:40 AM6/26/17
to OpenXC
Hi Eric!

Everything works now! Thanks a lot for your help.

Cheers,
Simon
Reply all
Reply to author
Forward
0 new messages