Need Help: Test Spinning Prius motors with FOC firmware  [SOLVED]

Introduction and miscellaneous that we haven't created categories for, yet
Post Reply
Ember
Posts: 30
Joined: Thu Jun 30, 2022 2:48 am
Has thanked: 28 times
Been thanked: 4 times

Need Help: Test Spinning Prius motors with FOC firmware  [SOLVED]

Post by Ember »

Hello everyone,
I have recently been trying to get MG2 spinning on my Prius transaxle, but have not been successful for awhile and could use some help. I have a gen 3 prius inverter and transaxle, and am currently trying to get MG2 to spin.
I was able to get it spinning with an open loop test using sine firmware, but using foc firmware I can only get it to make a loud whine with no movement or vibration.
I believe my resolver is connected properly; I get less than 5 degrees of jitter, and when I rotate the motor the plot oscillates between 0 and 360 degrees. I have a welded PSD and so can spin MG2 via the ICE shaft on the side of the transaxle. Here are a few plots of my angle during one full rotation of the motor each: (note data points set to 10000 and length set to 100)
IMG_6216.jpg
IMG_6217.jpg
IMG_6218.jpg
I have taken the basic parameter values from the FOC programming video and from the inverter section of some values bigpie posted https://openinverter.org/parameters/view.html?id=18.
I have: polpairs: 4,
respolpairs: 2
encomode: resolver,
pwmfrq: 4.4KHz,
pwmpol: ACTHIGH,
deadtime: 130,
snshs: semikron,
il2gain: 3.09 (I also tried 4.56),
il2gain: 3.09 (also tried 4.5),
udcgain 6.15 (alsotried 4.68),
pinswap: pinswap23
params.json
(1.46 KiB) Downloaded 49 times
In the spot values the hwver value is showing "Rev2" and not "prius", I assume representing the chip on my board. I am not sure if this is abnormal/an issue. I did have an issue flashing my chips, which was resolved when Pete9008 made me some special v5.24-R FOC firmware with a fixed flash size in this thread: viewtopic.php?t=3328&start=25
I have also tried loading v4.90-R firmware, but got the with the same results with the same parameters when trying to spin the motor.
I have noticed the udc displayed in spot values to be about 20v below what I measure my battery pack's voltage to be with a good multimeter, I am not sure if this is due to where the voltage is measured in the inverter or if it may be a sign of an issue.
I have the original wiring that connects the inverter to the two motors, so I am confident that they are connected correctly.
I am a little worried about the size of my test battery; I have two 0.7KWh 40v A123 cell packs wired in series, currently delivering 73 volts. I am not sure if this is big enough, but it did spin the motor in sine mode.

Any advice is appreciated, and I can gather any other applicable data if it might help.
Thank you for the help!
Ember
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: Need Help: Test Spinning Prius motors with FOC firmware

Post by Pete9008 »

I've been working on some code to help with the initial setup, see viewtopic.php?p=56416#p56416

Unfortunately it's not been ported back to the STM32F103 yet, hopefully soon though. I may have a go at it later today but no guarantees!
Ember wrote: Mon May 22, 2023 10:00 pm I have: polpairs: 4,
respolpairs: 2
Not sure that's right, I thought both should be 4 but could be wrong. I'd find a parameter set for the same motor and see what's used (Johannes' Audi install would be a good one to refer to).

Not too keen on the plot either, I'd prefer to see a ramp (see link above), but it could be due to cogging or a plotting artefact (if the motor moves too fast). Try a 1000point, 1000length plot to see.
Ember wrote: Mon May 22, 2023 10:00 pm I have the original wiring that connects the inverter to the two motors, so I am confident that they are connected correctly.
That doesn't guarantee that it's right. Not idea whether the original Prius boards and the OpenInverter boards are consistent in the way that phases are numbered. It also depends on resolver connections. A good indicator that it's right would be if when you run the sin code in the forwards direction the direction of rotation matches the one that gives a upwards ramp on the resolver output in the FOC code. Either way it could be worth swapping the polarity if the sin or cos resolver wires, or swapping a couple of motor phase wires, and trying again.
Ember wrote: Mon May 22, 2023 10:00 pm I am a little worried about the size of my test battery; I have two 0.7KWh 40v A123 cell packs wired in series, currently delivering 73 volts. I am not sure if this is big enough, but it did spin the motor in sine mode.
Can't see that being a problem. If it could spin it in sin mode is should be up to spinning it in FOC mode.
User avatar
johu
Site Admin
Posts: 5791
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 157 times
Been thanked: 1024 times
Contact:

Re: Need Help: Test Spinning Prius motors with FOC firmware

Post by johu »

(res)polepairs is correct for Prius motor: https://openinverter.org/parameters/view.html?id=29
pinswap must be 5 or 7 (Swap il1/il2 and swap Pwm1/Pwm3). If not spinning then, resolver sin/cos must also be swapped.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
Ember
Posts: 30
Joined: Thu Jun 30, 2022 2:48 am
Has thanked: 28 times
Been thanked: 4 times

Re: Need Help: Test Spinning Prius motors with FOC firmware

Post by Ember »

Thank you both! unfortunately I've been away from my testing set up, but will be back Tuesday and will be making updates to my parameters/troubleshooting per your advice, and getting new resolver plots.
Ember
Posts: 30
Joined: Thu Jun 30, 2022 2:48 am
Has thanked: 28 times
Been thanked: 4 times

Re: Need Help: Test Spinning Prius motors with FOC firmware

Post by Ember »

Eons later I have returned to this problem and solved it. I did Damien’s resolver test he outlines in his FOC tuning video, and I also realized that I had a value of 10500 for syncoffs, which was good enough to keep my motor from spinning.
Post Reply