OBD / CAN bus connector TX2 - BMW

As the TX2 dev board has a CAN bus interface now I’m wondering what the best interface for my BMW (OBD) would be to get things like steering angles,…

Thanks for any input
G.

I’m interested in this information as well. I see that 9 pins on the second GPIO are dedicated for two CAN bus networks (HS/MS).

Is there a C/C++ library available for the CAN interface?

Will we be able to just rig up the 9 pins to a ODB2-DB9 cable adapter, set the baud rate, and listen/transmit on the networks?

A CAN node consists of a CAN Controller and a transceiver.
Controller and transceiver together implements the full protocol stack.

TX2 has support of 2 CAN controllers as part of SoC.
Hence we will need to have CAN transceivers to do a full set-up for CAN communication.

These are pin descriptions for both the CAN controllers on Jetson-TX2.

Port : J26
Pin No Details
1 ===== CAN wake

3 ===== CAN0 STAND BY
5 ===== CAN0 RX
7 ===== CAN0 TX
9 ===== CAN0 ERR

13 ==== CAN1 STANDBY
15 ==== CAN1 RX
17 ==== CAN1 TX
19 ==== CAN1 ERR

For a minimal setup CAN transmission,
only CAN_TX and CAN_RX pins of Tegra CAN controller has to be configured with CAN transceiver.

Please check the attachments for connection specification.

Hope this helps.
Thanks.

Thanks, @spatra,
I don’t exactly like reiterations of the manual (yup, J26 is correct), but with the unusual huge amount of detailed info for the Jetson and the very limited searchability of the docs I’m even going a step further and put a pointer to the location:

CAN bus on J26 according to Jetson_TX1_TX2_Developer_Kit_Carrier_Board_Design_Files_B04 > P2597_B04_OrCAD_schematics.pdf p. 16/34 under the title GPIO Expansion Headers

What I was actually looking for was ready-to-use hardware (cable) and software to read out steering angles.

The one or other day after my post I found some real info in
https://medium.com/@autti/hacking-my-own-car-lessons-learn-after-a-few-months-of-setbacks-76b555d28d1b

This article points to https://www.kvaser.com/
Site / co looks proficient. Needa check it out when I got time.

Due to the disappointing, deafening silence HERE I’m going to resort to Drive PX2 forums ASAP.

Regards
G.

You will NOT find ready-to-use software because CAN messages on any given vehicle are OEM-dependent and considered a trade secret by the manufacturer (I have seen no one, other than possibly Ford, document these CAN fields). It’s pretty much up to you to handle the vehicle side of things (In most cases, NVIDIA’s customers for the PX2 are the ones who designed the vehicle electrical system. :)

Also many cars (especially luxury vehicles) have multiple CAN buses and as a result, steering angle may not be visible from the OBD2 connector. There’s an article somewhere about Tesla CANbus hacking that documents the challenge on Teslas which have (IIRC) FOUR independent CAN buses and the OBDII connector’s bus is basically useless.

https://subdiesel.wordpress.com/ecu-analysis/can-messages/ and https://subdiesel.wordpress.com/generic/protocols/ssm2-via-can/ can help you with Subarus (although, based on some postings, Subaru COMPLETELY changed their messaging structure around 2010-2011 - I can confirm a USDM 2009 Outback 2.5i is roughly similar to what’s described in the URLs above)

https://fabiobaltieri.com/2013/07/23/hacking-into-a-vehicle-can-bus-toyothack-and-socketcan/ - Toyota - I can tell you a 2006 V6 Sienna has recognizable similarities to the messages documented here but a LOT of differences (including absolutely no evidence whatsoever of steering angle or individual wheelspeeds anywhere.)

Rather than messing with the TX2’s onboard CAN (you’ll likely need a CAN transceiver such as an SN65HVD230 for use with the TX2) you might want to get started with a USB-to-CAN adapter - I’ve had very good results with a Canable interfacing with a 2006 Sienna and a 2009 Outback - http://canable.io/

https://github.com/linklayer/pyvit is good for playing with OBD2-over-CAN using a SocketCAN capable interface.

Last but not least: Wireshark/tshark are your friend. socketcan_bridge from ROS is good to have in your toolkit too if you’re doing ROS work.

WOW,
@atdodd, that’s what I call an ANSWER!!! (though the hurdles look intimidating)

I had hoped with a quick solder job on an OBD plug and 5 single-pin connectors to J26 I could start to play, but to try to reverse-engineer anything car-vendor-specific on the bus is an absolute no-go.

Q: Why would I need an extra transceiver w/ 2m cable OBD to TX2 CAN bus?
I saw OBD to USB cables from Kvaser can cost as much as the TX2.

I read somewhere about a project with the Kia (Hyundai) Soul and that it would lend itself nicely to such experiments. I can’t get a Lincoln (here) or want an old Subaru, but a Soul would complement my BMW Z4 nicely (though I’m not at all sure I will want to invest anything close).
Anyone can tell anything?

Thanks again for the in-depth answer!!! I really appreciate it.
G.

I’m not sure about the Tegra/TX2 - but just like many SoCs don’t have onboard PHYs for Ethernet (only a MAC), most microcontrollers have the rough equivalent of CAN MAC logic onboard but do not include a PHY - because there are actually at least two CAN bus standards out there. There’s the typical (very common) two-wire high-speed CAN, and there’s also a single-wire fault-tolerant low-speed CAN standard used in some vehicles (I’ve never worked with that form of CAN before).

Reverse engineering car-vendor-specific is basically what you are going to have to do unless you work for a vehicle manufacturer unfortunately - vehicular CAN buses are NOT in any way standardized with the exception of OBD (which is a subset of Unified Diagnostic Services - that standard costs $200-300 to purchase IIRC, but you can find a partial UDS implementation for SocketCAN within pyvit - I haven’t worked with that since it was added, I just got my Outback back last weekend.

There isn’t a HUGE difference to my knowledge between the Kvaser and much cheaper open-source alternatives - except the Kvaser Leaf Lite is galvanically isolated (potentially important in some configurations, but I’ve had no issues with a non-isolated CANable on Toyota and Subaru OBD ports).

The bad news is higher-end vehicles are more likely to have more than the typical two CAN buses on most vehicles (usually there’s a body CAN that is low-speed one-wire and high-speed for traction/engine management) - and some vehicle manufacturers firewall the OBD port from the main buses. (Toyota and Subaru don’t).

Really the first thing to do is just to connect to the OBD port, bring up the CAN interface (most vehicles operate at 500 kbps), and run Wireshark just to see if there’s anything there. From there, you can take captures and look for patterns in the data. (Useful trick: Use pyvit to poll some OBD2 PIDs to see if you see similar numbers going across proprietary CAN messages.)

If your intention is to actually start controlling the vehicle in any way - well there’s a huge bag of safety issues that potentially opens up. That’s why Dataspeed’s kit is so popular with vehicle autonomy researchers. :)

Thanks a ton for your detailed follow-up, @atdodd!

Guess I’ll write off the TX2’s CAN part. There are better things to do in life (or deep learning) than waste man-months if it might not work out and / or pay.

One other word of appreciation: I can’t remember to have seen such nice, structured writing with so much attention to detail, actually answering several follow-up questions.

After ten days and no answer here I made a cross-post on the Drive forum. (https://devtalk.nvidia.com/default/topic/1003788/drive-platforms/drive-px2-or-jetson-tx2-phys-connection-and-software-for-can-bus)
The Nvidia-official apparently didn’t even read the first sentence when “answering”.
The amount of garbage surrounding often half-baked answers on the the much-hyped StackOverflow makes me regularly jump in anger.

Cheers
G.