Outlander rear motor and inverter

Mitsubishi hybrid drive unit hacking
Post Reply
LRBen
Posts: 471
Joined: Thu Jul 04, 2019 6:35 pm
Location: Somerset, UK
Has thanked: 42 times
Been thanked: 99 times

Re: Outlander rear motor and inverter

Post by LRBen »

aot93 wrote: Sun Sep 04, 2022 10:04 am To add some more to the above:

HV voltage at the inverter is only sent until a torque request is made to the inverter, so it's useful only for pre-charging.
Once a torque request has been made it looks like the byte order changes, I've not worked that out yet to get voltage reading from the inverter whilst it's running. The BMS take care of voltage limit and the charger reports HV from the other side of the contactors
Ah that might be why it's being a bit odd then. I am only intending to use it for precharging, but in my setup the pedal read and torque requests are also active during the precharge cycle, even if it's requesting 0 torque.

I'll rewrite the code to precharge in setup before I get to normal running mode and see if that changes things.
LRBen
Posts: 471
Joined: Thu Jul 04, 2019 6:35 pm
Location: Somerset, UK
Has thanked: 42 times
Been thanked: 99 times

Re: Outlander rear motor and inverter

Post by LRBen »

The rewrite worked. Before you start sending the first torque requests the inverter does send the correct voltage information. After that it does change.
Now using it successfully to aid with precharge.
LRBen
Posts: 471
Joined: Thu Jul 04, 2019 6:35 pm
Location: Somerset, UK
Has thanked: 42 times
Been thanked: 99 times

Re: Outlander rear motor and inverter

Post by LRBen »

On to getting it spinning now. I think my issues could be one of two things.

RSDN. This is pulled low from what I have seen. How have people done that? I saw one post that said it needed 8v, so I gave it 8v via resistor in series from 12v, I also tried just grounding it.

My S1 and S2 resistance readings from the motor are within spec, but also at a reading a measurement that they could be either. I have swapped them once to no avail. Does the inverter spit out any canbus error messages if it doesn't get the information it wants or needs?
tom91
Posts: 1274
Joined: Fri Mar 01, 2019 9:15 pm
Location: Bristol
Has thanked: 97 times
Been thanked: 204 times

Re: Outlander rear motor and inverter

Post by tom91 »

LRBen wrote: Thu Sep 08, 2022 8:35 pm On to getting it spinning now. I think my issues could be one of two things.

RSDN.
I have got builds and test rigs running with this floating. Can anyone confirm what this signal does, does the inverter contain a bleed resistor on the HV bus that gets activated using this signal or can?

Please share your code somewhere so others can review it. Spinning using the Rear inverter is quite straight forward if you know what canbus its looking for.
Founder Volt Influx https://www.voltinflux.com/
LRBen
Posts: 471
Joined: Thu Jul 04, 2019 6:35 pm
Location: Somerset, UK
Has thanked: 42 times
Been thanked: 99 times

Re: Outlander rear motor and inverter

Post by LRBen »

tom91 wrote: Thu Sep 08, 2022 8:55 pm I have got builds and test rigs running with this floating. Can anyone confirm what this signal does, does the inverter contain a bleed resistor on the HV bus that gets activated using this signal or can?

Please share your code somewhere so others can review it. Spinning using the Rear inverter is quite straight forward if you know what canbus its looking for.
I'll try just leaving floating then. My initial thought based on information here is that giving it 12v acts as a shut down signal for the inverter, so that how I initially had it setup with it floating as default.

My code I'm running is here, it's rather messy with a few currently unused parts, and I still need to add in credit to aot since I've copy pasted a good chunk of your code.: https://github.com/SomersetEV/MG-F-E-VC ... _F_VCU.ino

The relevant canbus part is this. ChargerEVSE.check is a 100ms timer. I have confirmed all this data is getting onto the canbus today via savvycan.

Code: Select all

void inverterComms()
{
  if (timer50_1.check()) {
    readPedal();
    torqueRequest = targetTorque;
    curentTorque = torqueRequest;
    if (torqueRequest > (2000))
    {
      torqueRequest = 0;
      Serial.println("--!OVER TOURQUE!--");
    }
    if (torqueRequest < (-1000))
    {
      torqueRequest = 0;
      Serial.println("--!UNDER TOURQUE!--");
    }


    torqueLoByte = lowByte(torqueRequest);
    torqueHibyte = highByte(torqueRequest);

    CAN_message_t msg2;
    msg2.id = (0x287);
    msg2.len = 8;
    msg2.buf[0] = 0;
    msg2.buf[1] = 0;
    msg2.buf[2] = torqueHibyte;
    msg2.buf[3] = torqueLoByte;
    msg2.buf[4] = 0;
    msg2.buf[5] = 0;
    msg2.buf[6] = 0x03;
    msg2.buf[7] = 0;
    Can0.write(msg2);
    torqueRequest = 0;
    delay(1);

  }
  
  if (chargerEVSE.check()) {
    CAN_message_t msg3;
    msg3.id = 0x371;
    msg3.len = 8;
    msg3.buf[0] = 48;
    msg3.buf[1] = 0;
    msg3.buf[2] = 0;
    msg3.buf[3] = 0;
    msg3.buf[4] = 0;
    msg3.buf[5] = 0;
    msg3.buf[6] = 0;
    msg3.buf[7] = 0;
    Can0.write(msg3);
    delay(1);
    CAN_message_t msg4;
    msg4.id = 0x285;
    msg4.len = 8;
    msg4.buf[0] = 0;
    msg4.buf[1] = 0;
    msg4.buf[2] = 20;
    msg4.buf[3] = 57;
    msg4.buf[4] = 143;
    msg4.buf[5] = 254;
    msg4.buf[6] = 12;
    msg4.buf[7] = 16;
    Can0.write(msg4);
    delay(1);
    CAN_message_t msg5;
    msg5.id = 0x286;
    msg5.len = 8;
    msg5.buf[0] = 0;
    msg5.buf[1] = 0;
    msg5.buf[2] = 0;
    msg5.buf[3] = 61;
    msg5.buf[4] = 0;
    msg5.buf[5] = 0;
    msg5.buf[6] = 33;
    msg5.buf[7] = 0;
    Can0.write(msg5);
  }



}
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 rear motor and inverter

Post by aot93 »

I would check:
Physical connection between the motor and inverter, if it's not 100% it won't work
DC HV is it over 200v?

I'ts been a while since i did tests on the RSDN, mine is switched to ground in normal operation, otherwise it's pulled to 12v.

Did a quick scan of your code and not seeing anything obvious, something to try is a dedicated metro timer for the inverter comms I seem to recall some inconsistency when sharing timers
LRBen
Posts: 471
Joined: Thu Jul 04, 2019 6:35 pm
Location: Somerset, UK
Has thanked: 42 times
Been thanked: 99 times

Re: Outlander rear motor and inverter

Post by LRBen »

aot93 wrote: Thu Sep 08, 2022 9:25 pm I would check:
Physical connection between the motor and inverter, if it's not 100% it won't work
DC HV is it over 200v?

I'ts been a while since i did tests on the RSDN, mine is switched to ground in normal operation, otherwise it's pulled to 12v.

Did a quick scan of your code and not seeing anything obvious, something to try is a dedicated metro timer for the inverter comms I seem to recall some inconsistency when sharing timers
The physical connection is kind of what I am thinking at the moment, I'll double check the resolver connector all sit properly tomorrow.
DC HV is 334v.

I'll try a dedicated timer for comms as well. Glad to hear it's not thing silly in my code.
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 rear motor and inverter

Post by aot93 »

Actually a closer look at your code and it looks like your torqueRequest is not scaled correctly.

It looks like throtlepot should be *10

and you are missing the torqueRequest += 10000 offset.

Worth checking what you are sending via savycan, a 1nm request should have 0x27 on b2 and 0x1a on b3 of 0x287 which is decimal 10010
Formula is (a*256+b-10000)/10
LRBen
Posts: 471
Joined: Thu Jul 04, 2019 6:35 pm
Location: Somerset, UK
Has thanked: 42 times
Been thanked: 99 times

Re: Outlander rear motor and inverter

Post by LRBen »

aot93 wrote: Fri Sep 09, 2022 12:47 am Actually a closer look at your code and it looks like your torqueRequest is not scaled correctly.

It looks like throtlepot should be *10

and you are missing the torqueRequest += 10000 offset.

Worth checking what you are sending via savycan, a 1nm request should have 0x27 on b2 and 0x1a on b3 of 0x287 which is decimal 10010
Formula is (a*256+b-10000)/10
Yeah I definitely have that wrong. I'm just sending torque request as an actual decimal from 0 to 200. I did notice that I was only using the LSB even for max torque request. Will change this today and update.
LRBen
Posts: 471
Joined: Thu Jul 04, 2019 6:35 pm
Location: Somerset, UK
Has thanked: 42 times
Been thanked: 99 times

Re: Outlander rear motor and inverter

Post by LRBen »

It's all good now! Have spinning wheels. Thanks for the assistance! I think I see how that throttle map works now as well.

To confirm RSDN, when floating or tied to 8v, inverter works. When tied to 12v, inverter shuts down. As per the wiki.
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 rear motor and inverter

Post by aot93 »

Yeah good news!

Looking forward to hear if you are seeing an improvement over the old setup
tom91
Posts: 1274
Joined: Fri Mar 01, 2019 9:15 pm
Location: Bristol
Has thanked: 97 times
Been thanked: 204 times

Re: Outlander rear motor and inverter

Post by tom91 »

LRBen wrote: Fri Sep 09, 2022 3:02 pm It's all good now! Have spinning wheels. Thanks for the assistance! I think I see how that throttle map works now as well.

To confirm RSDN, when floating or tied to 8v, inverter works. When tied to 12v, inverter shuts down. As per the wiki.
Could you do the following, measure HV voltage decay (so precharge then close contactors as normal, then open contactors after reaching full votlage) when leaving RSDN floating and with RSDN tied to 12V.

As the decay on the inverter without toggling RSDN is a long time, then again the outlander probally uses the DCDC or PTC to get rid of the HV voltage in caps.
Founder Volt Influx https://www.voltinflux.com/
User avatar
mjc506
Posts: 343
Joined: Wed Sep 09, 2020 9:36 pm
Location: Wales, United Kingdom
Has thanked: 30 times
Been thanked: 28 times

Re: Outlander rear motor and inverter

Post by mjc506 »

Does anyone have any photos of the (rear) inverter open? Or front!
User avatar
Zapatero
Posts: 443
Joined: Fri Oct 25, 2019 11:08 am
Location: Germany, Ulm
Has thanked: 25 times
Been thanked: 39 times
Contact:

Re: Outlander rear motor and inverter

Post by Zapatero »

mjc506 wrote: Fri Sep 09, 2022 9:10 pm Does anyone have any photos of the (rear) inverter open? Or front!
you can see some of it in my pictures:
viewtopic.php?t=2292&start=125
LRBen
Posts: 471
Joined: Thu Jul 04, 2019 6:35 pm
Location: Somerset, UK
Has thanked: 42 times
Been thanked: 99 times

Re: Outlander rear motor and inverter

Post by LRBen »

tom91 wrote: Fri Sep 09, 2022 3:40 pm Could you do the following, measure HV voltage decay (so precharge then close contactors as normal, then open contactors after reaching full votlage) when leaving RSDN floating and with RSDN tied to 12V.

As the decay on the inverter without toggling RSDN is a long time, then again the outlander probally uses the DCDC or PTC to get rid of the HV voltage in caps.
So with RSDN floating, Decay is almost instant, within 12 frames of canbus messages from the charger to 0v. With RSDN tied to 12v, decay is very slow, probably well over 30 seconds.

My setup has the charger/dc-dc connected to the inverter, but no water heater.
LRBen
Posts: 471
Joined: Thu Jul 04, 2019 6:35 pm
Location: Somerset, UK
Has thanked: 42 times
Been thanked: 99 times

Re: Outlander rear motor and inverter

Post by LRBen »

I have the wheels spinning backwards, not sure if this is the default forward direction of the inverter. Spinning clock wise if you are looking at the motor output.

I thought initially it was just the resolver wires mixed up. But that didn't work. I'm pretty sure the phase wires are correct as they were still attached to the inverter when I got it and you can only attach them one way up on the motor and the original connector to the motor was intact on this loom. Since I get good performance I'm guessing this is just the default direction of motor spin, or if not it's good enough and not worth the hassle of changing around phase and resolver wires.

So I thought it best just to run the motor in reverse via the canbus commands. But this is proving trickier to do in practice. I tried just multiplying the torque request by -1 and also at a few different stages such as throttlePot etc. I'm thinking it's a programming thing with ints and negative numbers. If use float then the lowbyte/highbyte function doesn't work.
I can't see anything obvious in any code published.
tom91
Posts: 1274
Joined: Fri Mar 01, 2019 9:15 pm
Location: Bristol
Has thanked: 97 times
Been thanked: 204 times

Re: Outlander rear motor and inverter

Post by tom91 »

I wrote my code so I can flip it. Yes the torque commands flip when spinning the other way. Multiply by -1 before you apply the 10000 offset.
Founder Volt Influx https://www.voltinflux.com/
LRBen
Posts: 471
Joined: Thu Jul 04, 2019 6:35 pm
Location: Somerset, UK
Has thanked: 42 times
Been thanked: 99 times

Re: Outlander rear motor and inverter

Post by LRBen »

tom91 wrote: Sat Sep 10, 2022 3:57 pm I wrote my code so I can flip it. Yes the torque commands flip when spinning the other way. Multiply by -1 before you apply the 10000 offset.
I've tried a few variations on this with no affect. Such as torqueRequest = torqueRequest *-1;. Then decided to add torqueRequest1 as a different int to do the negative multiplication.
I also tried torqueRequest = torqueRequest - (torqueRequest*2). As a round about way of flipping it.

Code: Select all

    torqueRequest1 = torqueRequest *(-1);
    torqueRequest1 += 10000;
    torqueLoByte = lowByte(torqueRequest1);
    torqueHibyte = highByte(torqueRequest1);
tom91
Posts: 1274
Joined: Fri Mar 01, 2019 9:15 pm
Location: Bristol
Has thanked: 97 times
Been thanked: 204 times

Re: Outlander rear motor and inverter

Post by tom91 »

Please provide the declaration check if you decalred these as singed intergers, and 16bit or more.
Founder Volt Influx https://www.voltinflux.com/
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 rear motor and inverter

Post by aot93 »

A grab of a few frames from the CAN bus could be useful here also
LRBen
Posts: 471
Joined: Thu Jul 04, 2019 6:35 pm
Location: Somerset, UK
Has thanked: 42 times
Been thanked: 99 times

Re: Outlander rear motor and inverter

Post by LRBen »

tom91 wrote: Sat Sep 10, 2022 4:39 pm Please provide the declaration check if you decalred these as singed intergers, and 16bit or more.
I think this is what you are wanting to check? If it's relevant it's running on a teensy 3.6.

Code: Select all

byte torqueHibyte = 0;
byte torqueLoByte = 0;
int torqueRequest = 0;
int torqueRequest1 = 0;
int targetTorque = 0;
int curentTorque = 0;
float throttlePosition = 0;
int Pot_A = 18; // was thermistor pin
int brakeinput = 27; // ground input, orginally simppilot
LRBen
Posts: 471
Joined: Thu Jul 04, 2019 6:35 pm
Location: Somerset, UK
Has thanked: 42 times
Been thanked: 99 times

Re: Outlander rear motor and inverter

Post by LRBen »

aot93 wrote: Sat Sep 10, 2022 4:58 pm A grab of a few frames from the CAN bus could be useful here also
Annoyingly I left my can sniffer at home today. Will take a few grabs next week if I don't figure it out tonight.
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 rear motor and inverter

Post by aot93 »

Are you casting that throttlePosition float to int later?

If not that can cause you problems, mixing floats and ints is often problematic.
LRBen
Posts: 471
Joined: Thu Jul 04, 2019 6:35 pm
Location: Somerset, UK
Has thanked: 42 times
Been thanked: 99 times

Re: Outlander rear motor and inverter

Post by LRBen »

aot93 wrote: Sat Sep 10, 2022 5:30 pm Are you casting that throttlePosition float to int later?

If not that can cause you problems, mixing floats and ints is often problematic.
Not sure why I had throttlePosition as a float. Changed to int and it still works, but still in reverse. Keyboard then died on my workshop computer so I'll try again on Thursday when I am back there and get some canbus logs.
User avatar
Zapatero
Posts: 443
Joined: Fri Oct 25, 2019 11:08 am
Location: Germany, Ulm
Has thanked: 25 times
Been thanked: 39 times
Contact:

Re: Outlander rear motor and inverter

Post by Zapatero »

Does the inverter care if the motor runs forward or backwards? I'm aksing because i mounted one motor forward (rear) and one backward (front) in my car. Will they both behave the same regarding max RPM, Regen etc...
Post Reply