Passive monitoring of CAN buses?

My Nissan Leaf Forum

Help Support My Nissan Leaf Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

marwatk

New member
Joined
Mar 7, 2018
Messages
4
I built an arduino setup using a few of these:

https://smile.amazon.com/SMAKN-MCP2515-Controller-Receiver-Protocol/dp/B012ET9E1U/ref=sr_1_2?ie=UTF8&qid=1525017291&sr=8-2&keywords=mcp2515

To hook in and passively monitor each of the 3 CAN buses on my 2018 Leaf. After successfully reading messages sent from a BT OBD dongle I hooked it up to the car expecting to dump a log of the buses and got... nothing.

If I hook up a Y-cable and the BT dongle I can see the requests Leaf Spy sends and the responses the Leaf sends, but those are the only ones that show up (and only on the CAR-bus).

Is it possible to passively monitor the normal traffic on the buses? If so, any thoughts on what I could be doing wrong?

Let me know if I didn't provide enough information on what I'm doing. Here is the code I'm using:

https://github.com/marwatk/leafmon/blob/master/can.ino

My end goal is to monitor setting the charge timer to see if it's possible to somehow automate.

-Marcus
 
Today I hooked up my oscilloscope to the pins listed as the 3 CAN buses in the original decoding thread to see if I see any traffic at the electrical level and the only thing I saw (again) was when Leaf Spy was actively requesting data. With Leaf Spy closed I just stare at a flat line. This is with the car in drive mode, but parked. I'm hesitant to prod the sensitive bits in motion...

I feel like I'm missing something fundamental but can't figure out what. The investigation continues...
 
The fact that you're getting messages at all is a good sign. It means you have the MCP2515 properly configured for the baud rate of CAN bus, your SPI bus is working, Arduino is working, etc. etc. Not sure about your oscilloscope not being able to see the bus. The leaf will not start or operate with a dead EV or CAR can bus.

Seems like you're only getting the high value CAN IDs, which is what leafspy uses, so suspect you have your MCP2515 filters incorrectly set somehow. What are your mask/filter settings? I see at the beginning you have "things to monitor" along with unsigned CHARs for them, but can't seem to find at a quick glance where you set up the MCP2515. The buses are pretty busy with 10 ms messages that you don't need to care about, so I would do filtering within the chip, as you may fill up the buffer and miss messages you want if you just have the Arduino read the message ID and discard after the fact.

Some of the leaf spy messages from the ELM (which is on the car CAN bus) are relayed by the VCM (main computer/ECU) to the EV bus. The AV bus is boring and not worth logging/monitoring in my opinion (it's just the buttons around the radio).

Good luck! :)
 
Thanks for the reply!

The mcp2515's are set wide open in listen only mode. If I create my own bus with another Arduino and mcp and set it to output random messages I can log them all at a rate of about 2k msg/sec without dropping any. But if I hook the same thing up to the car I get nothing. It's only when I turn on Leaf Spy do I see any traffic at all on either the oscilloscope or the mcps, and then only on the CAR bus and only requests and direct responses to Leaf Spy or torque queries.

The code I linked to has placeholders for the stuff I eventually want to monitor, but isn't actually looking for them yet. Right now it's just trying to dump everything...

Another interesting finding is that only the primary bus reports 2.5V from ground on CAN H/L when idle. The pins reported to be the other buses are around 1.5V. I'm not familiar enough with CAN to know if that's super weird or normal, though.

I feel like I'm the most likely source of error, but is it possible something changed in the 2018?
 
Shot in the dark: remember to remove/disable your termination resistors on your board when connecting to the leaf. The leaf provides termination.

Otherwise I'm not sure. It's possible 2018s are different. Have you tried to download the 2018 service manual yet? (is it even available?)
 
marwatk said:
Another interesting finding is that only the primary bus reports 2.5V from ground on CAN H/L when idle. The pins reported to be the other buses are around 1.5V. I'm not familiar enough with CAN to know if that's super weird or normal, though.

Typical automotive CAN buses:

1. CAN high - 3.5V to 1.5V, off state 2.5V
2. CAN low - 1.5V to 3.5V, off state 2.5V
3. CAN high & CAN low, differential input (noise immunity) to CAN receiver, termination resistor (120 ohms), value critical,
both buses have the terminators

Use a scope to verify both CAN signals.
 
I had some more time to play around with it this weekend and it just confirmed my previous findings.

I disconnected my arduino/mcp_can system and just hooked up my oscilloscope. Car off, car charging, car on, nothing matters. I get zero voltage differential between any of the CAN lines until I hook up the OBD dongle and start Leaf Spy. Here's what I did (I tried all lines, but will just report the CAR CAN):

With the car off hook up the scope to CAR CAN lines (L-14 H-6), shows 0V
Set a 1V one-shot trigger and wait... nothing
Keep trigger armed, turn on car... nothing
Wait a full minute after car enters drive mode... nothing
Plug in bluetooth LE OBD dongle... nothing
Start Leaf Spy... boom, first CAN message shows up on bus and it's the query from Leaf Spy

I don't have an older Leaf to test with, but my understanding from reading the CAN BUS threads is that I should be getting messages every few milliseconds passively. Is there another place to easily access any of the buses?

It's still possible I'm doing something horribly wrong, this is my first oscilloscope use, but I think they changed something with the 2018. I'm going to see if I can track down someone with an earlier model and confirm.
 
Back
Top