can id´s 4 Gear Selector

Jaguar / Landrover hardware hacking
VanGogh
Posts: 41
Joined: Mon Apr 03, 2023 7:33 pm
Has thanked: 2 times
Been thanked: 1 time

Re: can id´s 4 Gear Selector

Post by VanGogh »

I checked the code Gen1 by tom91 with a modified void setup ().

Code: Select all

void setup()
{
  Serial.begin(115200);

  if (CAN0.begin(MCP_ANY, CAN_500KBPS, MCP_16MHZ) == CAN_OK)
  {
    Serial.println("CAN Init OK");
  }
  else
  {
    Serial.println("CAN Init Failed");
  }
  CAN0.setMode(MCP_NORMAL);
  pinMode(CAN0_INT, INPUT);
}
Now everything works great. The first module (silver) performs all functions. The second module (black) does not unlock, I think the problem is in the solenoid. The question about the brake pedal remained open.
LRBen
Posts: 531
Joined: Thu Jul 04, 2019 6:35 pm
Location: Somerset, UK
Has thanked: 65 times
Been thanked: 164 times

Re: can id´s 4 Gear Selector

Post by LRBen »

VanGogh wrote: Wed Jul 12, 2023 6:03 pm Now the knob rotates freely. But in the car, it is locked and only when the brake pedal is pressed does the knob unlock. How to implement it? What data needs to be sent to the CAN bus?
Wouldn't be too hard to implement. We know what canbus is used to lock or unlock the knob, you could run the brake light voltage through a relay (So you don't send 12v into an arduino pin)to act as a signal for the arduino. When the brake light is on, send the canbus messages to unlock.
VanGogh
Posts: 41
Joined: Mon Apr 03, 2023 7:33 pm
Has thanked: 2 times
Been thanked: 1 time

Re: can id´s 4 Gear Selector

Post by VanGogh »

Hello. If anyone needs a modified GEN1 code to connect the relay to the module buttons. Also added module highlighting. But I can’t find what data I need to send to the Can bus to block the knob in the P and R positions. And how to track when the ignition is off and the knob is down (I need this to restart the arduino)?
Attachments
Input arduino.jpg
Jaguar_CAN.ino
(5.89 KiB) Downloaded 250 times
VanGogh
Posts: 41
Joined: Mon Apr 03, 2023 7:33 pm
Has thanked: 2 times
Been thanked: 1 time

Re: can id´s 4 Gear Selector

Post by VanGogh »

LRBen wrote: Wed Jul 12, 2023 6:49 pm When the brake light is on, send the canbus messages to unlock.
What message exactly unlocks and locks the knob? And what message does the knob drop down?
LRBen
Posts: 531
Joined: Thu Jul 04, 2019 6:35 pm
Location: Somerset, UK
Has thanked: 65 times
Been thanked: 164 times

Re: can id´s 4 Gear Selector

Post by LRBen »

VanGogh wrote: Mon Jul 17, 2023 7:22 pm What message exactly unlocks and locks the knob? And what message does the knob drop down?
On Gen 1 I think just switching off ignition 12v will lower the knob. You should be able to lock it by just not sending any canbus messages.

Afraid it's been a while since I looked at this so I can't remember much. But all the information is on this thread. Experiment with it for the details.
VanGogh
Posts: 41
Joined: Mon Apr 03, 2023 7:33 pm
Has thanked: 2 times
Been thanked: 1 time

Re: can id´s 4 Gear Selector

Post by VanGogh »

Do you think the voltage on the start/stop button and the handbrake depends on the CAN bus signal or not? I apply 12V to pin 12 (Wake up). And on pins 7, 18 and 11-ground (start/stop) I get 0V. But according to GSMTSM - Pinout.pdf they must be under voltage. The same situation with manual brake, on pins 8,9,10,19,20 I get 0V. Maybe I need to send some kind of message to the can bus and wake up these outputs? Or these contacts work on the Lin bus
Attachments
Diagram Start_Stop.jpg
GSMTSM - Pinout.pdf
(484.6 KiB) Downloaded 251 times
nkiernan
Posts: 544
Joined: Mon Feb 24, 2020 8:59 pm
Location: Ireland
Has thanked: 330 times
Been thanked: 72 times

Re: can id´s 4 Gear Selector

Post by nkiernan »

VanGogh wrote: Thu Jul 20, 2023 7:16 am Do you think the voltage on the start/stop button and the handbrake depends on the CAN bus signal or not?
Did you check if the start button for example simply closes a switch, so continuity between ground and start_stop_1 when button is pressed?
VanGogh
Posts: 41
Joined: Mon Apr 03, 2023 7:33 pm
Has thanked: 2 times
Been thanked: 1 time

Re: can id´s 4 Gear Selector

Post by VanGogh »

This is not a simple switch. There is a resistor between the buttons and ground. When the button is pressed, there is no short circuit between ground and start_stop_1 or _2. The tracks from the buttons go inside the board and there is no way to track them
Attachments
IMG20230721084921.jpg
connor016
Posts: 6
Joined: Tue Jan 03, 2023 5:25 pm
Has thanked: 3 times
Been thanked: 3 times

Re: can id´s 4 Gear Selector

Post by connor016 »

Great info here! I was able to get one working with an UNO and CAN shield with tom91's code for gen 2. It appears to all work without crashing except the sport mode does not engage. Below is a photo of the model for reference if anyone is looking for one:
IMG_2925.jpg
I will try LRBen's code when I get a DUE. Note with the code above, you need to make the following changes as others noted that I missed initially (likely due to a newer library for mcp_can):
1) Add MCP_ANY in the setup loop:
while (CAN_OK != CAN0.begin(MCP_ANY, CAN_500KBPS, MCP_16MHZ)) // init can bus : baudrate = 500k 8MHZ crystal
2) Add the following line at the end of the setup loop:
CAN0.setMode(MCP_NORMAL); // Change to normal mode to allow messages to be transmitted
VanGogh
Posts: 41
Joined: Mon Apr 03, 2023 7:33 pm
Has thanked: 2 times
Been thanked: 1 time

Re: can id´s 4 Gear Selector

Post by VanGogh »

Hello. I looked at the logs from tom91 for Gen1. I don't understand. How does ID 312 turn 0x20 (locked) into 0x10 (unlock)? What command blocks the knob? If you look at Gen2 ID 02C there are two command 0x00 and 0x40 (D3). But they don't work for Gun1
Attachments
Log Jag.JPG
Post Reply