marwatk
Posts: 4
Joined: Wed Mar 07, 2018 8:27 am
Delivery Date: 16 Mar 2018
Leaf Number: 4964

Passive monitoring of CAN buses?

Sun Apr 29, 2018 9:16 am

I built an arduino setup using a few of these:

https://smile.amazon.com/SMAKN-MCP2515- ... ds=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

marwatk
Posts: 4
Joined: Wed Mar 07, 2018 8:27 am
Delivery Date: 16 Mar 2018
Leaf Number: 4964

Re: Passive monitoring of CAN buses?

Sun May 06, 2018 2:28 pm

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...

User avatar
JeremyW
Posts: 1540
Joined: Sun Nov 13, 2011 12:53 am
Delivery Date: 23 Jun 2012
Leaf Number: 19136
Location: San Gabriel, CA

Re: Passive monitoring of CAN buses?

Sun May 06, 2018 8:15 pm

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! :)
Former 2012 SL leasee 6/23/12 - 9/23/15
Now driving Honda Fit EV, License plate: CHADEMO
2000 Honda Insight for long trips

marwatk
Posts: 4
Joined: Wed Mar 07, 2018 8:27 am
Delivery Date: 16 Mar 2018
Leaf Number: 4964

Re: Passive monitoring of CAN buses?

Wed May 16, 2018 8:44 pm

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?

User avatar
JeremyW
Posts: 1540
Joined: Sun Nov 13, 2011 12:53 am
Delivery Date: 23 Jun 2012
Leaf Number: 19136
Location: San Gabriel, CA

Re: Passive monitoring of CAN buses?

Wed May 16, 2018 9:38 pm

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?)
Former 2012 SL leasee 6/23/12 - 9/23/15
Now driving Honda Fit EV, License plate: CHADEMO
2000 Honda Insight for long trips

lorenfb
Posts: 1835
Joined: Tue Dec 17, 2013 10:53 pm
Delivery Date: 22 Nov 2013
Leaf Number: 416635
Location: SoCal

Re: Passive monitoring of CAN buses?

Wed May 16, 2018 10:20 pm

marwatk wrote:
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.
Leaf SL MY 9/13: 66K miles, 50 Ahrs, 5.2 miles/kWh (average), Hx=70, SOH=78, L2 charges to 100% > 1000, max battery temp < 95F (35C), min discharge point > 20 Ahrs

marwatk
Posts: 4
Joined: Wed Mar 07, 2018 8:27 am
Delivery Date: 16 Mar 2018
Leaf Number: 4964

Re: Passive monitoring of CAN buses?

Sat Jun 09, 2018 2:31 pm

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.

Return to “LEAF CANBus”