Will this work: 4L65e, MShift on GPIO, CAN to Arduino?
Will this work: 4L65e, MShift on GPIO, CAN to Arduino?
Here's the application: A VW diesel in a 2000 Jeep Wrangler, with a custom built 4L65e. The Jeep ECM has been removed and replaced with the VW unit. The Arduino is talking to a gauge driver chip over SPI to directly command position of the air-core gauges in the Jeep instrument cluster. The MShift will be tasked with controlling the 4L65e and reporting to the Arduino over CAN values for Input shaft speed and output shaft speed. The Arduino will take those inputs through its CAN shield, scale for tire size/gearing/4-lo/etc, and command the appropriate gauge positions.
The current state: Everything is 90% complete mechanically, just making up the last of the hoses now. The Arduino-controlled instrument cluster is working on the bench, responding to analog or serial inputs. I've read through all the docs on 4L60e apps (excellent documentation, btw), setup Codewarrior and read through everything I can understand. I found the output CAN structure - doesn't look like output shaft speed or VSS is in there.
My questions:
1. Is this the right use of a MShift?
2. Do you think the CAN communcation will work?
3. How hard is it to add vehicle speed to the CAN outputs?
Thanks in advance for the help!
-
- Posts: 1696
- Joined: Fri Apr 04, 2008 1:28 pm
Re: Will this work: 4L65e, MShift on GPIO, CAN to Arduino?
In theory, this is certainly possible. You can put any outpc values you like (including VSS and output shaft speed) into the CAN outmsg structure(s) using TunerStudio,and exchange those values with any other CAN controller, so that is not a problem. The problem is likely to come in writing the MegaSquirt-compatible CAN code for the arduino, as this is a decidedly non-trivial task, especially for someone just learning micro controllers. You might want to look at the 1.101 code ( http://www.msgpio.com/manuals/iocode/code.htm ) to see how it has been done for the HCS12 (I should warn you that the CAN and serial code logic isn't easy to follow - at least it wasn't for me).
Lance.
Re: Will this work: 4L65e, MShift on GPIO, CAN to Arduino?
This is the Arduino CAN shield I had in mind:
http://www.seeedstudio.com/wiki/CAN-BUS_Shield
Sparkfun has another one, but the example code on the Seeedstudio shield seems easier to understand for me. In fact, it looks almost too easy. Here's the sample arduino code for receiving a CAN message
// demo: CAN-BUS Shield, receive data
#include <mcp_can.h>
#include <SPI.h>
unsigned char Flag_Recv = 0;
unsigned char len = 0;
unsigned char buf[8];
char str[20];
void setup()
{
CAN.begin(CAN_500KBPS); // init can bus : baudrate = 500k
attachInterrupt(0, MCP2515_ISR, FALLING); // start interrupt
Serial.begin(115200);
}
void MCP2515_ISR()
{
Flag_Recv = 1;
}
void loop()
{
if(Flag_Recv) // check if get data
{
Flag_Recv = 0; // clear flag
CAN.readMsgBuf(&len, buf); // read data, len: data length, buf: data buf
Serial.println("CAN_BUS GET DATA!");
Serial.print("data len = ");
Serial.println(len);
for(int i = 0; i<len; i++) // print the data
{
Serial.print(buf);Serial.print("\t");
}
Serial.println();
}
}
/*********************************************************************************************************
END FILE