Outlander VCU - Rear inverter, Charger and BMS

Mitsubishi hybrid drive unit hacking
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

Update time!

1. DC precharge process works.
2. Inverter goes to neutral and sends CAN
3. Signal forward will translate into motor turning reverse - have to sort this out
4. Signal reverse will translate into motor turning forward - naturally
There is substsantial jolt with release of the brake and i see i have some torque commanded without throttle press. I will have to sort that out.

5. Charging process works but charger wont turn on - i have to investigate this as i have wired Cp and PP correctly but AC voltage seems not to arrive to charger...
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

Ok now... i see some strange behaviour.
When i put the car from N to FWD or REV and release the throttle i get a jolt in the opposite direction.
When i look at serial menu i get -222 torque request. How come?

My pedal is at chA 530 and chB 1420 difference 2.67
When i try to set pedal offset my procedure is like this: my son will release throttle pedal and i will send serial character 6. Then he will press pedal just a little and i will send 7. Is that correct? This will get me minoffset 1420 and maxoffset 1730 or somesuch.

But then when i look at throttle debug i get 37% throttle???! Can you comment

EDIT: I notice i get DC voltagfe at 360V but DCDC is reporting only 178V. Is this an error in code? As i remember DCDC reports a single byte which is 1/2 of the value.
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

Next update...

I had to reconfigure 0x285 telegram because my charger needs this sent at 50ms. While i was at it i made this the same for inverter.
Now my charger works at full power. I still have to insert my voltage inhibit loop but i am confident this will work.

I made a heater telegram loop and inserted it into drive and charging cases. I needed to provide some additional logic to drive its pump. I simply stole your Pump function as i use Fan function to drive both inverter pump and fan.

Inverter still jolts as soon as i turn it to FWD or RWD and whenever i press brake. I will need something done with resistor divider at ADC0 and ADC1. I think it is hardware fault.
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

@aot93 Can you suggest where in your code would be best to put a negative sign so reverse direction would become forward?
I realized i mounted the motor in reverse way as is mounted in PHEV. Its annoying.
I am thinking of simply adding a negative sign in the torque command calculation. Better yet would be to make a case which would be selected from the serial menu.

EDIT:
Hm... maybe i would simply add a switchable variable to targetTorque equasion here. Then i could select parameter "seldir" from serial menu and save it to EEPROM. What do you think?

Code: Select all

    if (pedal_offset > 1 && regenState != 0) 
    {

      regenState = 2;
      regenTarget = 0;

      if (regenRequest >= -9)
      {
        regenState = 0;
        regenTarget = 0;
        regenRequest = 0;
        brakeDelay = 0;
        digitalWrite(OUT4, LOW); // Brake Lights off
      }
    }
    else if (pedal_offset > 1 && regenState != 2)
    {
      inverterFunction = 0x03;                              // Enable inverter
      targetTorque = (throttlePosition * pedal_offset) * 2 * seldir; //*2 because we are 200nm Max torque // seldir value is either 1 or -1
      regenState = 0;
      regenTarget = 0;
      regenRequest = 0;
    }
Or maybe i could add "seldir" parameter to the line where torque request is calculated

Code: Select all

   torqueRequest*seldir += 10000;
tnx
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

Hm... tested with the following change just befoer 10000 value addition;

Code: Select all

    torqueRequest = torqueRequest * selectdir;
    torqueRequest += 10000; 
selectdir = -1; was selected for default
This produced the correct direction for FWD, however when i selected REV motor still wanted to spin forwards!
I might add that feeling of torque provided was a lot more than previously.
Help would be appreciated...
User avatar
midway
Posts: 79
Joined: Mon Feb 15, 2021 3:52 pm
Location: Ural
Has thanked: 5 times
Been thanked: 8 times

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by midway »

Code: Select all

void inverterComms()
{
  if (timer50_1.check() == 1)
  {

    if (regenState == 0 && VCUstatus == 4 && motorRPM > 2000) // Increment Torque delivery
    {

      if (curentTorque < targetTorque)
      {
        curentTorque += torqueIncrement;
        torqueRequest = curentTorque;
      }

      if (curentTorque >= targetTorque)
      {
        torqueRequest = targetTorque;
        curentTorque = targetTorque;
      }
    }
    else if (regenState == 0 && VCUstatus == 4 && motorRPM < 2000)
    {
      torqueRequest = targetTorque;
      curentTorque = torqueRequest;
    }

    if (active_map == 3 && VCUstatus == 4) // No need to increment in 'sport' mode
    {
      torqueRequest = targetTorque;
      curentTorque = torqueRequest;
    }

    if (regenState == 1 && VCUstatus == 4)

    {
      if (regenTarget < regenRequest) // increment Regen
      {
        regenRequest -= 5;
        torqueRequest = regenRequest;
        // Serial.println("Regen inc.");
      }
      else
        regenRequest = regenTarget;
      torqueRequest = regenRequest;
    }

    if (regenState == 2 && VCUstatus == 4)

    {
      if (regenTarget > regenRequest) // increment Regen off
      {
        regenRequest += 30;
        torqueRequest = regenRequest;
        // Serial.println("Regen Dec.");
      }
    }

    if (torqueRequest > (2000))
    {
      torqueRequest = 0;
      Serial.println("--!OVER TOURQUE!--");
    }
    if (torqueRequest < (-1000))
    {
      torqueRequest = 0;
      Serial.println("--!UNDER TOURQUE!--");
    }
    torqueRequest = torqueRequest*-1;   //REVERSE!!!
    torqueRequest += 10000;

    if (BMS_discurrent < currentact) // Decrese tourque if we are over current - Crude needs work..
    {
      torqueRequest -= 20;
      Serial.println("--!OVER CURRENT!--");
      if (torqueRequest < 0)
      {
        torqueRequest = 0;
      }
    }

    if (pedalDebug == 1)
    {
      Serial.print("Offset: ");
      Serial.print(pedal_offset);
      Serial.print(" Tourque Request: ");
      Serial.println(torqueRequest - 10000);
      Serial.print("Regen Target:");
      Serial.print(regenTarget);
      Serial.print(" Regen Request: ");
      Serial.print(regenRequest);
      Serial.print(" Motor Torque ");
      Serial.println(motorTorque);
    }
    if (inverterEnable != 1)
    {
      inverterFunction = 0x00;
    }
    torqueLoByte = lowByte(torqueRequest);
    torqueHibyte = highByte(torqueRequest);
    msg.id = 0x287;
    msg.len = 8;
    msg.buf[0] = 0;
    msg.buf[1] = 0;
    msg.buf[2] = torqueHibyte;
    msg.buf[3] = torqueLoByte;
    msg.buf[4] = 0;
    msg.buf[5] = 0;
    msg.buf[6] = inverterFunction;
    msg.buf[7] = 0;
    Can2.write(msg);
    torqueRequest = 0;
  }

  if (timer100_1.check() == 1)
  {
  
    msg.id = 0x371;
    msg.len = 8;
    msg.buf[0] = 48;
    msg.buf[1] = 0;
    msg.buf[2] = 0;
    msg.buf[3] = 0;
    msg.buf[4] = 0;
    msg.buf[5] = 0;
    msg.buf[6] = 0;
    msg.buf[7] = 0;
    Can2.write(msg);
    delay(1);
    msg.id = 0x285;
    msg.len = 8;
    msg.buf[0] = 0;
    msg.buf[1] = 0;
    msg.buf[2] = 20;
    msg.buf[3] = 57;
    msg.buf[4] = 143;
    msg.buf[5] = 254;
    msg.buf[6] = 12;
    msg.buf[7] = 16;
    Can2.write(msg);
    delay(1);

    msg.id = 0x286;
    msg.len = 8;
    msg.buf[0] = 0;
    msg.buf[1] = 0;
    msg.buf[2] = 0;
    msg.buf[3] = 61;
    msg.buf[4] = 0;
    msg.buf[5] = 0;
    msg.buf[6] = 33;
    msg.buf[7] = 0;
    Can2.write(msg);
  }
}
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

midway wrote: Sun Jan 07, 2024 5:16 pm

Code: Select all

void inverterComms()
...

    torqueRequest = torqueRequest*-1;   //REVERSE!!!
    torqueRequest += 10000;

}
That is exactly what i did with selectdir = -1;
It is confusing though when i apply -1 value the forward direction is correct and wheels rotate forwards. However when i reverse my console wheels should turn in reverse! But no, it still wants to go forwards except with lesser torque.

Can you show me where directly the mechanism for FWD - REV direction selection change on console is in the code? Maybe i have made some mistake...

tnx
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

@Aot93
Uh...is it possible that code was written for a car which uses its transmission to shift to reverse?
And it does not in any way changes torque value across 10000?
That would explain why i cant see any pivot code which would drive motor in reverse...
tom91
Posts: 1308
Joined: Fri Mar 01, 2019 9:15 pm
Location: Bristol
Has thanked: 103 times
Been thanked: 216 times

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by tom91 »

Just get it to serial print the values so you can track your mistakes you made by modifying the code without understanding it fully.

You could easily be mis assuming things.
Founder Volt Influx https://www.voltinflux.com/
Webstore: https://citini.com/
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

tom91 wrote: Sun Jan 07, 2024 10:00 pm Just get it to serial print the values so you can track your mistakes you made by modifying the code without understanding it fully.

You could easily be mis assuming things.
Good point i think torquerequest is reported in one serial function already. I will get on it.
User avatar
aot93
Posts: 198
Joined: Mon Feb 15, 2021 5:45 pm
Location: UK, West Sussex
Has thanked: 6 times
Been thanked: 43 times

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by aot93 »

Hi Sorry for the lack of interaction, I'm traveling with work and have limited time at the moment.

To answer a few questions -

This is all coded for the motor mounted in the OEM position, so positive values will spin forward negative will spin backwards. My application uses motor and diff connected directly to the drive shafts.
Reverses flag (torque *-1) and subsequent limiting of speed and torque is only set once, setting it some where else will likely cause a double negative and a forward spin
As for the jolts it sounds like bad ADC readings to me, use the pedal de-bug functions to check you are getting the expected results.
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

aot93 wrote: Tue Jan 09, 2024 11:04 am Reverses flag (torque *-1) and subsequent limiting of speed and torque is only set once, setting it some where else will likely cause a double negative and a forward spin
...
Could you indicate the line in code where you use the reverse flag please. I cant seem to find it inside the code....

Tnx

EDIT: Well i found out i made a mistake in code where i left a minus sign at 2140 line:

Code: Select all

      targetTorque = (throttlePosition * pedal_offset) * -2;

Now that i removed all distractions i can say the motor creates torque and everything is smooth, BUT torque direction is in reverse.
Please whenever you are able let me know where in code do you address the torque direction and by which parameter.

EDIT2: After a lengthy comparison and tests i identified out two lines that govern direction of torque in code that work as i wanted.
line that will manage torque when Forward is selected:

Code: Select all

     targetTorque = (throttlePosition * pedal_offset) * 2;
I changed it by providing negative conotation:

Code: Select all

     targetTorque = (throttlePosition * pedal_offset) * -2;

Line that will manage torque in Reverse:

Code: Select all

      torqueRequest = throttlePosition * -6;
Here i changed to positive

Code: Select all

      torqueRequest = throttlePosition * 6;
Now this provides correct direction of rotation. About the only thing left is to determine correct pedal offset because whenever i start from N the car wants to freep forward/backwards...

When i am done i will publish my version of code on my github
https://github.com/arber333/Mini-E-VCU
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

@midway or @aot93 can you help me confirm how pedal offset works?
1. Low offset

Code: Select all

tpslowOffset = 1300;  // Value when i just put my foot on the pedal and push a bit when reading the offset
 
This means i need to set this value just a bit over the value my pedal sits when my foot is off

2. High offset

Code: Select all

 tpshighOffset = 1400; // Value when pedal fully pressed 
This means i need to my foot fully to the pedal when reading the offset

Did i get this correctly or should this work differently?
My pedal value when foot is off is 1330mV. When fully on i get 4090.

EDIT: Also what to do with torqueIncrement parameter?

tnx
User avatar
aot93
Posts: 198
Joined: Mon Feb 15, 2021 5:45 pm
Location: UK, West Sussex
Has thanked: 6 times
Been thanked: 43 times

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by aot93 »

Hi Arber,

First off the reverse code is in the reverse swich case:

Code: Select all

    digitalWrite(OUT12, HIGH); // Turn on the reversing lights

    if (throttlePosition > 5)
    {
      torqueRequest = throttlePosition * -6; // lets make the pedal less responsive
      inverterFunction = 0x03;
      if (motorRPM < -2000)
      {
        torqueRequest = 0;
      }
I *-6 to make limit the torque available - accidental full torque in reverse would be quite something in the mini.

As for the offsets you have understood right, low offset is foot off the pedal and high is foot pressed down on the pedal.
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

aot93 wrote: Thu Jan 11, 2024 7:12 pm As for the offsets you have understood right, low offset is foot off the pedal and high is foot pressed down on the pedal.
And what to do with torqueIncrement parameter? Do you know certain "best" values or should i simply try it and see...

I am now looking at the code for the beasty jolt when stepping on the break at a stop.
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

Well that is unpleasant surprise! :o

When i couldnt get any RPM information from my VCU i started to investigate CAN reports. I noticed telegram 0x289 byte7 wouldnt report disable condition the same as we have it documented here...
I observed VCU report and i cant see any relavant data through serial port. I even noticed DCDC report is at 1/2 voltage. Any idea why is that?
Command to DCDC, Charger and Heater still work though.
VCU Staus: 2Active Map:2 BMS Status: 1 Charger Status: 0 BMS Current: 0.00 BMS HV: 0.00 BMS TEMP: 0.00 BMS Dischrge Limit225
SOC %: 97 DC-DC Volts: 161.85 DC-DC Current: 0.00 DC-DC Enable: 0 HV charger Current: 0 HV Battery Voltage: 0 Charger AC volts: 0
Heater Temperature: 8 Heater Status: 1 Charger Temp3: -40 Charger Temp4: 0 Avg Charger Temp: -20
Inverter Temp 1: 19 Inverter Temp 2: 17 Avg Inverter Temp: 18
Torque Request: 0
RPM: 0 Motor Peak Temp: 24 Mtr Temp 1: 24 Mtr Temp 2: 24Avg motor Temp: 24
Motor HV: 9584 motor Torque: 0 Motor Amps1: 0 Motor amps2: 0
Loop Time: 7BMS_Stat
Also i tested my throttle and entered the offset from 1460 to 4030. Why then throttle still reports 16% when off pedal?
ADC0 Reading: 591 ADC1 Reading: 1324 Comparison Result: 2.24 Throtle Position: 16
Filtered Position: nan
I then went on and recorded my inverter and DCDC in operation.
1. I could confirm DCDC is reporting as standard as is the cas with charger part.
2. Heater does work exactly the same as before.
3. Inverter on the other hand wouldnt report in the same format as we know. My inverter is P/N 9410A163.
However i can see inverter will still respond correctly to torque request.
I have run my motor at power and recorded inverter report. I attach it here.

Please guys @aot93 and @midway can you let me know which P/N you have? I figured it must be P/N 9410A081 asit is the only other inverter i see being sold.
Attachments
rpm1.txt
(2.25 MiB) Downloaded 42 times
User avatar
aot93
Posts: 198
Joined: Mon Feb 15, 2021 5:45 pm
Location: UK, West Sussex
Has thanked: 6 times
Been thanked: 43 times

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by aot93 »

My inverter is also P/N 9410A163.
I'll take a look at your log and see if I can make sense of it.
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

aot93 wrote: Sat Jan 13, 2024 9:52 pm My inverter is also P/N 9410A163.
I'll take a look at your log and see if I can make sense of it.
Huh! Now that i managed to get CAN comms working i cant seem to get OUT1 relay to start!!! What a farse...
I am not sure that i didnt damage Teensy somehow...
User avatar
aot93
Posts: 198
Joined: Mon Feb 15, 2021 5:45 pm
Location: UK, West Sussex
Has thanked: 6 times
Been thanked: 43 times

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by aot93 »

Does it work using the output tests from the menu?

I've certainly damaged a few teensy whilst prototyping, but not once in the board. In all cases though the board has been completely unresponsive rather than just damaging an output.
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

aot93 wrote: Sat Jan 13, 2024 10:02 pm Does it work using the output tests from the menu?
Yes it does. I tested inputs and outputs as well. I also tested contactors with "c" command and they work in good order. I am not sure about ignition pin though. I tested it by scope.
Also i am not sure about this line where precharge reads BMS values. I dont have BMS connected yet. Why do you use two pretimers?
But still, i cant even get the first contactor to close, probably wont even go into "Neutral"...
Can you explain the purpose of this lines please?

Code: Select all

 if ((motorHVbatteryVolts > BMS_packvoltage - 5.0) && (chargerHVbattryVolts > BMS_packvoltage - 5.0) && (digitalRead(OUT3) == LOW)) // Check that the preCharge has finished
      {
        digitalWrite(OUT3, HIGH); // Turn on drive Contactor
        Serial.println("Main On!...");
        pretimer1 = millis();
      }
But the next one is beyond me...

Code: Select all

      if (motorHVbatteryVolts >= BMS_packvoltage - 5.0)
      {
        if (preChargeRiseTime == 0)
        {
          preChargeRiseTime = millis() - pretimer2;
        }
User avatar
midway
Posts: 79
Joined: Mon Feb 15, 2021 3:52 pm
Location: Ural
Has thanked: 5 times
Been thanked: 8 times

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by midway »

I have an inverter 9410A067
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

Further update...
All inputs and outputs are ok. It seems i made an error in code loop somewhere and i coulnt find it. When i uploaded saved code from previous step everything worked as before. DOH!

Heater control code does work and heater will reach 55deg, but this takes rather long time vs heater in my Pug. I am not sure why is that. I will experiment with heater telegram some more.
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

Well i found out i have to pay more attention to timers.
The reason why my heater was working at halfh strength was because it was turning on and off all the time. I investigated CAN bus transmissions. Some of my telegrams were not getting through on time! Then i inspected timers... it seemed several of telegrams were sharing the same timer even though they were from a different function.
When i separated timers and tested my theory heater was full on and in control up to 55°C.

Then i thought further and separated 0x285 telegram from all other functions. 0x285 is a heartbeat from BMS and we only need one instance for all hardware to work. To do this i went and added a timer countdown at 10ms so 0x285 goes out regardless of other functions.
I ended up with this code. Feel free to use it.

I call BMStimer out

Code: Select all

IntervalTimer BMStimer; // Timer for BMS heartbeat 


In setup i declare function that will run every 10000us

Code: Select all

  BMStimer.begin(bmsComms, 10000);
I made BMSComms function which adapts according to BMS_status

Code: Select all

void bmsComms()
{
    msg.id = 0x285;
    msg.len = 8;
    msg.buf[0] = 0x00;
    msg.buf[1] = 0x00;
    if (BMS_Status == 3) //we are charging 
      {
    msg.buf[2] = 0xB6;
      }
    else if (BMS_Status == 5) //BMS in error
      {
    msg.buf[2] = 0x00;
      }
    else 
      {
    msg.buf[2] = 0x14; // We are driving or doing other stuff
      }      
    msg.buf[3] = 0x39;
    msg.buf[4] = 0x91;
    msg.buf[5] = 0xFE;
    msg.buf[6] = 0x0E;
    msg.buf[7] = 0x10;
    Can2.write(msg);
}
If you are interested in using heater i made this function for heater control
Of course i had to read heater CAN report for that

Code: Select all

void canRX_398(const CAN_message_t &msg) // Heater stats
{
Heatertemp1 = msg.buf[3] - 40;  
Heatertemp2 = msg.buf[4] - 40;
Heatertemp = (Heatertemp1 + Heatertemp2) / 2;
}
..........................
void HeaterComms()
{
  if (timer100_2.check() == 1)
{
    msg.id = 0x188;
    msg.len = 8;
    if (digitalRead(ISO_IN5) == LOW)
{
    msg.buf[0] = 0x03; // byte0 status command Heater pin is on
}
else {
    msg.buf[0] = 0x00; // Heater pin is off
}
    msg.buf[1] = 0x50; // byte1 20 to 50 works
if (Heatertemp >= 55) {
    msg.buf[2] = 0x00; //Heater off when at 55deg   
}    
else if (Heatertemp > 50) {
    msg.buf[2] = 0x32; //Heater at 1/2 when at 50deg   
}    
else {
    msg.buf[2] = 0xA2; //Heater on at full power (dec/10)
}    
    msg.buf[3] = 0x36; // byte3 30 to 40 works
    msg.buf[4] = 0;
    msg.buf[5] = 0;
    msg.buf[6] = 0;
    msg.buf[7] = 0;
    Can2.write(msg);  
}    
}  
Charger control code i remapped too

Code: Select all

void EvseStart()
{

 if (timer500_2.check() == 1)
  {
  
    msg.id = 0x286;
      msg.len = 8;
      msg.buf[0] = 0x10; //voltage 360V
      msg.buf[1] = 0x0E;
      if ((chargerHVbattryVolts > 372) && (chargerHVbattryVolts <= 374)) { // reduce if charger is at 372V
      msg.buf[2] = 0x1E;        
      }
      else if (chargerHVbattryVolts > 374)  { // stop if charger is at 374V
      msg.buf[2] = 0x00;        
      }
      else  { //any other case
      msg.buf[2] = 0x78;        
      }
      msg.buf[3] = 0x37;
      msg.buf[4] = 0x0;
      msg.buf[5] = 0x0;
      msg.buf[6] = 0x0A;
      msg.buf[7] = 0x0;
    Can2.write(msg);
}
}
User avatar
aot93
Posts: 198
Joined: Mon Feb 15, 2021 5:45 pm
Location: UK, West Sussex
Has thanked: 6 times
Been thanked: 43 times

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by aot93 »

Good to hear your are making progress.

regarding the pre-charge timers, the first one is a normal minimum time for pre-charge to occur and the second is to measure how long the pre - charge took, if it happens too quickly it could indicate a problem, or that you just turned the car on and off again quickly!
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

aot93 wrote: Tue Jan 16, 2024 10:45 am regarding the pre-charge timers, the first one is a normal minimum time for pre-charge to occur and the second is to measure how long the pre - charge took, if it happens too quickly it could indicate a problem, or that you just turned the car on and off again quickly!
tnx, i see about "BMS_packvoltage" parameter... is it ok to have this simply read it from BMS assembly? It seem you set it up to act as kind of safety too? In case your battery would drop a cell you would not reach the condition to trigger precharge. In that case does VCU go to error state?

I am working on the speedo function now. Static frequency works. Now i have to setup some variables to get frequency function. I see 1.4 divider between wheel speed [km/h] and frequency [Hz] to show true speed. I will try to use a simple tone() function with variable frequency for this.
I will post code here when i figure it works good.
Post Reply