Page 1 of 1

VESC-like Toyota brain

Posted: Tue Feb 16, 2021 5:33 pm
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.

Re: VESC-like Toyota brain

Posted: Tue Feb 16, 2021 6:51 pm
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 ;)

Re: VESC-like Toyota brain

Posted: Thu Mar 04, 2021 7:59 am
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 ;)

Re: VESC-like Toyota brain

Posted: Mon Mar 08, 2021 3:06 pm
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.

Re: VESC-like Toyota brain

Posted: Mon Mar 08, 2021 3:57 pm
by Jack Bauer
Looks great:) You probably got the 1.27mm pitch version of the 34way connector.

Re: VESC-like Toyota brain

Posted: Tue Mar 09, 2021 11:26 am
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

Re: VESC-like Toyota brain

Posted: Tue Mar 16, 2021 6:17 am
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?

Re: VESC-like Toyota brain

Posted: Tue Mar 16, 2021 6:53 am
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.

Re: VESC-like Toyota brain

Posted: Sun Mar 21, 2021 7:03 pm
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.

Re: VESC-like Toyota brain

Posted: Sun Mar 21, 2021 9:58 pm
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 ;)

Re: VESC-like Toyota brain

Posted: Tue May 25, 2021 12:51 pm
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

Re: VESC-like Toyota brain

Posted: Tue May 25, 2021 5:55 pm
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

Re: VESC-like Toyota brain

Posted: Fri Jun 04, 2021 4:40 pm
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? :)

Re: VESC-like Toyota brain

Posted: Fri Jun 04, 2021 5:49 pm
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: