Page 1 of 1

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

Posted: Mon May 22, 2023 10:00 pm
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 50 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

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

Posted: Tue May 23, 2023 8:48 am
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.

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

Posted: Tue May 23, 2023 10:46 am
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.

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

Posted: Sun May 28, 2023 4:35 am
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.

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

Posted: Tue Mar 05, 2024 8:45 pm
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.