VESC-like Toyota brain

Topics concerning the Toyota and Lexus inverter drop in boards
Post Reply
User avatar
zilion
Posts: 58
Joined: Tue Feb 02, 2021 7:50 am
Location: Poland

VESC-like Toyota brain

Post by zilion »

The idea of this project is to merge two cool sources:
1. repurposing of Toyota cheap hardware (great work by Johannes and Damien)
2. and VESC-like software interface
to provide minimum knowledge from user side, and maximum usability of aftermarket hardware.

My input so far:
1st part: electronic brain:
- all STM32 micros -simplify BOM, make them interconnected (CAN), maybe one software for all microcontrollers.
This made me to rearrange some pins -I'll know if it's good for sure during software development
- added some solder jumpers especially to power stage outputs -it's helpful during assembly and capacitor shorts later.
- added USB interfaces for easy reprogramming, or software update later.
- connectors for UART to connect Bluetooth dongle for remote communication.

2nd part: software development:
- RTOS for all STM's :)
- QT Configuration and debug editor like VESC has.

In this first post I'll keep all the changes and progress in this project.
You do not have the required permissions to view the files attached to this post.
I smell lithium in the air. It's not lithium, it's glycolium.
User avatar
johu
Site Admin
Posts: 6772
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 385 times
Been thanked: 1595 times
Contact:

Re: VESC-like Toyota brain

Post by johu »

Following with interest. Could never be bothered with QT IDE but it should be more responsive then web stuff. Though less universal.
Don't like the redundant complexity of RTOSes but hey, this is your project ;)
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
zilion
Posts: 58
Joined: Tue Feb 02, 2021 7:50 am
Location: Poland

Re: VESC-like Toyota brain

Post by zilion »

little update on project:

Just received some parts from Singapore.
lcsc.jpg
Still waiting for the PCBs (there was chinese New Year, so the World stood still for a bit). Hope they'll come soon.
And some parts from Ali still coming.

BTW, I have purchased some 50pcs STM32F103RBT6 MCU's from Ali for a dollar per piece. Other offers are twice the price, so that offer immediately disappeared. I thought they will not send (but they did eventually). That thought made me look for an alternative, and I found one: STM32F103RCT6 https://www.aliexpress.com/item/32919491159.html. It's even cheaper than dollar a piece and more buffed version of STM32F103RBT6.

So if anyone wants to invest his capital in this one then this is a chance ;)
You do not have the required permissions to view the files attached to this post.
I smell lithium in the air. It's not lithium, it's glycolium.
User avatar
zilion
Posts: 58
Joined: Tue Feb 02, 2021 7:50 am
Location: Poland

Re: VESC-like Toyota brain

Post by zilion »

Update:

Today I've received PCB's.
PCB_TOP_VIEW.jpg
Things that came up:
1. naked vias -no silkscreen. Manual painting needed.
2. main connector half a size -I don't know whose design it was, but now I'll have some precise soldering lesson. LOL
3. some parts around the nuts needs to be rearranged, but nothing tragic.

Fitting in Yaris inverter is perfect.
PCB_FITTING.jpg
I will need to design ground pads for bottom layer for ground connection.
Two bolts have special tabs for ground connection to the chassis.
Common GND is important to omit most connection problems.
You do not have the required permissions to view the files attached to this post.
I smell lithium in the air. It's not lithium, it's glycolium.
User avatar
Jack Bauer
Posts: 3668
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 12 times
Been thanked: 356 times
Contact:

Re: VESC-like Toyota brain

Post by Jack Bauer »

Looks great:) You probably got the 1.27mm pitch version of the 34way connector.
I'm going to need a hacksaw
User avatar
zilion
Posts: 58
Joined: Tue Feb 02, 2021 7:50 am
Location: Poland

Re: VESC-like Toyota brain

Post by zilion »

Jack Bauer wrote: Mon Mar 08, 2021 3:57 pm You probably got the 1.27mm pitch version of the 34way connector.
Yep, that's my case.
I was so confident, that I haven't printed on paper before ordering.
What can go wrong? XD
I smell lithium in the air. It's not lithium, it's glycolium.
User avatar
zilion
Posts: 58
Joined: Tue Feb 02, 2021 7:50 am
Location: Poland

Re: VESC-like Toyota brain

Post by zilion »

I'm having doubts about resolver schematics.
resolver.jpg
C78 and C79 are getting slightly warm, board is taking 100mA more current and there are no shorts.
Should I rise values of resistance in this voltage dividers?
You do not have the required permissions to view the files attached to this post.
I smell lithium in the air. It's not lithium, it's glycolium.
User avatar
zilion
Posts: 58
Joined: Tue Feb 02, 2021 7:50 am
Location: Poland

Re: VESC-like Toyota brain

Post by zilion »

Well, I've raised all resistors to 2.2kOhm, and now its fine.
But I'm worried if resolver will get enough current :)
I've never played with resolvers in my life.
I smell lithium in the air. It's not lithium, it's glycolium.
User avatar
zilion
Posts: 58
Joined: Tue Feb 02, 2021 7:50 am
Location: Poland

Re: VESC-like Toyota brain

Post by zilion »

I have to resign with USB ports.

In STM32F1 family USB and CAN cannot be used concurrently because they share this same 512 SRAM read-write buffer.
So USB have to go. USART is only option left.
I smell lithium in the air. It's not lithium, it's glycolium.
User avatar
johu
Site Admin
Posts: 6772
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 385 times
Been thanked: 1595 times
Contact:

Re: VESC-like Toyota brain

Post by johu »

I'm a bit surprised about 100mA from the resistor bridge. Because 3.3V/440 Ohm = 7.5mA. Times 2 15 mA. Hmm. The bridge is only loaded by ADC input impedance, so I think 2k2 will also be fine.

Never got USB to work either, mostly because I wasn't motivated to dig deeper ;)
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
zilion
Posts: 58
Joined: Tue Feb 02, 2021 7:50 am
Location: Poland

Re: VESC-like Toyota brain

Post by zilion »

I'm still struggling with resolver.
I have some questions, that maybe someone can enlighten me :)

1. I can't configure injected ADC readings with DMA. Looks like STM32F1 doesn't support this, but only in interrupt mode.
Regular ADC can work with DMA, not injected.

2. I can't probe sine twice in one PWM cycle. I fire ADC reading with TIM3.CC4 for point "A" (on picture below), and then I must change TIM3->CCR4, but it will be loaded in next PWM cycle. It's written in shadow registers witch are updating at the beginning of the next cycle.
So in every cycle I can read at point "A" or "B", but not both.
But should I even worry about this? Maybe I don't need such resolution and just read at one point?
Resolver_ADC.jpg
You do not have the required permissions to view the files attached to this post.
I smell lithium in the air. It's not lithium, it's glycolium.
User avatar
johu
Site Admin
Posts: 6772
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 385 times
Been thanked: 1595 times
Contact:

Re: VESC-like Toyota brain

Post by johu »

Real quick: no, injected channels do not support DMA. On the other topic check the existing code. Thats why resolver frequency is only half pwm service frequency
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
zilion
Posts: 58
Joined: Tue Feb 02, 2021 7:50 am
Location: Poland

Re: VESC-like Toyota brain

Post by zilion »

I'm trying to understand Atan2() method, and I've found some inconsistency with the reference document.
arcTan2.jpg
I don't know yet how big impact it makes, but maybe someone could explain this change to me? :)
You do not have the required permissions to view the files attached to this post.
I smell lithium in the air. It's not lithium, it's glycolium.
User avatar
johu
Site Admin
Posts: 6772
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 385 times
Been thanked: 1595 times
Contact:

Re: VESC-like Toyota brain

Post by johu »

In the original implementation 2*PI was represented as 32768 whereas in my variant it is 65536. Sorry about the magic numbers :roll:
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
Post Reply