Tesla Model 3 Rear Drive Unit Hacking

Topics concerning the Tesla front and rear drive unit drop-in board
davefiddes
Posts: 375
Joined: Mon Jan 18, 2021 12:39 pm
Location: Edinburgh, Scotland, UK
Has thanked: 149 times
Been thanked: 195 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by davefiddes »

Thanks. Looks like you're pretty close.
SDS00015.png
The sample is actually scheduled from the trailing edge of the cyan trace. This measures as 82 uSec. Which is a shift from the 40 uSec used at 4.4kHz. I hope there is enough time for the injected conversion to complete before the resolver code reads the value on the rising edge of the cyan trace.

Fixing up the filter has improved the output from the resolver markedly though.

I've mounted the resolver in my motor but it just produces garbage data until I fix the timing. The ADC is very noisy on the V1 board too (as previously noted). I measured 250mV ripple on the VDDA pin without a functioning gate driver PSU. :-|
User avatar
Jack Bauer
Posts: 3831
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 75 times
Been thanked: 696 times
Contact:

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by Jack Bauer »

Yeah sorry Dave the V1 was kinda a disaster. What I could do is place a 3 way solder pad jumper on the board for choosing resolver exciter source and push ahead with the V3 a bit sooner if that helped?
I'm going to need a hacksaw
davefiddes
Posts: 375
Joined: Mon Jan 18, 2021 12:39 pm
Location: Edinburgh, Scotland, UK
Has thanked: 149 times
Been thanked: 195 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by davefiddes »

I'm planning on removing the 3.3V regulator and bodging in a linear regulator. Hopefully that'll clean things up.

My resolver is now covered in ATF so I need to relocate development activities from my desk to the garage. I think we're not far of it working.

Reconfigurable exciter sources might not be daft. Just having an R106A and R106B with one No Populate would be easy to do and give options...
User avatar
crasbe
Posts: 310
Joined: Mon Jul 08, 2019 5:18 pm
Location: Germany
Has thanked: 53 times
Been thanked: 163 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by crasbe »

davefiddes wrote: Tue Sep 09, 2025 6:33 pm The ADC is very noisy on the V1 board too (as previously noted). I measured 250mV ripple on the VDDA pin without a functioning gate driver PSU.
You can try to add copper straps from ground pads to the mounting holes, for example with solder wick. The more the better.
Important areas are the ground connection(s) on the 30 pin connector (or whereever you have your power supply connected) and around the gate driver supply.
davefiddes
Posts: 375
Joined: Mon Jan 18, 2021 12:39 pm
Location: Edinburgh, Scotland, UK
Has thanked: 149 times
Been thanked: 195 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by davefiddes »

Not very fruitful day. Hey ho. Some combination of removing U22 and replacing with an LD1117 and U6 (for good luck) and joining up the unconnected holes with 2.5^2 copper has quietened things up nicely.

Some very clean signals going to/coming from the resolver:
SDS00016.png
Cyan is main control loop with the dotted line being the sample delay. Yellow is the sine and green the cosine signals with purple being the exciter.

Zooming out a bit things still look good:
SDS00017.png
Every cycle is identical and the hit-one-miss-one sampling looks like it should deliver a stable answer for a static motor.

The signals heading into the ADC look good to me. Biasing is correct and the amplitude is fine (e.g. sine 2.40V pk-pk and cosine 1.04V pk-pk):
SDS00019.png
SDS00018.png
Obviously a software problem right!? Apart from fixing the exact timing the sample is taken I've not changed any of the non-initialisation resolver code at all. Need to sleep on it and go again tomorrow.
User avatar
Jack Bauer
Posts: 3831
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 75 times
Been thanked: 696 times
Contact:

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by Jack Bauer »

As far as I'm concerned that's damn fine work Dave :)
I'm going to need a hacksaw
User avatar
crasbe
Posts: 310
Joined: Mon Jul 08, 2019 5:18 pm
Location: Germany
Has thanked: 53 times
Been thanked: 163 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by crasbe »

davefiddes wrote: Wed Sep 10, 2025 5:40 pm Not very fruitful day.
Sounds very fruity to me!

Annoying that you have to work with the faulty V1 PCB (and we failed to notify you of the issues we found/discussed in Discord), but good that you got it running :)
davefiddes
Posts: 375
Joined: Mon Jan 18, 2021 12:39 pm
Location: Edinburgh, Scotland, UK
Has thanked: 149 times
Been thanked: 195 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by davefiddes »

Face palm. Assumptions will make an ass of you and me...

When operating at a fixed 4.4kHz control loop and exciter loop the time between the falling edge of the exciter and the peak of the exciter sine wave is 40 uSec. On the rising edge it is assumed to be symetrical at 40 uSec. This falls apart when the exciter is running at 8.8kHz and the control loop at 4.4kHz. The falling edge needs to wait 85 uSec before sampling but the rising edge only 28 uSec. In other words 1/2 a wavelength less.
SDS00021.png
SDS00020.png
Fix that and I stop getting garbage data. Here's a plot of the angle as I walk an uncalibrated nut round the resolver ring then hold it steady:
Screenshot 2025-09-11 122604.png
Just need to clean up the code and add a new resolver type.
User avatar
Jack Bauer
Posts: 3831
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 75 times
Been thanked: 696 times
Contact:

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by Jack Bauer »

Excellent work Dave.
I'm going to need a hacksaw
User avatar
Jack Bauer
Posts: 3831
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 75 times
Been thanked: 696 times
Contact:

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by Jack Bauer »

Ok so I pulled the inverter from the car , loaded in Dave's firmware. Only problem was it detected the hardware as a minimainboard so I just added a bodge line to
static HWREV ReadVariantResistor()
{
return HW_TESLAM3;
}

After that all was well, I cut the track from PD2 to R106 and added the wire from PC6 to R106. All those years spent chipping game consoles came in handy. Connected up to my bench motor , hit the throttle and away it goes.

One observation is the web interface is a LOT more stable now. I'm going to hookup to CAN next and see if the mapping works etc.

Thank you Dave.
Attachments
Screenshot from 2025-09-13 13-17-58.png
Screenshot from 2025-09-13 13-05-02.png
20250913_131819.jpg
20250913_124432.jpg
20250912_184856.jpg
I'm going to need a hacksaw
davefiddes
Posts: 375
Joined: Mon Jan 18, 2021 12:39 pm
Location: Edinburgh, Scotland, UK
Has thanked: 149 times
Been thanked: 195 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by davefiddes »

Jack Bauer wrote: Sat Sep 13, 2025 12:26 pm Ok so I pulled the inverter from the car , loaded in Dave's firmware. Only problem was it detected the hardware as a minimainboard so I just added a bodge line to
static HWREV ReadVariantResistor()
{
return HW_TESLAM3;
}
Can you stick a breakpoint in at line 174 and tell me what "result1" reads as. I had to bodge the HW_MG and HW_TESLAM3 windows down as the V1 board was consistently reading lower than it should do. It's not a noise issue as the values haven't improved since I fixed that up.

If more recent hardware is going to behave I'll just hack my V1 board to have a bigger resistor to get the correct reading.

Other than that it all sounds good. I'm not sure I could do micro-soldering whilst being glared at like that...very off putting. ;-)
User avatar
Jack Bauer
Posts: 3831
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 75 times
Been thanked: 696 times
Contact:

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by Jack Bauer »

I'm sorry Dave I can't do that....

Sorry! Couldn't resist :)

I don't have debug setup on the stlink and codeblocks yet. Will try to get it sorted. Meanwhile can mapping and OIC working perfectly.
Attachments
Screenshot from 2025-09-13 14-26-30.png
Screenshot from 2025-09-13 14-26-20.png
I'm going to need a hacksaw
davefiddes
Posts: 375
Joined: Mon Jan 18, 2021 12:39 pm
Location: Edinburgh, Scotland, UK
Has thanked: 149 times
Been thanked: 195 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by davefiddes »

Excellent news on the CAN mapping front.

I've restored the variant detection windows to what they should be. Hopefully this will just work for you if you pull the latest code.
User avatar
Jack Bauer
Posts: 3831
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 75 times
Been thanked: 696 times
Contact:

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by Jack Bauer »

Sadly that made it detect as a V1 board so I put the bodge back in and updated via OIC.
I'm going to need a hacksaw
User avatar
Jack Bauer
Posts: 3831
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 75 times
Been thanked: 696 times
Contact:

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by Jack Bauer »

Got the front drive unit inverter off. Will grab a gate spi log tomorrow. Tempted to see if I can spin it with the rear inverter while I have it off the car. Not sure how the sine firmware deals with resolver though...
Attachments
20250913_155514.jpg
20250913_155512.jpg
20250913_155338.jpg
I'm going to need a hacksaw
davefiddes
Posts: 375
Joined: Mon Jan 18, 2021 12:39 pm
Location: Edinburgh, Scotland, UK
Has thanked: 149 times
Been thanked: 195 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by davefiddes »

That's properly crusty in places. I may be going senile but the inverter board looks like a spitting image of my RDU board. It's the same PCBA at least. IIRC the first FDU board you had was missing all sorts of components around the "viper" HV gate driver supply. They clearly thought they were necessary at this point. Curious.
davefiddes
Posts: 375
Joined: Mon Jan 18, 2021 12:39 pm
Location: Edinburgh, Scotland, UK
Has thanked: 149 times
Been thanked: 195 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by davefiddes »

Fixed the variant detection. The ADC was not being calibrated before reading the variant potential divider. The Tesla M3 variant uses a 5V reference and
47K/3K3 divider which produces a 0.3277V signal on PC5. Uncalibrated this reads as 335. Calibrated as 406. According to the wiki this is expected to be 407.
User avatar
Jack Bauer
Posts: 3831
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 75 times
Been thanked: 696 times
Contact:

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by Jack Bauer »

Will test in the morning. Thanks Dave.
I'm going to need a hacksaw
User avatar
Jack Bauer
Posts: 3831
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 75 times
Been thanked: 696 times
Contact:

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by Jack Bauer »

V3 board layout with option for HF or standard exciter. Will test board detection tomorrow. Sorry Dave got sidetracked today.
Attachments
M3DU_BoardV3_exc.jpg
I'm going to need a hacksaw
teslerbiscuit
Posts: 1
Joined: Sun Sep 14, 2025 5:39 pm
Has thanked: 2 times
Been thanked: 1 time

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by teslerbiscuit »

Hey you guys are absolutely amazing. Can't wait to get one of these to play with.
User avatar
Jack Bauer
Posts: 3831
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 75 times
Been thanked: 696 times
Contact:

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by Jack Bauer »

Thank you :) The next order (V3 board) will be for 10 pieces. A few will go to beta testers and I have an inverter and motor lined up here for destructive testing. I want to see exactly what it takes to blow one of these so we can identify and mitigate as much as possible before general release.
I'm going to need a hacksaw
User avatar
Jack Bauer
Posts: 3831
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 75 times
Been thanked: 696 times
Contact:

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by Jack Bauer »

Board detect works a treat. Nice one Dave. I'll get the inverter back in the car today hopefully.
Attachments
Screenshot from 2025-09-15 11-13-00.png
Screenshot from 2025-09-15 11-13-00.png (8.15 KiB) Viewed 1892 times
I'm going to need a hacksaw
davefiddes
Posts: 375
Joined: Mon Jan 18, 2021 12:39 pm
Location: Edinburgh, Scotland, UK
Has thanked: 149 times
Been thanked: 195 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by davefiddes »

That's good to know. Johannes probably never noticed the problem because the other variants use higher voltages so farther away from the extremes of ADC range where the calibration matters more.
User avatar
Jack Bauer
Posts: 3831
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 75 times
Been thanked: 696 times
Contact:

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by Jack Bauer »

Got the inverter back in the car today. Tomorrow will be HV wiring day hopefully. Also made up a drive unit loom. Not super exciting but is exact same pin usage as OEM so an OEM harness can be used if wanted. In the picture the bundle of orange twisted pairs in the middle are the 6 resolver and 2 motor temp wires , Blue in the top left is oil pump LIN , Green is T15 , Brown and red , CANL and CANH, orange brake pedal , Purple 12v permanent and black is ground.
Attachments
20250915_125723.jpg
I'm going to need a hacksaw
User avatar
Jack Bauer
Posts: 3831
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 75 times
Been thanked: 696 times
Contact:

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by Jack Bauer »



Not much new here just a quick update. Got the cooling system plumbed in yesterday.
I'm going to need a hacksaw
Post Reply