Page 1 of 1

Will this work: 4L65e, MShift on GPIO, CAN to Arduino?

Posted: Sun Dec 08, 2013 7:24 pm
by mcneil
I'm about to place an order for the MShift GPIO kit, Transstim, and a CAN shield for the Arduino and I'd appreciate if someone would share their thoughts on whether or not this will work. Bear with me, I'm a mechanical engineer just learning microcontrollers, so if it looks like I barely know what I'm doing, you're spot on.

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!

Re: Will this work: 4L65e, MShift on GPIO, CAN to Arduino?

Posted: Tue Dec 10, 2013 9:34 am
by Bernard Fife
mcneil,

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?

Posted: Tue Dec 10, 2013 2:56 pm
by mcneil
Thanks Lance! I'm studying the 1.101 code, and I think I'm starting to understand pieces of it. My fall-back plan if I can't get the CAN working is to use the analog inputs on the Arduino to read a PWM signal from the MShift. I'm also approaching things incrementally, trying to get each piece working, building on that, then coming back and upgrading as I go. I have some other options for VSS too if I need to.

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