nickname3
Posts: 4
Joined: Thu Oct 29, 2020 12:03 pm
Delivery Date: 29 Feb 2020
Leaf Number: 053834

Re: LEAF CANbus decoding. (Open discussion)

Fri Nov 13, 2020 5:21 am

ginetto wrote:
Fri Nov 13, 2020 1:25 am
Always is a good contribution give back to the community if somethig has been derived from the community => yes please :)
Here you are:
Image
Sketch for Arduino IDE:
#include <SPI.h> //connect libraries
#include <mcp2515.h>
struct can_frame canMsg1;
struct can_frame canMsg2;
struct can_frame canMsg3;
MCP2515 mcp2515(10);
void setup() {

canMsg1.can_id = 0x681; //write commands to send here...
canMsg1.can_dlc = 8;
canMsg1.data[0] = 0x04;
canMsg1.data[1] = 0x10;
canMsg1.data[2] = 0x40;
canMsg1.data[3] = 0x0D;
canMsg1.data[4] = 0xAB;
canMsg1.data[5] = 0xFF;
canMsg1.data[6] = 0xFF;
canMsg1.data[7] = 0xFF;

canMsg2.can_id = 0x681;
canMsg2.can_dlc = 8;
canMsg2.data[0] = 0x04;
canMsg2.data[1] = 0x20;
canMsg2.data[2] = 0x40;
canMsg2.data[3] = 0x0D;
canMsg2.data[4] = 0xAB;
canMsg2.data[5] = 0xFF;
canMsg2.data[6] = 0xFF;
canMsg2.data[7] = 0xFF;

canMsg3.can_id = 0x681;
canMsg3.can_dlc = 8;
canMsg3.data[0] = 0x04;
canMsg3.data[1] = 0x30;
canMsg3.data[2] = 0x40;
canMsg3.data[3] = 0x0D;
canMsg3.data[4] = 0xAB;
canMsg3.data[5] = 0xFF;
canMsg3.data[6] = 0xFF;
canMsg3.data[7] = 0xFF;

while (!Serial);
Serial.begin(115200);
SPI.begin();
mcp2515.reset();
mcp2515.setBitrate (CAN_500KBPS, MCP_8MHZ); //check your quartz on mcp2515
mcp2515.setNormalMode();
Serial.println("Killing blue screen...");
}

void loop() {
delay(8000); //delay for starting vehicle 8s
mcp2515.sendMessage(&canMsg1);
Serial.println("Message 1 sent");
delay(100);
mcp2515.sendMessage(&canMsg2);
Serial.println("Message 2 sent");
delay(100);
mcp2515.sendMessage(&canMsg3);
Serial.println("Message 3 sent");
delay(100);
Serial.println("Blue screen was killed!");

while (true);
}

ginetto
Posts: 15
Joined: Mon Sep 16, 2019 11:32 pm
Delivery Date: 17 Sep 2019
Location: Galicia (Spain)

Re: LEAF CANbus decoding. (Open discussion)

Sat Nov 14, 2020 10:38 am

nickname3 wrote:
Fri Nov 13, 2020 5:21 am
Here you are:
Image
Thanks :) probably should connect to ODBII pin 6 (canH) and 14(canL) instead of 3 and 11 ? or 2 and 11 are can lines for infotainement?

nickname3
Posts: 4
Joined: Thu Oct 29, 2020 12:03 pm
Delivery Date: 29 Feb 2020
Leaf Number: 053834

Re: LEAF CANbus decoding. (Open discussion)

Sun Nov 15, 2020 4:54 am

ginetto wrote:
Sat Nov 14, 2020 10:38 am
nickname3 wrote:
Fri Nov 13, 2020 5:21 am
Here you are:
Image
Thanks :) probably should connect to ODBII pin 6 (canH) and 14(canL) instead of 3 and 11 ? or 2 and 11 are can lines for infotainement?
Yes, 3 and 11 - it's AV-CAN. More details in first post of this theme. viewtopic.php?f=44&t=4131#p97509
Now I research, how automaticly to connect to different CAN buses of LEAF (primary, EV, AV). The first thing that comes is dual relay module. But it's connect just to 2 buses of 3 :(

bearer
Posts: 18
Joined: Sun Sep 11, 2016 12:56 am
Delivery Date: 11 Sep 2016
Leaf Number: 012853

Re: LEAF CANbus decoding. (Open discussion)

Sun Nov 15, 2020 3:49 pm

nickname3 wrote:
Fri Nov 13, 2020 5:21 am
Here you are:
High five! btw you can compact the code a fair bit by moving the can data to the struct initialization, ref https://pastebin.com/vH0iU6hb

(half way done with a easyeda layout for stm8, mcp2515 and sn65hvd230, just need to find a solution for 12v to 3.3v thats in jlcpcb's basic selection. will share on the new oshwlab.com site when done, guessing it'll take a while as i'll probably have to find some obscure chinese dc/dc converter to avoid the extended part fee. under $3 in parts so far or less than $40 for 10 boards assembled)
Last edited by bearer on Mon Nov 16, 2020 6:23 pm, edited 2 times in total.

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

Re: LEAF CANbus decoding. (Open discussion)

Sun Nov 15, 2020 10:22 pm

nickname3 wrote:
Sun Nov 15, 2020 4:54 am
ginetto wrote:
Sat Nov 14, 2020 10:38 am
nickname3 wrote:
Fri Nov 13, 2020 5:21 am
Here you are:
Image
Thanks :) probably should connect to ODBII pin 6 (canH) and 14(canL) instead of 3 and 11 ? or 2 and 11 are can lines for infotainement?
Yes, 3 and 11 - it's AV-CAN. More details in first post of this theme. viewtopic.php?f=44&t=4131#p97509
Now I research, how automaticly to connect to different CAN buses of LEAF (primary, EV, AV). The first thing that comes is dual relay module. But it's connect just to 2 buses of 3 :(
You could use multiple MCP2515s on the SPI bus. The library supports at least 2. Might run out of memory with 3.

https://github.com/coryjfowler/MCP_CAN_ ... al_CAN.ino
Former 2012 SL leasee (6/23/12 - 9/23/15)
Former Honda Fit EV leasee
Former Chevy Spark EV owner
Now driving Tesla Model 3

bearer
Posts: 18
Joined: Sun Sep 11, 2016 12:56 am
Delivery Date: 11 Sep 2016
Leaf Number: 012853

Re: LEAF CANbus decoding. (Open discussion)

Mon Nov 16, 2020 2:47 am

JeremyW wrote:
Sun Nov 15, 2020 10:22 pm
nickname3 wrote:
Sun Nov 15, 2020 4:54 am
ginetto wrote:
Sat Nov 14, 2020 10:38 am


Thanks :) probably should connect to ODBII pin 6 (canH) and 14(canL) instead of 3 and 11 ? or 2 and 11 are can lines for infotainement?
Yes, 3 and 11 - it's AV-CAN. More details in first post of this theme. viewtopic.php?f=44&t=4131#p97509
Now I research, how automaticly to connect to different CAN buses of LEAF (primary, EV, AV). The first thing that comes is dual relay module. But it's connect just to 2 buses of 3 :(
You could use multiple MCP2515s on the SPI bus. The library supports at least 2. Might run out of memory with 3.

https://github.com/coryjfowler/MCP_CAN_ ... al_CAN.ino
or you could use one mcp2515 with three SN65HVD231DR and make sure to put two to sleep at the time?

bearer
Posts: 18
Joined: Sun Sep 11, 2016 12:56 am
Delivery Date: 11 Sep 2016
Leaf Number: 012853

Re: LEAF CANbus decoding. (Open discussion)

Mon Nov 16, 2020 2:54 am

lucasfr wrote:
Tue Nov 10, 2020 7:13 am

I'm using Raspberry Pi 4 + 2515 + OBD + Arduino and nothing worked.
Pi + 2515 + OBD? Not sure i follow, the OBD adapter you link to is wireless bluetooth so no need for the 2515. And if you're trying to use a 2515 module with tja1050 transciever i think you'll have problems with the transciever needing 5v?
Last edited by bearer on Mon Nov 16, 2020 6:23 pm, edited 1 time in total.

bearer
Posts: 18
Joined: Sun Sep 11, 2016 12:56 am
Delivery Date: 11 Sep 2016
Leaf Number: 012853

Re: LEAF CANbus decoding. (Open discussion)

Mon Nov 16, 2020 2:57 am

Dala wrote:
Sun Jun 07, 2020 12:43 pm
By injecting a CAN-message to the AV-CAN, it is possible to bypass this nag-screen and go straight to radio/maps.
I just wondered, bypassing it this way might be akin to pressing cancel and not ok - resulting in telemetry not getting uploaded to nissan for those who use carwings for that sort of thing?

User avatar
Dala
Posts: 316
Joined: Sun Oct 28, 2018 11:24 am
Delivery Date: 01 Jan 2015
Leaf Number: 316851
Location: Finland
Contact: Website

Re: LEAF CANbus decoding. (Open discussion)

Wed Nov 18, 2020 5:52 am

bearer wrote:
Mon Nov 16, 2020 2:57 am
Dala wrote:
Sun Jun 07, 2020 12:43 pm
By injecting a CAN-message to the AV-CAN, it is possible to bypass this nag-screen and go straight to radio/maps.
I just wondered, bypassing it this way might be akin to pressing cancel and not ok - resulting in telemetry not getting uploaded to nissan for those who use carwings for that sort of thing?
No clue. Nobody has reproted back any issues yet. Might be fine, might not. Time will tell!

I recently did some reverse engineering on the ZE1 EV-CAN, made a very boring youtube video on the process. I don't recommend you watch this one.
https://www.youtube.com/watch?v=ty1VYmNWXFc

bearer
Posts: 18
Joined: Sun Sep 11, 2016 12:56 am
Delivery Date: 11 Sep 2016
Leaf Number: 012853

Re: LEAF CANbus decoding. (Open discussion)

Thu Nov 19, 2020 2:40 am

Dala wrote:
Wed Nov 18, 2020 5:52 am
Might be fine, might not. Time will tell!
Its not a problem as such, at least not bigger than not pressing ok in the first place. I reported the wrong mileage on my leaf once because of a sizeable discrepancy between carwings history and odometer in car - and I presume that is because I hardly ever press OK. Or it could be just the way carwings doesn't work, anyways it might be worth while making a note of it, in case it is an issue for some.

Return to “LEAF CANBus”