Toyota Prius Gen 2 Inverter Controller

Topics concerning the Toyota and Lexus inverter drop in boards
Post Reply
MattsAwesomeStuff
Posts: 947
Joined: Fri Apr 26, 2019 5:40 pm
Has thanked: 353 times
Been thanked: 210 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by MattsAwesomeStuff »

Alexstarex wrote: Sat Jan 25, 2020 10:45 pmin the picture is 1st generation. Need an inverter 2 generation
Hmm. It matches my picture of a Gen 2, not a Gen 1. But I'm far from knowledgeable about all models sold and what years:

Image
User avatar
konstantin8818
Posts: 290
Joined: Sun Jan 19, 2020 2:33 pm
Location: Minsk, Belarus
Has thanked: 2 times
Been thanked: 8 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by konstantin8818 »

Design of prius Gen3 board as well as Main board V3 utilises STM32F103RBT6 chip, vhich uses P$54(PD2) pin as out for resolver exciter.
And then signal from resolver goes in thrue pins P$22(PA6) and P$23(PA7).
Bluepill equipped with STM32F103C8T6 chip that has got no P$54(PD2).
Is it possible to utilise any of its free pins as exc_out, or I need separate board, like a crop out of gen 3 one, to simulate signal for resolver?
Or maybe Main Board V3 capable of handle prius inverter? I'm not an electronics engineer or hobbyist, I'm mechanics engineer and building my DIY electric car from scratch and looking for a cheapiest way possible=)
I believe software for gen2 also need to be changed for resolver input?
User avatar
johu
Site Admin
Posts: 6318
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 249 times
Been thanked: 1309 times
Contact:

Re: Toyota Prius Gen 2 Inverter Controller

Post by johu »

The V3 main board is so generic that it supports any inverter 8-)
Seriously, all you need to do is make a little adapter board that passes the 3 high-side PWM signals through a ULN2003 or discrete transistors. If you so wish you can also level shift the current sensor signals to 0-3.3V and pass the remaining IO signals to a meaningful outside-world connector. Actually an adapter board is on my todo list.

The firmware also detects when it's running on a Blue Pill and re-assigns the pins like so: viewtopic.php?f=3&t=220&start=20#p2623
But given the cheap assembly option I don't think there is much future need for the Blue Pill.

Concerning the boot loader here is what happens:
  • stm32_loader.hex is the first thing to be executed upon reset/power-up
  • It listens for an update command for about 100ms, then jumps to the actual firmware
  • The actual firmware is in stm32_sine/foc.hex and is placed later in the flash
So obviously if the loader isn't flash the MCU will detect an invalid instruction and fault out.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
konstantin8818
Posts: 290
Joined: Sun Jan 19, 2020 2:33 pm
Location: Minsk, Belarus
Has thanked: 2 times
Been thanked: 8 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by konstantin8818 »

Much appreciated!
Jay

Re: Toyota Prius Gen 2 Inverter Controller

Post by Jay »

Hello all, new to forum....First may I say very great thanks for all the fantastic work done here, especially by Damien.
I've a Gen 1 Prius which I've always wanted to convert to all ev and now with this Gen 2 controller board and Damien's (& Prof. JDK's) Youtube vids I'm hoping it may be doable (although I've just read somewhere that magnets in Gen 1 are wired different so not sure what that means yet?).

Came across some of the descriptions for signals on inverter connector and added missing ones to it's Wiki last night...thought it'd be useful to post a link here to the info I found 'cause it detailed pins on all connectors of hybrid control ecu (think that's the one) and had some useful diagnostic info too. Thanks to Hobbit for this.

https://techno-fandom.org/~hobbit/cars/ ... /list.html
User avatar
SciroccoEV
Posts: 370
Joined: Thu Oct 10, 2019 1:50 pm
Location: Luton UK
Been thanked: 15 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by SciroccoEV »

I have a Blue Pill set up on breadboard as a minimum system. First of all I had it communicating via USB-TTL to a terminal, but I couldn't get the PWM active. Looking for the various pin statuses was tedious via the terminal, so I set up a D1 mini and added a wireless adaptor to my PC.

For the last couple of days I've been chasing errors on mprot & emcystop. No matter what state I tied PB12 to, the web interface seemed to indicate a floating input. After scratching my head for a while, I went to the source code and found the pin definitions.
#define DIG_IO_BLUEPILL \
DIG_IO_ENTRY(brake_in, GPIOB, GPIO9, PinMode::INPUT_FLT) \
DIG_IO_ENTRY(rev_in, GPIOB, GPIO8, PinMode::INPUT_FLT) \
DIG_IO_ENTRY(fwd_in, GPIOB, GPIO7, PinMode::INPUT_FLT) \
DIG_IO_ENTRY(start_in, GPIOB, GPIO6, PinMode::INPUT_FLT) \
DIG_IO_ENTRY(cruise_in, GPIOB, GPIO5, PinMode::INPUT_FLT) \
DIG_IO_ENTRY(mprot_in, GPIOB, GPIO1, PinMode::INPUT_FLT) \
DIG_IO_ENTRY(emcystop_in, GPIOB, GPIO1, PinMode::INPUT_FLT) \
DIG_IO_ENTRY(bk_in, GPIOB, GPIO12, PinMode::INPUT_PU) \
DIG_IO_ENTRY(bms_in, GPIOD, GPIO15, PinMode::INPUT_FLT) /* non-existant */ \
DIG_IO_ENTRY(ocur_in, GPIOD, GPIO15, PinMode::INPUT_FLT) /* non-existant */ \
DIG_IO_ENTRY(desat_in, GPIOD, GPIO15, PinMode::INPUT_FLT) /* non-existant */ \
DIG_IO_ENTRY(dcsw_out, GPIOC, GPIO15, PinMode::OUTPUT) \
DIG_IO_ENTRY(vtg_out, GPIOD, GPIO14, PinMode::OUTPUT) /* non-existant */ \
DIG_IO_ENTRY(prec_out, GPIOB, GPIO4, PinMode::OUTPUT) \
DIG_IO_ENTRY(led_out, GPIOC, GPIO13, PinMode::OUTPUT) \
DIG_IO_ENTRY(err_out, GPIOD, GPIO14, PinMode::OUTPUT) /* non-existant */ \
DIG_IO_ENTRY(temp0_out, GPIOD, GPIO14, PinMode::OUTPUT) /* non-existant */ \
DIG_IO_ENTRY(speed_out, GPIOD, GPIO14, PinMode::OUTPUT) /* non-existant */ \
DIG_IO_ENTRY(brk_out, GPIOD, GPIO14, PinMode::OUTPUT) /* non-existant */ \
This doesn't match up with Damien's schematic; Both mprot_in and emcystop_in are mapped to PB1 in the definitions, whilst Damien has the MG2 inverter fault line routed to PB12.
Tying PB1 to 3V3 got rid of the errors, which ties up with the definitions, but Damien has PB1 as the uaux (12v supply monitor).
With PB12 now unconnected, I was getting ocur errors, which is confusing since ocur_in is mapped to a non existent port on a Blue Pill. I've yet to delve far enough into the code to find out what bk_in is!
User avatar
konstantin8818
Posts: 290
Joined: Sun Jan 19, 2020 2:33 pm
Location: Minsk, Belarus
Has thanked: 2 times
Been thanked: 8 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by konstantin8818 »

Now it's time to choose, or just order both Damien's and Johannes's boards. :D
Attachments
DSC_0710.JPG
DSC_0706.JPG
User avatar
Jack Bauer
Posts: 3582
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 2 times
Been thanked: 141 times
Contact:

Re: Toyota Prius Gen 2 Inverter Controller

Post by Jack Bauer »

Can never have too many boards:)
I'm going to need a hacksaw
User avatar
konstantin8818
Posts: 290
Joined: Sun Jan 19, 2020 2:33 pm
Location: Minsk, Belarus
Has thanked: 2 times
Been thanked: 8 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by konstantin8818 »

Jack Bauer wrote: Sun Mar 01, 2020 1:15 pm Can never have too many boards:)
Ordered both. Now local shops don't know what components I need :? I talk about components, listed in PriusG2_V1_BOM.ods
They say they don't know what are those strange writings in English :lol:

There are no BTS117BKSA1, TR10S05 and MCP2562-E/P components awailable for a retail purchase in my country :cry: Damien, can you please include those for an additional price?
MattsAwesomeStuff
Posts: 947
Joined: Fri Apr 26, 2019 5:40 pm
Has thanked: 353 times
Been thanked: 210 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by MattsAwesomeStuff »

I found everything I needed from Digikey. But I presume any of the bit component sellers would have everything.
User avatar
konstantin8818
Posts: 290
Joined: Sun Jan 19, 2020 2:33 pm
Location: Minsk, Belarus
Has thanked: 2 times
Been thanked: 8 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by konstantin8818 »

MattsAwesomeStuff wrote: Thu Mar 05, 2020 3:24 am I found everything I needed from Digikey. But I presume any of the bit component sellers would have everything.
No shipment to Belarus from digikey. Farnell's official distributor in Belarus no longer exist.
If you imagine Russia and Europe as two towns, Belarus will be road between them. Roads have no postal codes and no one cares. Belarus is like a black hole - to import something from Europe, you need to pay toll, Russian shops(not all, but many) on the other hand don't offer shipment to Belarus.
There are shops in here that got all that stuff, but they only work with companies and businesses.
I hope you got the overall picture
User avatar
SciroccoEV
Posts: 370
Joined: Thu Oct 10, 2019 1:50 pm
Location: Luton UK
Been thanked: 15 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by SciroccoEV »

Bye bye Blue Pill.
No way to start PWM without tripping the overcurrent/brk-in on either of my two examples.

Swapped to a board with the higher pin count STM32F103RBC6; https://www.aliexpress.com/item/3263291 ... 4c4dm9lPyn

Now we're cooking with electrons!
User avatar
konstantin8818
Posts: 290
Joined: Sun Jan 19, 2020 2:33 pm
Location: Minsk, Belarus
Has thanked: 2 times
Been thanked: 8 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by konstantin8818 »

SciroccoEV wrote: Sun Mar 08, 2020 10:30 am Bye bye Blue Pill.
No way to start PWM without tripping the overcurrent/brk-in on either of my two examples.

Swapped to a board with the higher pin count STM32F103RBC6; https://www.aliexpress.com/item/3263291 ... 4c4dm9lPyn

Now we're cooking with electrons!
So, youre saying, Damien's blue pill based board is "no go" for traction? Or it just me, who got it wrong?
User avatar
SciroccoEV
Posts: 370
Joined: Thu Oct 10, 2019 1:50 pm
Location: Luton UK
Been thanked: 15 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by SciroccoEV »

It's worth reading this thread; viewtopic.php?f=3&t=220

It looks like a workaround was found, but it definitely doesn't work on either of my boards. I had the other boards right from the start, but used the BP because it's easier to fit them on a breadboard.
MattsAwesomeStuff
Posts: 947
Joined: Fri Apr 26, 2019 5:40 pm
Has thanked: 353 times
Been thanked: 210 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by MattsAwesomeStuff »

I was on an electronics kick for 3 months 'cause the junkyard I bought my Gen 2 inverter from had a 90 day warranty on the inverter. When the 90 days passed I hadn't got it working yet, so it's sat on a shelf for the last couple months and I've gone back to welding and grinding (and welding, and grinding, and welding, and grinding, and the joys of combining 2 50-year old cars together with no experience).

Not sure I understand Scirocco's comment.

The Blue Pill doesn't work when you actually go to power up the inverter, or, just that your particular Blue Pill(s) have a slightly different STM32 chip that's shittin' the bed so you threw in the towel and got a properly sourced STM32 chip?

(I.E. Is this going to be a problem for everyone, some of us, or just you?)
User avatar
SciroccoEV
Posts: 370
Joined: Thu Oct 10, 2019 1:50 pm
Location: Luton UK
Been thanked: 15 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by SciroccoEV »

MattsAwesomeStuff wrote: Sun Mar 08, 2020 12:55 pm Not sure I understand Scirocco's comment.
It seems you didn't read the thread I referenced. I'll paste some relevant bits of it here.
Johu wrote:bk_in is on PB12 and it must be because it's the hardware break input of the timer. It seems there is a problem with it, Damien and me are currently investigating.
Johu wrote:Well, it would seem the Blue Pill has a little layout problem. So no matter if you set the break input active high or low it trips out as soon as the PWM runs, even though the break input is tied to ground or VCC, respectively. If the break function is disabled per timer register, all runs ok.
Now, I disabled the PWM1N output which is adjacent to the break input. Et voila: no trip.
There was a code version associated with the last post, which I assume was one that worked despite the board layout. It didn't work on mine, so I switched to the other board. All the boards are using STM branded uProcessors, but with the CHN marking showing the die was packaged by STATS ChipPAC Shanghai Co. Ltd.

Damien and Johu have effectively abandoned using these cheap development boards now that full SMD assembly is so cost effective direct from JLC-PCB. I still see some merit in using them; Damien's PCB didn't incorporate level shifters for the bipolar current sensor output of the Gen 2 intelligent power module, so |'m testing a circuit out on the breadboard.

The higher pin count board didn't cost that much more, but it has dual row headers, so it can't just be plugged into a breadboard. I now have a 'hairball' of flying leads from the dev board to the breadboard, but I do now have PWM and can do some further testing.
User avatar
johu
Site Admin
Posts: 6318
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 249 times
Been thanked: 1309 times
Contact:

Re: Toyota Prius Gen 2 Inverter Controller

Post by johu »

You could try installing a strong pull-up (say, 1k) directly at the STM32 pin for bk_in. Still agree the Blue Pill has many issues. I think the existing hardware out there can be made to work but reading all this I wouldn't base a new design on it.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
SciroccoEV
Posts: 370
Joined: Thu Oct 10, 2019 1:50 pm
Location: Luton UK
Been thanked: 15 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by SciroccoEV »

johu wrote: Tue Mar 10, 2020 6:32 am You could try installing a strong pull-up (say, 1k) directly at the STM32 pin for bk_in. Still agree the Blue Pill has many issues. I think the existing hardware out there can be made to work but reading all this I wouldn't base a new design on it.
Connecting the pin directly to the power rail didn't make any difference!

Anyway, I have things working with the other board;
MattsAwesomeStuff
Posts: 947
Joined: Fri Apr 26, 2019 5:40 pm
Has thanked: 353 times
Been thanked: 210 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by MattsAwesomeStuff »

SciroccoEV wrote: Mon Mar 09, 2020 9:46 pmIt seems you didn't read the thread I referenced.
I did, but, like most things here, I only understand half of it.
Damien's PCB didn't incorporate level shifters for the bipolar current sensor output of the Gen 2 intelligent power module, so |'m testing a circuit out on the breadboard.
Neat, I'll need to copy that if I end up sticking with my Blue Pill board.
Anyway, I have things working with the other board
Thanks for sharing your progress. It's looking like lots of us are going to be more or less preventatively stuck in our basements and shops, so, hopefully I'll get a lot of work done this spring :p
User avatar
konstantin8818
Posts: 290
Joined: Sun Jan 19, 2020 2:33 pm
Location: Minsk, Belarus
Has thanked: 2 times
Been thanked: 8 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by konstantin8818 »

I've found all needed components for Damien's board except of one: switching regulator TR10S05
https://www.chipdip.ru/product/tr10s05 ... tor-8-28v This shop in Moscow does not send parcels to Belarus.
I've found this regulator with low voltage drop: LM2940CT-5.0 / NOPB
https://www.chipdip.by/product/lm2940ct-5.0-nopb Same shop in Belarus but stock is separated and they have got no TR10S05. This is some kind of circus ... :?
Is it possible to replace TR10S05 with LM2940CT-5.0 / NOPB. Will it do the trick?
User avatar
Jack Bauer
Posts: 3582
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 2 times
Been thanked: 141 times
Contact:

Re: Toyota Prius Gen 2 Inverter Controller

Post by Jack Bauer »

I have sent you a built and tested board:)
I'm going to need a hacksaw
User avatar
konstantin8818
Posts: 290
Joined: Sun Jan 19, 2020 2:33 pm
Location: Minsk, Belarus
Has thanked: 2 times
Been thanked: 8 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by konstantin8818 »

Jack Bauer wrote: Mon Mar 16, 2020 10:56 am I have sent you a built and tested board:)
:shock: WHOA! I can't thank you enough! I'll sent a donation as soon as my payday!
Now I need to deal with all those components, coming my way from all over the world :lol: Maybe I'll try to recreate your board.
User avatar
SciroccoEV
Posts: 370
Joined: Thu Oct 10, 2019 1:50 pm
Location: Luton UK
Been thanked: 15 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by SciroccoEV »

I'm now trying to chase down why the current sensor channels on my board appear to have different gains. The two throttle channels behave as expected, but feeding IL1 & IL2 with 0 to 3.3v signals results in values between approx. +/-400 amp on one channel and +/-250 amp on the other.

The zero offset is calibrated every time the inverter is started, but I'm also seeing an offset between the channels when I return to the initial applied voltage.

I can't see any sneak circuits on the board and both inputs have >3Mohm impeadance to the supply rails on the Fluke.

I'll write some quick text code just to check the raw ADC values.
User avatar
SciroccoEV
Posts: 370
Joined: Thu Oct 10, 2019 1:50 pm
Location: Luton UK
Been thanked: 15 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by SciroccoEV »

Now just what could be causing this...

User avatar
konstantin8818
Posts: 290
Joined: Sun Jan 19, 2020 2:33 pm
Location: Minsk, Belarus
Has thanked: 2 times
Been thanked: 8 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by konstantin8818 »

My board has arrived :D Thank you, Damien! Now just need to wait when contactors make it to Belarus, as they seems to stuck in Israel for over two weeks already...
DSC_0726.JPG
Post Reply