Page 13 of 31

Re: Tesla Model 3 Rear Drive Unit Hacking

Posted: Fri May 07, 2021 11:25 am
by Jack Bauer
Ok. Just confirmed pin 60 as the resolver exciter using the front drive unit inverter which still has its Musk brain intact. I'm seeing 10khz sine 3.5v peak on that pin even with resolver unplugged. Feedback signals appear on sine and cos pins only when resolver is connected.

Re: Tesla Model 3 Rear Drive Unit Hacking

Posted: Fri May 07, 2021 12:30 pm
by EV_Builder
Jack, are you putting stuff out on GitHub? Would like to pull the trigger together again so I can play along. If I get confident I might buy the M3 motor. I want 4WD :)

Re: Tesla Model 3 Rear Drive Unit Hacking

Posted: Fri May 07, 2021 1:38 pm
by davefiddes
Jack Bauer wrote: Fri May 07, 2021 11:25 am Ok. Just confirmed pin 60 as the resolver exciter using the front drive unit inverter which still has its Musk brain intact. I'm seeing 10khz sine 3.5v peak on that pin even with resolver unplugged. Feedback signals appear on sine and cos pins only when resolver is connected.
Sorry for the wild goose chase. Doesn't make a lot of sense on the face of it, pin 60/ADCIND4 is analog input only. I'd imagine you'll find the same signal on pin 42/ADCINA1/DACOUTB which is the only DAC output channel that's free. Of academic interest only though for your board's purposes.

Re: Tesla Model 3 Rear Drive Unit Hacking

Posted: Fri May 07, 2021 1:44 pm
by Jack Bauer
No need to apologise at all:) Glad to have some company on the journey. Nothing on pin 42 that I can measure. Keeping in mind of course we are very far from having the inverter in run mode. Both Musk brains are probably totally freaked out.

Re: Tesla Model 3 Rear Drive Unit Hacking

Posted: Fri May 07, 2021 1:59 pm
by davefiddes
I'm stumped for now. DACOUTA and DACOUTC are the Sine/Cosine inputs. If there's nothing on DACOUTB then that implies the sine wave is coming from something off chip or I really haven't understood the pin mapping capabilities of this chip. :(

Re: Tesla Model 3 Rear Drive Unit Hacking

Posted: Fri May 07, 2021 2:08 pm
by MattsAwesomeStuff
Jack Bauer wrote: Fri May 07, 2021 1:44 pmBoth Musk brains are probably totally freaked out.
Image

Re: Tesla Model 3 Rear Drive Unit Hacking

Posted: Fri May 07, 2021 2:56 pm
by Jack Bauer
On that note I just ran a test on the lobotomised rear inverter. Injected 3.3v 10khz sine onto the pin 60 pad. Guess what? Elon's body just sat there. No excitation, no feedback. Sounds like I have a bit of digging to do tomorrow. Could be just some enable pin or it's me that's messed up and the signal that I thought was a dac output is just monitoring. What we do know as of now is that it goes away when the mcu is held in reset and is not present when the mcu is removed. Good catch Dave:)

Re: Tesla Model 3 Rear Drive Unit Hacking

Posted: Fri May 07, 2021 3:39 pm
by davefiddes
Curious. What happens if you inject the 10kHz square wave (this is part of the gate drive PSU IIRC?). Is there perhaps a PLL generating the sine wave from that?

Re: Tesla Model 3 Rear Drive Unit Hacking

Posted: Sat May 08, 2021 8:33 am
by Jack Bauer
Well, moron of the month award goes to .....wait for it.....ME! Turns out you were right Dave. The 10khz square wave on pin 160 is indeed the source of the resolver excitation. when I applied a 10khz 3.3v sq wave to this pin I get a nice sine wave back on pin 60 as well as corresponding sine and cos on their respective pins. So I tried 4.4khz. Musk don't like that. Lots of distortion. He does like 8.8Khz no problem.... Johannes is going to kill me. We don't need a dac...

Re: Tesla Model 3 Rear Drive Unit Hacking

Posted: Sat May 08, 2021 12:09 pm
by davefiddes
Reverse engineering is hard. Your original hypothesis seemed fine to me and the TI app notes and training materials are all about synthesising sine waves digitally. I've done a bit of digging in a Synchro/Resolver conversion book and can't quite figure out what Tesla is doing with the ADC sample of the exciter reference. There must be some sort of automatic synchronisation or error correction tuning going on. More learning required...

If you kept the F103RDT6 it has 3 ADC channels so would allow us to do a similar job to the Tesla FW in the future if we figure out the value in using it. Then again if it hasn't mattered up to now KISS.

Re: Tesla Model 3 Rear Drive Unit Hacking

Posted: Sat May 08, 2021 7:37 pm
by EV_Builder
davefiddes wrote: Sat May 08, 2021 12:09 pm Reverse engineering is hard. Your original hypothesis seemed fine to me and the TI app notes and training materials are all about synthesising sine waves digitally. I've done a bit of digging in a Synchro/Resolver conversion book and can't quite figure out what Tesla is doing with the ADC sample of the exciter reference. There must be some sort of automatic synchronisation or error correction tuning going on. More learning required...

If you kept the F103RDT6 it has 3 ADC channels so would allow us to do a similar job to the Tesla FW in the future if we figure out the value in using it. Then again if it hasn't mattered up to now KISS.
Some ideas:
Couldn't it be as simple as a check that the 10Khz signal sending out is healthy and working? So that your quality of Sin / Cos is guaranteed? Or that they use it to check resolver connections?

Re: Tesla Model 3 Rear Drive Unit Hacking

Posted: Sat May 08, 2021 9:56 pm
by johu
Shiiiet, all that good work for nothing. Still, was fun :)
Hmm, 8.8 kHz means we need to bump control loop frequency to 17.6 kHz. Or deploy one of the extra timers for generating it in a well synchronized manner.

Re: Tesla Model 3 Rear Drive Unit Hacking

Posted: Mon May 10, 2021 6:11 pm
by Jack Bauer
It's all good. I'll just rip off your hard work for the vcu:) Anyway, boards on the way.

Re: Tesla Model 3 Rear Drive Unit Hacking

Posted: Mon May 10, 2021 7:13 pm
by JaniK
Heh, just received my Leaf VCU today, thanks Damien.

Now I have to prepare to dish out another small share of a lanzarote manor for a M3 modboard. Well I have had the motor sitting in the garage for a year now, so not a huge surprise.

I am not asking the obvious stupid question anymore.

Board truly has matured a long way from the Wired modboard.

Well done.

Re: Tesla Model 3 Rear Drive Unit Hacking

Posted: Tue May 11, 2021 8:25 am
by Jack Bauer
Thank you:) Just never could get myself to like the wired board but it was an important step.

In other news the ...uh...High density devices have arrived. Just don't tell the Muskians that its actually a Gigadevice part.

Re: Tesla Model 3 Rear Drive Unit Hacking

Posted: Tue May 11, 2021 9:11 am
by johu
108 MHz, wow :) So you could just connect it to the 10 MHz crystal and it will happily run at 90 MHz. Just the LED will blink a bit too fast ;)

Re: Tesla Model 3 Rear Drive Unit Hacking

Posted: Tue May 11, 2021 10:20 am
by EV_Builder
Damien, did you consider of a step in between?
First making a header modboard and giving the modboard it self the counter part? I hope we won't have many board iterations but it would make hardware upgrading/updating a walk in the park...
When we have all things done/running we could go 'weld on style'..

Re: Tesla Model 3 Rear Drive Unit Hacking

Posted: Wed May 19, 2021 4:47 pm
by Jack Bauer
Got a delivery :)

Re: Tesla Model 3 Rear Drive Unit Hacking

Posted: Wed May 19, 2021 5:43 pm
by JaniK
Exciting, next the black box in the middle?

That really reminds me of some old Athlon/duron processors.

Re: Tesla Model 3 Rear Drive Unit Hacking

Posted: Thu May 20, 2021 10:59 am
by Jack Bauer
And its in. Quite anticlimactic in the end. Power rails, xtal and a few random tests show no shorts or non connections so far. Now to fit the BEAST of an mcu that this drive unit deserves:)

Re: Tesla Model 3 Rear Drive Unit Hacking

Posted: Thu May 20, 2021 11:13 am
by davefiddes
Exciting times. Hope it all goes smoothly. Looks like you've gone for a regular FR4 based PCB this time rather than the flat flex. Is this because you don't need the castellated edges? Do you need to do anything on the underside to stop vias shorting against the ground pad for the TI chip?

Re: Tesla Model 3 Rear Drive Unit Hacking

Posted: Thu May 20, 2021 12:52 pm
by Jack Bauer
Just experimenting with the fr4 really. its a lot cheaper than the polymide so at least will let me find the mistakes:)

Re: Tesla Model 3 Rear Drive Unit Hacking

Posted: Thu May 20, 2021 10:32 pm
by EV_Builder
Jack Bauer wrote: Thu May 20, 2021 12:52 pm Just experimenting with the fr4 really. its a lot cheaper than the polymide so at least will let me find the mistakes:)
Did you consider the idea for a connector/populate board for this phase of the dev? The cheaper board could connect to it...

Re: Tesla Model 3 Rear Drive Unit Hacking

Posted: Mon Aug 02, 2021 12:15 pm
by vaijab
I am just wondering whether there has been any progress on this project? I am planning for my next EV conversion (bmw e36 cabrio) and looking for options in terms of a drive unit. Would love to go with tesla model 3 one.

Re: Tesla Model 3 Rear Drive Unit Hacking

Posted: Tue Aug 03, 2021 8:30 am
by Jack Bauer
The model 3 drive unit project will be worked on again soon. As I have mentioned elsewhere I'm in the process of a house move which places a considerable strain on my time.