rangerovers.pub
The only place for a coil spring is up Zebedee's arse
Member
Joined:
Posts: 39

Just went throuigh the whole process, fantastic.

How did you get the ECU , BECM and trans ECU to talk to each other.?

Member
avatar
Joined:
Posts: 1228

The BECM just needs to see an engine speed to know the engine is running - that signal is then used to wake various things up. Conveniently, the M57 ECU outputs the same 3 pulses per revolution on an analogue output as the M51 diesel would have done. This does mean the instrument cluster needs swapping to a diesel version, or the tachometer would not read correctly. This is because the V8 outputs 4 pulses per revolution.

The gearbox ECU has been replaced with a compushift - which long term, I will be keeping, as it offers complete control over the shifting of the box. I still need to tweak this some more to get it 'just right' for me, but its only a couple of odd situations where it shifts a bit harshly for my liking currently.

It certainly isn't a drop in replacement - nothing about this really has been. The power steering maybe? Only needed one pipe bending to fit :)

Member
Joined:
Posts: 39

Thanks.
Mine is diesel M51. So no worries about ECU and BECM link.
Main fabrications are engine mounts and M57 to ZF plate (avaialble after market I guess), anything else?

Member
avatar
Joined:
Posts: 1228

Well, the sump won't fit, nor will the turbo actuator - so you'll need to fabricate some things to deal with both.

Member
Joined:
Posts: 426

Looking very tidy.

Member
avatar
Joined:
Posts: 1228

Thanks :D

Member
avatar
Joined:
Posts: 1228

Finally getting around to sorting the AC. Although it has been putting up a fight... parts not arriving, things going wrong... usual stuff.

I wanted to retain the V8 pipe routing, as there is very little room between my steering column shaft and turbo to route the suction line (big pipe) down to the AC compressor. Instead, my pipework runs between the front of the engine and the cooling fan. Not ideal, but tidier and its not actually really in the way of much.

enter image description here

enter image description here

enter image description here

enter image description here

I'm using Eaton's EZ clip fittings and GH001 hose. All of which are hard to come by and pretty expensive... but seem like they will do the job. Just got some bits to finish off before it goes in and I can leak check/fill it up.

Member
avatar
Joined:
Posts: 1228

I think this is all done now... finished off with a bracket off the front of the engine to support the suction line somewhat:

enter image description here

enter image description here

Considering its been a tad warm today and the car was almost 40c in the dash when I started it up... I'm pretty happy with this outcome.

Now to see if it keeps working...

Administrator
Joined:
Posts: 100

8°C is an amazing dream right here, it's 23°C and stupidly humid at midnight...

Member
avatar
Joined:
Posts: 1228

Unfortunately... while it is still working... it isn't going to for long -_-

My compressor is leaking. So this evening I'll be recovering the gas and hopefully swapping in another compressor if I can pick one up today. I guess it might have taken some damage in the crash - it was fine before.

Work on the cruise control has been proving difficult. Supposedly someone has been able to make it work, but I haven't had any luck in contacting them for a hint of what I might be missing.

Soon I'll probably end up with the majority of an E39 laid out in the shed electronically with every conceivable sensor input being emulated.

Member
Joined:
Posts: 87

Shame about the cruise,... Beady said he had done for his camper build, but as he made his own BECM it may be that he was able to simplify things?
He did answer my query eventually, I think he just doesn't look back over the build stuff on a daily basis.

Member
avatar
Joined:
Posts: 1228

Yeah - I have heard back from someone now so have a bit more to go on. The BeCM isn't really the issue - its not really involved in things. Its getting the relevant data into the engine ECU in a format that it likes, but without having an original donor vehicle to do some full data logging from where I can actually use the cruise control, it is difficult to know what to look for.

Still, made some progress last night - actually did my first BMW module coding too and it appears I haven't bricked my test ABS ECU which is a bonus :)

As for the AC... gas recovered, thankfully barely lost any. Replacement compressor sat waiting to be swapped in. As its another used item, I think I will get a rebuild kit for the one that comes off if it looks okay inside. I'm hoping it is just the top discharge plate seal that is the issue, but we'll see. Very hard to get a look at it while its hiding down on the underside of the engine.

Member
Joined:
Posts: 819

From dealing with Bosch Motronic ME7.5 its maybe worth pointing out that the cruise control routine has gear ratio inputs. Each gear is programmed as an allowable ratio between engine and road speed. If the engine speed and road speed dont match up, cruise wont engage. I presume this is so wheelspin or clutch slip or whatever causes the cruise to get disengaged.

I ran into this issue when i swapped a Audi TT ECU into my Audi A4. Different gearbox, different set of ratios, and cruise wouldnt work in certain gears, but would in others. Most annoyingly, it wouldnt work in 5th. I eventually fixed it by altering the actual map in the ECU to correct the allowed ratio values. It took bloody ages to sort out as well, as i didnt have the map location in the definition file, and ended up finding snips of information, had to decompile the rom, find a matching code snippet to get the address pointer to the correct table and then do some data logging in each gear to figure out what the correct values should be.

I presume this is a Bosch ECU from a similar era, so i would assume it has similar routines. You could try fiddling the road speed input into the ECU and see if you can get it into a speed range that the ECU is happy with?

Member
avatar
Joined:
Posts: 1228

Yeah - by all accounts the Bosch DDE4 has a similar thing going on with gear ratios.

I know what CAN ID wheel speeds need to be sent in on, but I think I'm missing something else yet.

Most annoyingly, my test setup on the bench isn't generating wheel speeds on said ID at all yet - and I'm not totally sure why. The dash is showing various ABS/DSC faults despite none being stored in the ECU. Perplexing... but I'll get there.

At this rate I'll end up buying another E39 auto just to do a data log on it...

Member
Joined:
Posts: 8

Hi Sloth,

Remind me, did your doner ECU come from a manual or Auto transmission car? Mine came from a "V" reg E39 auto and in order to get the cruise to work I am using an Arduino to simulate the CAN messages from the BMW auto box, which was needed to get the cruise working. You can use DIS to read the cruise control status which needs to show "0"

Member
avatar
Joined:
Posts: 1228

Interesting - the one on the car is flashed with manual software I believe.

Would you be open to sharing the messages you're sending to appease it? I haven't been able to look at it much lately but I'd like to get back to it.

Member
Joined:
Posts: 8

So the ECU needs to be happy that the car is in a valid gear for cruise to work. On a manual map the speed and engine rpm have to be in sync for a given gear so you need to know if yours is flashed for a five or six speed box as the ratios are different. You can also modify the required ratio's for each gear in the MAP file. On an auto map the gear selection is simply sent from the AGS as a CAN message, see below copied and pasted from another forum. Please keep us up to date with how you get on as I would like to change to a manual map at some point, so I will need to re-engineer the cruise control. Have you got a valid speed signal to the ECU? I'm using the Arduino to read the engine RPM and then fabricate the speed signal with some smoothing, based on the changing RPM, it works very well. You also need two brake pedal signals, I'm using the land rover's normal brake light feed for one signal and I've added an extra switch in the hydraulic circuit for the second signal. I'm certainly no expert on this but I did do a lot of research and testing and I'm happy to share any information that I can.

message from AGS 0x43F

byte 0 = 0x81 //doesn't do anything to the ike

byte 1 = 0x01 where;
01 = first gear
02= second gear
03 = third gear
04 = fourth gear
05 = D
06 = N
07 = R
08 = P
09 = 5
0A = 6

byte 2 = 0xFF where;
FF = no display
00 = E
39 = M
40 = S

byte 3 = 0xFF //doesn't do anything to the ike

byte 4 = 0x00 //doesn't do anything to the ike

byte 5 = 0x80 where;
80 = clears the gear warning picture - all other values bring it on

byte 6 = 0xFF //doesn't do anything to the ike

byte 7 = 0x00 //doesn't do anything to the ike

Member
Joined:
Posts: 8

And here is the Arduino code: -


#include <Canbus.h>
#include <defaults.h>
#include <global.h>
#include <mcp2515.h>
#include <mcp2515_defs.h>
#include <SoftwareSerial.h>

SoftwareSerial mySerial(3, 4); // RX, TX

int rpm = 123;                  //RPM of the engine
int freq = 111;                 //Frequency for signal generator
const int numReadings = 5;      //Size of array for smoothing RPM readings
int readings[numReadings];      // the readings from the input
int readIndex = 0;              // the index of the current reading
int total = 0;                  // the running total
int average = 0;                // the average

//********************************Setup Loop*********************************//

void setup() {

  Serial.begin(9600);
  Serial.println("CAN Write - Testing transmission of CAN Bus messages");
  delay(1000);

  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);

  if(Canbus.init(CANSPEED_500))  //Initialise MCP2515 CAN controller at the specified speed
    Serial.println("CAN Init ok");
  else
    Serial.println("Can't init CAN");

  delay(1000);
}

//********************************Main Loop*********************************//

void loop() {



  tCAN message;
  if (mcp2515_check_message()) {
    if (mcp2515_get_message(&message)) {

      // ID for RPM
      if(message.id == 0x316) {
        //Convert 0xFF, 0x12 to 0x12FF. [RPM=(hex2dec("byte3"&"byte2"))/6.4]
        rpm = (message.data[2] + ((message.data[3]*16)*16))/6.42; 

        // Start smoothing rpm
        total = total - readings[readIndex];  // subtract the last reading
        readings[readIndex] = rpm;            // read from the data
        total = total + readings[readIndex];  // add the reading to the total
        readIndex = readIndex + 1;            // advance to the next position in the array

        // if we're at the end of the array then wrap around to the beginning:
        if (readIndex >= numReadings) {
          readIndex = 0;
        }

        average = total / numReadings;  // calculate the average

        freq = average * 0.285; //Convert average RPM into frequency to generate
        mySerial.print("F");    //Send "F" to module.....followed by the frequency
        mySerial.print(freq);   //Send the frequency required to freq generator

        // Create message from gearbox controller
    /*
        byte 1 = 0x01 where;
        01 = first gear
        02= second gear
        03 = third gear
        04 = fourth gear
        05 = D
        06 = N
        07 = R
        08 = P
        09 = 5
    */
        tCAN message;
        message.id = 0x43F;         //ID for gearbox controller
        message.header.rtr = 0;
        message.header.length = 8;  //formatted in DEC
        message.data[0] = 0x81;
        message.data[1] = 0x04;     //4th Gear
        message.data[2] = 0x40;
        message.data[3] = 0xFF;     //formatted in HEX
        message.data[4] = 0x00;
        message.data[5] = 0x80;     //Clear errors
        message.data[6] = 0xFF;
        message.data[7] = 0x00;
        mcp2515_bit_modify(CANCTRL, (1<<REQOP2)|(1<<REQOP1)|(1<<REQOP0), 0);
        mcp2515_send_message(&message);
        delay(100);
      }
    }
  }
}
Member
avatar
Joined:
Posts: 1228

Interesting, is that sketch just to clear the lights on the BMW dash?

We thought we had sussed the vehicle speed signal going into the engine ECU, but it seems not quite. I'd be taking it from the P38's ABS ECU and converting it to the CAN messages required. I've seen about needing the engine speed and vehicle speed to line up and appease the mapping - though I don't know if I've gotten to that point or not yet.

Brake light switches are sorted on mine and appear to do their thing on diagnostics.

How are you feeding in your vehicle speed?

Member
Joined:
Posts: 8

That sketch reads engine RPM from the CAN bus, smooths the data, then sends a frequency request to a separate frequency generator module which sends a square wave speed signal to the ECU (I have an earlier ECU that accepts the square wave signal). It also clears any AGS related errors and tells the engine ECU that 4th gear has been selected.

Yes I thought in an earlier post you has sorted the correct CAN message for the speed signal? I assume the id is 0x153? The format is odd as it's LSB first, like the engine RPM. What message are you sending? Or maybe you have to send individual wheel speeds on id 0x1F0?