Toyota Prius Gen 2 Inverter Controller

Topics concerning the Toyota and Lexus inverter drop in boards
ozwolf
Posts: 4
Joined: Sun Dec 16, 2018 10:33 am

Re: Toyota Prius Gen 2 Inverter Controller

Post by ozwolf »

MattsAwesomeStuff wrote: Fri Dec 13, 2019 6:40 pm
Jack Bauer wrote: Fri Dec 13, 2019 11:57 am I'll fill in the blanks later today.
Thanks Damien. Much appreciated.
Believe me gentlemen, there are many of us that appreciate the effort you are putting into this.

Not sure how I can help, but I am happy to proofread and ask questions if something isn't clear.

Gary
User avatar
Jack Bauer
Posts: 3563
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 1 time
Been thanked: 87 times
Contact:

Re: Toyota Prius Gen 2 Inverter Controller

Post by Jack Bauer »

Some wiki editing later ...
I'm going to need a hacksaw
MattsAwesomeStuff
Posts: 898
Joined: Fri Apr 26, 2019 5:40 pm
Has thanked: 291 times
Been thanked: 177 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by MattsAwesomeStuff »

Jack Bauer wrote: Sat Dec 14, 2019 3:37 pmSome wiki editing later ...
Thanks a bunch Damien!

I've made a quick mockup of the pin numbering on the inverter side to help make things even easier for beginners to read. If someone could just double-check that I haven't goofed (like, are the rows backwards? Should Pin 1 be where 17 is?), that'd be appreciated. Then I'll add it to the wiki along with the wiring colors.

Image

Next, a cludgy diagram of everything I think needs to be wired up to test this:

Image
(Blow up bigger if you want)
(Based on: https://openinverter.org/wiki/Toyota_Pr ... er_Summary )

A few questions:

1 - TB3-1: Description says "12v output to inverter IGCT terminal". None of the pins on the 32 pin connector are labelled IGCT. Where exactly does this 12v supply go on the inverter? One of the other bigger plugs?

2 - TB3-2: Does this (well, or any) GND connect to the inverter anywhere?

3 - TB4-5&5: Are the CANL and CANH just breakout terminals in case you have other CAN devices you want to attach, or to watch what's happening on the CAN lines? I.E. They're not necessary to hook up?

4 - I'm not sure I've connected all my driving components correctly (Throttle, Brake, Brake Switch, Start, Forward, Reverse, Motor Temp, Heat Temp), I presume these are just tied to ground, not the other way and tied to the positive rail?

5 - TB1-8: What's the point of emulating the Start mode on the ignition? (I presume this line is high only for the few seconds when you'd actually be twisting the key and engaging the starter on an ICE vehicle?).

6 - TB3-5&6: What if I leave off the temp sensors? Still works gracefully?

7 -TB3-1, 2, 3: What if a motor doesn't have an encoder? Will this still work blindly on, say, a 3ph motor from a lathe or a pump or some left over industrial gear? Just curious.

8 - Even if this is complete for the logic control board, is there anything else on the inverter that needs to get connected somewhere? Only like, 12 of the 30 pins seem to be used.

...

Is this diagram useful? It's ugly but, I think it's more intuitive than a schematic or a table.
MattsAwesomeStuff
Posts: 898
Joined: Fri Apr 26, 2019 5:40 pm
Has thanked: 291 times
Been thanked: 177 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by MattsAwesomeStuff »

Trying to do some of my own troubleshooting...

- Did I number the pins correctly above?

I think so. This diagram here:

Image

Shows what it says is the Front View of the I10 connector which has the parapets on top with pin 1 on the left, which is mirrored to the female portion on the inverter which I've drawn on the right, so, seems that checks out. Also a couple other pins match up with that to confirm that Damien is using the same number scheme as the wiring manual I pulled this from.

- Next, what is IGCT?

Page 416 of the 2006 Prius Wiring manual shows this, on the inverter:

Image

Shows IGCT, next to GND, as pins 1 and 2 of connector "A", which it then labels as connector "I9", which, referring to the previous image above, is inside the inverter next to I10.

So, looks like IGCT is just the positive rail on that other connector which is presumably the 12v rail for the inverter power supply. I don't have that connector but it's only 2 wires so that's easy enough to wire up.

- I presume TB3-2 in my diagram in the previous post might as well go to the inverter ground, next to IGCT as the 12+.

...

Ignoring the rest of my questions, if they don't have signal they don't have signal, so, I think that's enough for me to venture into making a test-wiring and spinning up a motor for the first time.

I'll keep the rest on my personal thread.
Dilbert
Posts: 410
Joined: Mon Aug 12, 2019 7:21 pm
Location: Dublin, Ireland
Been thanked: 4 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by Dilbert »

Be careful of the current sensor outputs on the gen 2 inverter, they are bipolar centered at zero volts, where as the STM32 add will want them at vcc/2 (or close to this). You might be able to use a pull up resistor on each of the two inputs to achieve this.
MattsAwesomeStuff
Posts: 898
Joined: Fri Apr 26, 2019 5:40 pm
Has thanked: 291 times
Been thanked: 177 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by MattsAwesomeStuff »

Be careful of the current sensor outputs on the gen 2 inverter,
Damien suggested that they're not critical and the motor can be run without them, so that was my plan. But, he notes: "Requires external divider circuit" so I presume that's the same VCC/2 thing you're talking about?

...

In other news, I updated the wiki again. Uploaded some pictures and filled in some tables according to what ScirrocoEV and Johnspark dug up a few pages back from the wiring manuals: https://openinverter.org/wiki/Toyota_Prius_Gen2_Board
MattsAwesomeStuff
Posts: 898
Joined: Fri Apr 26, 2019 5:40 pm
Has thanked: 291 times
Been thanked: 177 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by MattsAwesomeStuff »

- Made a couple fixes to the wiring diagram (had TB2 and TB3 swapped) and updated the wiki.

On my personal machine, I:

- Downloaded/Installed the STM32 Link Utility
- Downloaded/Installed the drivers.
- Ran the STM32 Link utility.
- Programmed the Blue Pill using the stm32_sine.hex file.

...

Next I'll connect Damien's board to the Prius controller.

But then what?

I don't have a wifi module. Am I editing the hex file manually to change my motor parameters and shoving updates at it with the utility? Am I installing Johu's web interface? What's the next steps for use with the Prius controller?
User avatar
johu
Site Admin
Posts: 5791
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 157 times
Been thanked: 1025 times
Contact:

Re: Toyota Prius Gen 2 Inverter Controller

Post by johu »

Options ordered by usability
a) Get a pre-programmed wifi module https://openinverter.org/shop/index.php ... duct_id=56
b) Get a wifi module and program it yourself viewtopic.php?f=5&t=8&hilit=esp8266
c) Get USB <-> UART adapter, install a web interface on your local machine
d) Get USB <-> UART adapter and type commands on terminal
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
MattsAwesomeStuff
Posts: 898
Joined: Fri Apr 26, 2019 5:40 pm
Has thanked: 291 times
Been thanked: 177 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by MattsAwesomeStuff »

c) Get USB <-> UART adapter, install a web interface on your local machine
Bear with my ignorance, there's not a lot of answers when someone is asking the wrong questions..

I have the ST Link thing. Some places, in ways I don't understand, say that you can use that as UART. Others say no.

How/where/what do I use as a USB-UART adapter? Might I have one of these already? (I think I bought something like this, once upon a time, to try to program an ESP8266 but then I gave the ESP to someone else who needed it and never replaced it...).
rikohm
Posts: 29
Joined: Tue Feb 26, 2019 8:08 pm
Location: Piteå, Sweden

Re: Toyota Prius Gen 2 Inverter Controller

Post by rikohm »

I highly recommend going with a).
I did b). and c). and d). Lost a lot of time on that..
You will need to tune your motor in your car "on the road" also , not only on the bench..
MattsAwesomeStuff
Posts: 898
Joined: Fri Apr 26, 2019 5:40 pm
Has thanked: 291 times
Been thanked: 177 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by MattsAwesomeStuff »

I highly recommend going with a).
I did b). and c). and d). Lost a lot of time on that..
I follow, but:

1 - That's already a solved problem.

2 - It's an open source solution that *requires* purchasing something from one of the creators. Albeit for a fair price. But I'd at least like to document the options and alternatives. Suppose a year or two down the road, Johu moves on and stops selling them, and now no one's written about how to do anything other than make a purchase that they can no longer purchase?

3 - Since I didn't know this ahead of time, because it looked like there were alternatives, he's in Europe, and now I'd have to wait 3 weeks for it to get shipped here. I have some spare time over the holidays this week, ideally I'd like to get moving on this if there's a local option.

4 - It shouldn't be *that* hard if Johu's already done it, and, I'm going to have to interface with the board anyways. I don't mind bringing a laptop with me on test drives, annoying as that may be.
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Toyota Prius Gen 2 Inverter Controller

Post by arber333 »

I prefer Wifi interface to usb cable and Linux interface. For one a lot of EMI goes on over those cables specially when motor starts.

I would also like to adapt the code to another wifi module which does not use soldering for flash programming jumper.
MattsAwesomeStuff
Posts: 898
Joined: Fri Apr 26, 2019 5:40 pm
Has thanked: 291 times
Been thanked: 177 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by MattsAwesomeStuff »

Look like my end of the year goal to have the motor spinning is shot. But, made a lot of progress documenting things for everyone else so, I'm content with that.

I don't have a grasp of what I have to do next.

I think I'm going to order a CH340 USB-UART or somesuch thing from somewhere local so I'm not waiting weeks. I think I want to go with option C, to do the wired version, but to use the web interface. I'm a bit confused about whether that requires me to have a linux machine or not.

...

Actually, I'm a bit confused about the big picture of the process in general.

Here's sort of what I can grasp might be true about making this work, code-wise:

- We use ST-LINK to do something to the Blue Pill. We uploaded (?) a hex file. In laymen's terms, what was that hex file? Why was it uploaded? What did it accomplish? Is that hex file just sitting on the Blue Pill now waiting for something, or is the Blue Pill from that moment forward actually using that hex file? Or did the hex file just tell the ST-Link software how to program the Blue Pill, which it did, and the hex file doesn't actually exist on the Blue Pill anywhere, only the result of it being used?

- Even though the ST-LINK was just used to push some kind of hex file to the Blue Pill over wires, it can't be used to push some other kind of code that it also needs? There are two different types of code the Blue Pill needs? (I had previously thought the wifi was only added to remove the necessity of cabling up via ST-Link, this appears false, there is a second type of cabling, a second type of converter, and a second type of programming?)

- The Blue Pill needs some other kind of programming, which can only be done over the UART connection on the Blue Pill (not the ST-Link pins), the convenient way of doing so is to connect it to a computer. The computer can't directly speak or connect "UART", it doesn't have a UART port where you just plug in a UART cable, that doesn't exist, so you need use something you can plug into a computer, I.E. USB. So you have to use a USB-UART converter (another small electronic device you buy), so that the UART pins on the Blue Pill can go through the converter and something out the other end plugs into a USB port on a computer. This can be done over wifi or with wires.

- If you want to do it over wifi, you now need another microcontroller, an ESP8266 (of which there are dozens of variants with various capabilities), most (all?) of which are Arduino code compatible, Arduino being the most popular hobby-level microcontroller. This type of board is also maybe called an Olimex? Presumably you'd need to program the wifi microcontroller that you use to program the Blue Pill microcontroller? So there's a whole series of steps to initializing a virgin ESP8266 to even get to that point? That's where the soldering jumpers and such comes from? The ESP8266 board you use will plug into Damien's Prius Control Board so that it can wire to the UART pins on the Blue Pill and then connect to a computer as a wifi device.

- The reason for all of this is because the Blue Pill, despite being a versatile microcontroller in other ways that were suitable for the project, does not have its own UART to USB or UART to wifi capability?

- Once you connect to the UART, either via USB or Wifi, you can then use the web interface Johu wrote to make the actual motor/vehicle/oprational -specific programming changes to the software (and also create them in the first place?).

- You could also use some kind of basic terminal interface instead of the web-interface Johu wrote, and send 50 commands to the Blue Pill, one at a time. But there's no reason to do this because the web interface is free, easy to install, intuitive, and automates this process.

...

Is that even roughly correct? Any corrections or clarifications are welcome. Still trying to wrap my head around it.

Again, I think it's difficult to imagine just how far the knowledge gap between "I could assemble and use this" users and "I could design this project" leaders. I know that "Buy a pre-programmed module from the OpenInverter store" solves some of this, but, still not all of it. And, I like to at least understand the framework of what we're doing and why, in a way I could explain to a novice.
rikohm
Posts: 29
Joined: Tue Feb 26, 2019 8:08 pm
Location: Piteå, Sweden

Re: Toyota Prius Gen 2 Inverter Controller

Post by rikohm »

- We use ST-LINK to do something to the Blue Pill. We uploaded (?) a hex file. In laymen's terms, what was that hex file? Why was it uploaded? What did it accomplish? Is that hex file just sitting on the Blue Pill now waiting for something, or is the Blue Pill from that moment forward actually using that hex file? Or did the hex file just tell the ST-Link software how to program the Blue Pill, which it did, and the hex file doesn't actually exist on the Blue Pill anywhere, only the result of it being used?
The hex file is the precompiled firmware or "operating system" for the blue pill. When uploaded it will tell the blue pill what we want it to do and with which pin to do it.

- The Blue Pill needs some other kind of programming, which can only be done over the UART connection on the Blue Pill (not the ST-Link pins), the convenient way of doing so is to connect it to a computer. The computer can't directly speak or connect "UART", it doesn't have a UART port where you just plug in a UART cable, that doesn't exist, so you need use something you can plug into a computer, I.E. USB. So you have to use a USB-UART converter (another small electronic device you buy), so that the UART pins on the Blue Pill can go through the converter and something out the other end plugs into a USB port on a computer. This can be done over wifi or with wires.
You want to edit settings and parameters to fit your setup - battery voltage, motor current, throttle levels and the like.

- If you want to do it over wifi, you now need another microcontroller, an ESP8266 (of which there are dozens of variants with various capabilities), most (all?) of which are Arduino code compatible, Arduino being the most popular hobby-level microcontroller. This type of board is also maybe called an Olimex? Presumably you'd need to program the wifi microcontroller that you use to program the Blue Pill microcontroller? So there's a whole series of steps to initializing a virgin ESP8266 to even get to that point? That's where the soldering jumpers and such comes from? The ESP8266 board you use will plug into Damien's Prius Control Board so that it can wire to the UART pins on the Blue Pill and then connect to a computer as a wifi device.
The esp8266 acts like a web server that presents Johannes web interface to you over wifi and will send the values you put in it to the blue pill with the right commands, at the right speed, with the correct formatting.

- The reason for all of this is because the Blue Pill, despite being a versatile microcontroller in other ways that were suitable for the project, does not have its own UART to USB or UART to wifi capability?
..yes..

- Once you connect to the UART, either via USB or Wifi, you can then use the web interface Johu wrote to make the actual motor/vehicle/oprational -specific programming changes to the software (and also create them in the first place?).
If you use USB you need to start a web server on your computer to present the web interface ( and connect it to the right COM port represents your usb->uart interface). The usb->uart interface should be a 3.3V version, most older ones are 5V.

- You could also use some kind of basic terminal interface instead of the web-interface Johu wrote, and send 50 commands to the Blue Pill, one at a time. But there's no reason to do this because the web interface is free, easy to install, intuitive, and automates this process.
For a first try/HELLO WORLD on the bench it can be useful.
doobedoobedo
Posts: 260
Joined: Sat Jan 12, 2019 12:39 am
Location: UK

Re: Toyota Prius Gen 2 Inverter Controller

Post by doobedoobedo »

MattsAwesomeStuff wrote: Tue Dec 31, 2019 8:04 pm - We use ST-LINK to do something to the Blue Pill. We uploaded (?) a hex file. In laymen's terms, what was that hex file? Why was it uploaded? What did it accomplish? Is that hex file just sitting on the Blue Pill now waiting for something, or is the Blue Pill from that moment forward actually using that hex file? Or did the hex file just tell the ST-Link software how to program the Blue Pill, which it did, and the hex file doesn't actually exist on the Blue Pill anywhere, only the result of it being used?
Consider a microcontroller as a sort of small self-contained computer that can only run one program. That program is contained in the hex file. The ST-Link software uploads it to the blue pill which will then run it whenever it is powered up or reset.
MattsAwesomeStuff wrote: Tue Dec 31, 2019 8:04 pm - Even though the ST-LINK was just used to push some kind of hex file to the Blue Pill over wires, it can't be used to push some other kind of code that it also needs? There are two different types of code the Blue Pill needs? (I had previously thought the wifi was only added to remove the necessity of cabling up via ST-Link, this appears false, there is a second type of cabling, a second type of converter, and a second type of programming?)
The program will do different things based on it's settings, these settings are configured over the UART, this is simpler than having to change the code, recompile the program and then re-upload it each time you want to change a setting.
MattsAwesomeStuff wrote: Tue Dec 31, 2019 8:04 pm - The Blue Pill needs some other kind of programming, which can only be done over the UART connection on the Blue Pill (not the ST-Link pins), the convenient way of doing so is to connect it to a computer. The computer can't directly speak or connect "UART", it doesn't have a UART port where you just plug in a UART cable, that doesn't exist, so you need use something you can plug into a computer, I.E. USB. So you have to use a USB-UART converter (another small electronic device you buy), so that the UART pins on the Blue Pill can go through the converter and something out the other end plugs into a USB port on a computer. This can be done over wifi or with wires.
Correct - see above.
MattsAwesomeStuff wrote: Tue Dec 31, 2019 8:04 pm - If you want to do it over wifi, you now need another microcontroller, an ESP8266 (of which there are dozens of variants with various capabilities), most (all?) of which are Arduino code compatible, Arduino being the most popular hobby-level microcontroller. This type of board is also maybe called an Olimex? Presumably you'd need to program the wifi microcontroller that you use to program the Blue Pill microcontroller? So there's a whole series of steps to initializing a virgin ESP8266 to even get to that point? That's where the soldering jumpers and such comes from? The ESP8266 board you use will plug into Damien's Prius Control Board so that it can wire to the UART pins on the Blue Pill and then connect to a computer as a wifi device.
All ESP8266 boards are arduino compatible, the only difference between them is which pins on the microcontroller are connected to pins on the board and the physical layout of the board. (The Wemos D1 mini also has a USB interface on the board)
MattsAwesomeStuff wrote: Tue Dec 31, 2019 8:04 pm - The reason for all of this is because the Blue Pill, despite being a versatile microcontroller in other ways that were suitable for the project, does not have its own UART to USB or UART to wifi capability?
Correct.
MattsAwesomeStuff wrote: Tue Dec 31, 2019 8:04 pm - Once you connect to the UART, either via USB or Wifi, you can then use the web interface Johu wrote to make the actual motor/vehicle/oprational -specific programming changes to the software (and also create them in the first place?).
See above. The web interface just gives you a nicer interface to read the settings from the controller and change them. Johu's program allows a new hex file to be sent to the controller over the UART so you don't need the ST-Link to change the main program (the hex file) any more.
MattsAwesomeStuff wrote: Tue Dec 31, 2019 8:04 pm - You could also use some kind of basic terminal interface instead of the web-interface Johu wrote, and send 50 commands to the Blue Pill, one at a time. But there's no reason to do this because the web interface is free, easy to install, intuitive, and automates this process.
Correct.

I've tried to keep the answers simple, but I'm sure someone will chime in if any are wrong.
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Toyota Prius Gen 2 Inverter Controller

Post by arber333 »

Happy new year to you all...

It is not the Bluepill, it is the STM32 microcontroller that is on every board that powers Johannes inverter.
This chip may be programmed through couple of interfaces i.e. JTAG or ST-LINK. Those interfaces push either hex or bin type files that are compiled code and boot loader, which is the "saddle" for the code in the chip if you care.
For your indulgence Dima and myself presented you with a procedure to easily upload code onto Olimex chip through ST-LINK USB interface. It can also be done by mobile phone... viewtopic.php?f=2&t=6&p=16&hilit=STLINK#p16
For analog programming of Bluepill i encourage you to see its datasheet and compare which pins of the Olimex would fit the coresponding Bluepill pins. I have programmed STM32 chip of the Johannes Rev3 board the same way.

Now when the bootloader and the code are on the chip it is already a functional inverter, however the parameters are not correct. They are default settings. They need to be customized and the inverter tuned to your intended motor.
That also can be done in various ways, which is the beauty of open source.
1. You can install Linux, then equipped with USB to serial adapter and Apache server you connect to localhost:8000 and you change parameters
2. You can use Linux and command line terminal, but i find it dull. DOS days....
3. You can try installing Apache server on Windows and connecting to http://192.168.4.1/ that way
4. You can use Wifi gizmo and be free of choice which OS or PC you use, you can even use your Apple or Android phone.

Again i have written some short points on how to install web interface on Linux, from my early days with inverter.
viewtopic.php?f=2&t=453

You really need to read up on the older posts if you want to get knowledge from the grass roots.
kiwifiat
Posts: 99
Joined: Sat Dec 22, 2018 9:39 pm
Location: Vancouver, Canada
Been thanked: 10 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by kiwifiat »

You could also take advantage of the hard work done by member Dima and install his windows based web interace:

viewtopic.php?f=5&t=255#p2756

Installs on Windows 10 but have not tried earlier versions. Ir avoids the need to install Apache web server.

It is a very nice interface with a lot of extra and useful features. I am using one of these FTDI usb to ttl converter set to 3.3 Volts.
Attachments
FTDI TTL to USB.PNG
MattsAwesomeStuff
Posts: 898
Joined: Fri Apr 26, 2019 5:40 pm
Has thanked: 291 times
Been thanked: 177 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by MattsAwesomeStuff »

with a procedure to easily upload code onto Olimex chip
What's an Olimex? Is Olimex to ESP8266, what Blue Pill is to STM32?
arber333 wrote: Tue Dec 31, 2019 10:48 pmNow when the bootloader and the code are on the chip it is already a functional inverter, however the parameters are not correct. They are default settings. They need to be customized and the inverter tuned to your intended motor.
Ahhhhhh...

Gotcha.

So, the ST-Link is only good for replacing the whole bootloader at a time, and can only be done via pre-compiled hex files?

So, on a desert island without any more equipment than I currently have, if I wanted to, I still could change the settings in, I dunno, some pre-compiled source code thing (I presume those are some of those other files in Johu's Github folder where I found the .hex file), then recompile it myself, then use ST-Link to reload the whole hex file, and I could technically do that every time I wanted to change a parameter?

I wasn't (might still not be) understanding why there are two different and necessary methods for adding files to the same platform (STM32). Why not just use the USB-UART or just use ST-LINK, why isn't there a solution that does both? Just, not how it's done?
That also can be done in various ways, which is the beauty of open source.
If Open Source was an online shoe store: "There are five different ways to measure your shoe size, all of which use an incompatible set of numbers between 1 and 20. It's important to do some reading on which method you think you've learned. Any pair of shoes could use any of these methods and are not labelled, you'll have to do some research about their manufacturing history to determine what method they likely used." I JUST WANT TO BUY SOME SHOES! :P

Half of this is because I'm curious. Half of it is, since I don't want to be asking every possible question I was hoping to understand things at a bit broader view so I can answer more of my own questions when I describe how and why things are being done.
4. You can use Wifi gizmo and be free of choice which OS or PC you use, you can even use your Apple or Android phone.
Oh, I think I get it after the 3 of you explained what I thought were things I already understood. I was missing a big piece of the puzzle.

I was thinking the web interface was on a computer that somehow connects to the ESP8266, as if the ESP8266 was just a receiver. It wasn't making sense to me how you couldn't just use the web interface with a CH340 directly. I thought the web interface was just, I dunno, some file you could load in your browser and it would somehow get to the USB then to the UART through that.

I didn't get that the web interface requires a server to host it, not just a file that a browser reads directly. So, to use the web interface, you must have a webserver that connects to the UART. This webserver can either be on your PC and configured to match the way that the web interface Johannes wrote (and then forward your ports, etc), or, that's why the wifi thing is there. My missing piece was that the ESP8266 is not just a UART-USB-wifi interface, it's its own miniature webserver that we push Johannes' web interface to. It's hosted right on the ESP8266(?) I.E. not on your PC, you just use your PC's (or whatever's) browser to connect to the server being hosted on the ESP8266?

This is making a lot more sense now. And all past advice about how Wifi isn't necessary, but way easier makes mores sense. I thought the only point of wifi was the wireless aspect of it. So I was like "I can run wires, that's fine, no big deal". I completely missed the miniature web server part of why it's used.

You could, I suppose, have a mini web server some other non-wifi way and connect with wires to a computer, but at that point it wouldn't be USB, it'd be a network jack, and, at that point, why would you bother because you need some other MCU platform anyways and it might as well be the wireless one. Or you have to set up your PC /Linux to have that server. So, regardless, to use the web interface, a web server is necessary, and by far, it's easier to use a little MCU than configure that and forward ports.
You could also take advantage of the hard work done by member Dima and install his windows based web interace. Installs on Windows 10 but have not tried earlier versions. Ir avoids the need to install Apache web server.
Ahh, neat. Well since I can't find my FTDI converter, that's a solid plan B.

...

Plan A - I ordered a WeMOS D1 Mini, can get one here in 2 days for $10. Not as cheap as China but whatever I don't want to wait 3 weeks for it to arrive.

Maybe rounding the home stretch here.
Dilbert
Posts: 410
Joined: Mon Aug 12, 2019 7:21 pm
Location: Dublin, Ireland
Been thanked: 4 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by Dilbert »

If you don’t have the WiFi module you can use a terminal application to change settings over the usart interface.
User avatar
johu
Site Admin
Posts: 5791
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 157 times
Been thanked: 1025 times
Contact:

Re: Toyota Prius Gen 2 Inverter Controller

Post by johu »

MattsAwesomeStuff wrote: Wed Jan 01, 2020 5:51 am So, the ST-Link is only good for replacing the whole bootloader at a time, and can only be done via pre-compiled hex files?
Yes, the absolute minimum you need to “flash“ (that is, write to the STM32 internal flash memory) is the bootloader. As soon as that happened, the actual firmware can be programmed via uart=serial link=FTDI=CH340=ESP8266.

So when the boot loader is done you can donate your ST-Link to charity ;)

So why do we make use of 2 different interfaces?
When the STM32 leaves the factory it can be programmed in 2 ways: JTAG/SWD=ST-link or - attention: ambiguity - a serial bootloader. Yes every STM32 already has a bootloader, but:
- it uses UART1 whose pins are occupied by the main PWM!
- the accompanying programmer (pc software) needs control over the reset line by using some traditional RS232 signal like RTS - our cheap usb/serial adapters don't have this
- a special pin of the STM32 called BOOT0 needs to be toggled in order to fire up the built in bootloader in the first place. Impossible if your inverter is buried in your car

For those 3 reasons I had to write a special boot loader that
- always runs, regardless of some special pins and steps into action when a special byte sequence is transmitted by the 'client side'
- uses a different uart with no pin conflicts

You could, theoretically, change the default values within the software to your likings and recompile/reflash whenever your change a parameter. But thats hardly very handy.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
MattsAwesomeStuff
Posts: 898
Joined: Fri Apr 26, 2019 5:40 pm
Has thanked: 291 times
Been thanked: 177 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by MattsAwesomeStuff »

Dilbert wrote: Wed Jan 01, 2020 8:47 am If you don’t have the WiFi module you can use a terminal application to change settings over the usart interface.
Understood. But not the handy web interface, you'd be spitting commands one at a time using terminal, (unless you're using Dima's work that Kiwifat linked to above), and, you'd still need a UART-USB converter, which is actually more expensive than a little ESP8266 board, and less convenient.

Because I didn't have either a wifi board or a USB-UART converter, and didn't know that one or the other was required back when I ordered parts months ago, I was hoping to find a "Can I just make it work right now?" solution for my 2-month/end of year goal.

...

On that note, I've been at this 2 months now, (Oct 30th I got my inverter from the scrapyard, and we just passed Dec 31), and my only actual "work" on the project is perhaps 1-2 hours soldering and a few minutes downloading and using software. The rest is asking questions about what to buy/do, which, I'd say I've been borderline aggressive in doing, I don't think I've had many/any wasted days. In my opinion, that's so intimidating that I'm probably the first person to try it (at or below my competence/knowledge level). And I know that even though this is a development board, there are loads of people waiting in the wings for me to finish and do the writeup because they've either said so in the thread or PM'd me letting me know.

So my goal is that at the end of this process I can have a novice sit down at the Prius Gen 2 wiki, make all their purchases in 30 minutes, and when parts arrive go from a pile of parts into something that can spin a motor in about 2-3 hours without having to pester anyone for questions or clarifications. So I want to say thank you again to everyone who's invested time in answering these questions, I'll try to make sure as many people can benefit from that as possible without anyone having to put in extra or repetitive work.
User avatar
Kevin Sharpe
Posts: 1345
Joined: Fri Dec 14, 2018 9:24 pm
Location: Ireland and US
Been thanked: 4 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by Kevin Sharpe »

MattsAwesomeStuff wrote: Wed Jan 01, 2020 11:46 am I'll try to make sure as many people can benefit from that as possible without anyone having to put in extra or repetitive work.
That would be amazing, thank you :D
This is a personal post and I disclaim all responsibility for any loss or damage which any person may suffer from reliance on the information and material in this post or any opinion, conclusion or recommendation in the information and material.
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Toyota Prius Gen 2 Inverter Controller

Post by arber333 »

MattsAwesomeStuff wrote: Wed Jan 01, 2020 11:46 am So my goal is that at the end of this process I can have a novice sit down at the Prius Gen 2 wiki, make all their purchases in 30 minutes, and when parts arrive go from a pile of parts into something that can spin a motor in about 2-3 hours without having to pester anyone for questions or clarifications. So I want to say thank you again to everyone who's invested time in answering these questions, I'll try to make sure as many people can benefit from that as possible without anyone having to put in extra or repetitive work.
Ahhhh...
Sadly people still think ACIM control is some kind of black magic like in the times of Nikola Tesla. And big inverter manufacturers are not helping with those fabled expressions like "Vector control algorithm", FOC code, Torque control, Slip control etc...

There are people that will offer finished tesla LDU or SDU board (designed by JB of course) and they claim it is plug and play after you buy it from them. It is not neccesarily a scam, because it worked for them the first time, but it may not work that way for averyone. Such misled individuals are then left without support and they turn to this forum for help. All normal, since the source of knowledge is here. But for them it is frustrating.
However to get more knowledge you have to sacrifice something. Either a pile of money to get experts on board or a lot of time to learn it yourself. It wont work any other way.
Can you imagine how i was frustrated when my IGBTs blew up 3 times when i used basic drivers without protection and pushed IGBTs on edge.
At least now you get to be corrected by Toyota engineers to "stand in the corner and sulk" instead of power section blowing in your face.

If you want to contribute instructions or How to, i suggest you prepare them, so there is little ambiguity on how to follow.
Yes a procedure from step to step would be best for most people who just want to drive! Those who want to experiment will not follow it exactly of course :).
MattsAwesomeStuff
Posts: 898
Joined: Fri Apr 26, 2019 5:40 pm
Has thanked: 291 times
Been thanked: 177 times

Re: Toyota Prius Gen 2 Inverter Controller

Post by MattsAwesomeStuff »

And, looks like I'll be starting over...

- I tried loading Dima's interface to see what it was like, couldn't get the sketch to work so, probably have some questions about what to put where. Johannes' interface is still on there though.

- Changed the wifi SSID. Okay.

- Tried loading my router's wifi info into the wifi interface so that I had net access through the WeMOS (I think that's what that does?). Tried connecting to the WeMOS' SSID and then loading a webpage but, no dice. Maybe doing it wrong. I dunno.

- Thought I would try connecting the WeMOS to the Blue Pill using jumper wires. 3.3v, GND, RX, TX. Then 12v/gnd to the Control Board.

- Hurray, red and green lights on the Blue Pill, and blue on the WeMOS! Drawing about 50mA.

- Interface won't load parameters. I think, I'm not sure what it's supposed to look like since I've never used it or seen it run.

- Maybe RX/TX on BluePill goes to TX/RX on the ESP8266? No problem, I'll just shut off power and swap those two lines. Whoops, while swapping the ground wire came off, let's put that back on and power up the main board again...

- Oh, there we go, now it's drawing 600mA! 500mA. Must be doing some kind of booting/install/something now that it's connecting to the WeMOS board. 400mA. Green light is fading. Hmm, 200mA. Kinda power hungry for it not doing anything, when is it going to be done booting?

- Green light limps out. It's 4am, and it's been a good 10 seconds of me being too clueless to realize what's actually happening.

- Wait a minute... power off. *sniff sniff*. Yep, the foul stench of "You Goofed!". No smoke, but, clearly fried the green LED on the Blue Pill. When I was swapping TX and RX lines and the GND wire came off the WeMOS, I'd placed it back onto the end pin, not the second from end pin. +5v instead of GND.

I'm not sure what the significance of connecting to +5v instead of to GND, but, apparently the green LED didn't like it. Did I fry my Blue Pill as well?

...

WeMOS board seems operational. I reflashed it and it's loading all the stuff it should be loading.

Blue PIll... not sure what it's supposed to be doing since I've never had it turned on.
- Reconnected WeMOS
- Soon as I plug in the WeMOS, the Red and what's left of the faded Green LED on the Blue Pill go dark.
- WeMOS won't power up from the 3.3v line on the BluePill anymore. Maybe if I feed it power elsewhere?
- Plug in USB power from a powerbar adapter.
- Instantly smell smoke.
- Realize it's just the smell of burning dust on the radiant space heater I coincidentally had plugged into that power bar.
- Can't get the Blue Pill to do anything, but I don't know how to make it do anything anyways, I'm somewhat suspecting I fried it.
- If I plug the Blue Pill back into the ST-LINK and try to reflash the hex filel, it seems to work, and the green LED even reaches full brightness. But if I plug in the micro-USB to the Blue Pill (almost impossible, regulator is in the way), the green LED is back to like 1% brightness like it was when the board was 12v powered. Hmm.
- Ordered 3 more Blue Pills from Amazon at stupid expense because that's the only bundle that had free 2 day shipping and I'm impatient. Desoldering 40 through-hole pins simultaneously is going to be fun. So much for home stretch.
- Any way to figure out whether I need a new WeMOS D1 Mini board as well?
...

Whelp, serves me right for trying to blunder around without knowing what I was doing. New Blue Pills get here Tuesday.

Who was it that said I should've just bought Johannes' pre-installed wifi board? But no, I didn't want to wait for it to be shipped...
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Toyota Prius Gen 2 Inverter Controller

Post by arber333 »

Yes I fried my share of Olimex H103 boards as well.
I suggest you totally desolder the pins and replace them with 2.54mm sockets. You then push the new Pill into those sockets and you can also replace it if applicable.
On the note of fading LED maybe you burned a power supply on the board. This would be the reason for LED dying.

I think you should order some spare D1 too.
Post Reply