Search found 36 matches

by fbo
Tue Mar 01, 2022 9:39 pm
Forum: Tesla
Topic: Tesla Model 3 Rear Drive Unit Hacking
Replies: 640
Views: 139021

Re: Tesla Model 3 Rear Drive Unit Hacking

Finally I can reliably start the motor just via software and keep it running. I measure the angel via resolver, add a hardcoded delta to it, then run inverse park clark to calc the new space vectors for phase voltage. However, somewhere on the way I messed up and need to switch phases. Next steps wo...
by fbo
Thu Feb 24, 2022 1:38 pm
Forum: Tesla
Topic: Tesla Model 3 Rear Drive Unit Hacking
Replies: 640
Views: 139021

Re: Tesla Model 3 Rear Drive Unit Hacking

Just sharing this picture. 7-Figure13-1.png https://ieeexplore.ieee.org/document/6953227 Exciter and resolver coils are placed in the same tooth! Exciter are in every tooth. Just unclear if the Tesla resolver has alternating sin and cos coils or all 3 coils integrated into each tooth. 1 pic explaine...
by fbo
Wed Feb 23, 2022 9:45 pm
Forum: Tesla
Topic: Tesla Model 3 Rear Drive Unit Hacking
Replies: 640
Views: 139021

Re: Tesla Model 3 Rear Drive Unit Hacking

Just pushed a useful but small change. I've set things up so that EPWM units now continue operating in debug mode. Of note this means that printf() no longer causes weird periodic glitches in the PWM output and resolver exciter. Great, even reading the comments in the PWM header file about free mod...
by fbo
Wed Feb 23, 2022 7:24 pm
Forum: Tesla
Topic: Tesla Model 3 Rear Drive Unit Hacking
Replies: 640
Views: 139021

Re: Tesla Model 3 Rear Drive Unit Hacking

It was even 26secs per turn, 2.89 secs per rotor turn.
by fbo
Wed Feb 23, 2022 7:06 pm
Forum: Tesla
Topic: Tesla Model 3 Rear Drive Unit Hacking
Replies: 640
Views: 139021

Re: Tesla Model 3 Rear Drive Unit Hacking

Some info on the motor from a youtube comment (obviously elon under a pseudonym) : Hope this help: The rear model 3 motor is a 6 pole permanent magnet motor. The rotor has 4 sub stacks, Each end sub stack is skewed by 3.33 degrees in relation to the middle 2 stacks which are matched to each other. ...
by fbo
Wed Feb 23, 2022 6:00 pm
Forum: Tesla
Topic: Tesla Model 3 Rear Drive Unit Hacking
Replies: 640
Views: 139021

Re: Tesla Model 3 Rear Drive Unit Hacking

Forgot the gear ratio, so actual rotor is moving about 10x faster. And it is obviously 1sec over entire 2*pi of the hull.
by fbo
Wed Feb 23, 2022 5:00 pm
Forum: Tesla
Topic: Tesla Model 3 Rear Drive Unit Hacking
Replies: 640
Views: 139021

Re: Tesla Model 3 Rear Drive Unit Hacking

resolver.png Resolver triggered at 12.2kHz responding to turning engine. Rotor move is by enforced theta (angel input to inverse park clark) stepping at 2*pi/sec, i.e. 2*pi/12.2k every irq - rotor moves much slower like at 2*pi in 16-ish seconds. Seeing approx 80us sinus wave and the expected "...
by fbo
Wed Feb 23, 2022 10:50 am
Forum: Tesla
Topic: Tesla Model 3 Rear Drive Unit Hacking
Replies: 640
Views: 139021

Re: Tesla Model 3 Rear Drive Unit Hacking

I also made good progress today though a lot more theoretical. Got the resolver exciter code finished and synchronised with the PWM generation. Gave me a trace like this: Looks really good. I finally ordered a second probe to my oscilloscope, maybe I can see a bit more then as well. I have two of q...
by fbo
Tue Feb 22, 2022 9:24 pm
Forum: Tesla
Topic: Tesla Model 3 Rear Drive Unit Hacking
Replies: 640
Views: 139021

Re: Tesla Model 3 Rear Drive Unit Hacking

Engine is turning. Even quite smoothly. It requires still a bit of a manual ramp-up playing with the phases. I replaced the inverse park clark with my own floating point version as I didn't get the int based to turn (probably out of ignorance about it). This is with 12V and a small angle change of 2...
by fbo
Tue Feb 22, 2022 7:55 pm
Forum: Tesla
Topic: Tesla Model 3 Rear Drive Unit Hacking
Replies: 640
Views: 139021

Re: Tesla Model 3 Rear Drive Unit Hacking

I just connected the rotor to the power out. Pretty much // 2pi = 0xffff, about 0.5 rot per sec at 12kHz BaseT::angle += 2; FOC::SetAngle(BaseT::angle); FOC::InvParkClarke(0.1 * 0xffff, 0.25 * 0xffff); PwmDriverT::SetPhasePwm(...) 12V 1A are sufficient to move it. At the moment it just rocks forth a...
by fbo
Tue Feb 22, 2022 3:57 pm
Forum: Tesla
Topic: Tesla Model 3 Rear Drive Unit Hacking
Replies: 640
Views: 139021

Re: Tesla Model 3 Rear Drive Unit Hacking

Btw, IIUC then atomic and volatile are different concepts, volatile will prevent the compiler to optimize the variable. It prevents it from being written to a register thus potentially "hiding" changes to it during parallel access. It also prevents out-of-order execution. Atomic "just...
by fbo
Tue Feb 22, 2022 3:57 pm
Forum: Tesla
Topic: Tesla Model 3 Rear Drive Unit Hacking
Replies: 640
Views: 139021

Re: Tesla Model 3 Rear Drive Unit Hacking

It could well be the printf(). In fact I caught another DT error later - with volatile. It happened when CCS ran printf-ing in a background window. Omitting volatile could lead to wrong results being read but I also do not see how it can cause PWM glitches. You tell me :) You have way more experienc...
by fbo
Tue Feb 22, 2022 11:46 am
Forum: Tesla
Topic: Tesla Model 3 Rear Drive Unit Hacking
Replies: 640
Views: 139021

Re: Tesla Model 3 Rear Drive Unit Hacking

Adding volatile to the execTicks of the performance counter seems to have solved the problem. volatile should be avoided by all means. But I guess there is no better option for variables shared between irq handlers and main loop on the C2000. As DT errors never happened in free running mode I was as...
by fbo
Mon Feb 21, 2022 7:04 pm
Forum: Tesla
Topic: Tesla Model 3 Rear Drive Unit Hacking
Replies: 640
Views: 139021

Re: Tesla Model 3 Rear Drive Unit Hacking

I see DT errors again on some of the gate drivers (one or two of them only, not all the high or all the low sides) on the current base line code. This happens only when adding additional steps like reading currents from ADC. Not sure yet if it is additional CPU cycles in irq handling or using e.g. P...
by fbo
Sat Feb 19, 2022 7:38 am
Forum: Tesla
Topic: Tesla Model 3 Rear Drive Unit Hacking
Replies: 640
Views: 139021

Re: Tesla Model 3 Rear Drive Unit Hacking

Again, thank you for the analysis and time spent on this. Your latest version indeed works flawlessly on my board as well. The version you tested above seems to miss the latest patch though. Anyways, let’s forget about it. What is weird though that DESAT error appeared even before I started to look ...
by fbo
Mon Feb 14, 2022 8:26 pm
Forum: Tesla
Topic: Tesla Model 3 Rear Drive Unit Hacking
Replies: 640
Views: 139021

Re: Tesla Model 3 Rear Drive Unit Hacking

Btw, maybe most important for simplicity of testing: no need for any high voltages. I can drive the output with 12V on the HV input. In 12V, out 12V PWM. Increasing input to 20V the output is following along nicely 1:1. If it would turn a rotor is a different question. Wondering if we can test curre...
by fbo
Mon Feb 14, 2022 12:10 pm
Forum: Tesla
Topic: Tesla Model 3 Rear Drive Unit Hacking
Replies: 640
Views: 139021

Re: Tesla Model 3 Rear Drive Unit Hacking

I got a nice square wave on oscilloscope on the high voltage motor connectors. Also gate drivers seem to finally behave with a -25/+25V signal on it's GON/GOFF output matching the input PWM's 25% duty cycle. For that to happen I had to do a couple of things: 1. replace 12V power supply to something ...
by fbo
Sun Feb 13, 2022 7:24 pm
Forum: Tesla
Topic: Tesla Model 3 Rear Drive Unit Hacking
Replies: 640
Views: 139021

Re: Tesla Model 3 Rear Drive Unit Hacking

red is IN- (up), orange is IN+ (underneath). Duty cycle 25%. Screenshot 2022-02-13 at 20.19.18.png I think (can you check?) IN+ and IN- are inverse and deadtimes are measured at 855ns (shall be 875ns from MCU) and longer than the gate driver's 800ns. 1. MCU's deadtimes need to be shorter than the ga...
by fbo
Sun Feb 13, 2022 2:41 pm
Forum: Tesla
Topic: Tesla Model 3 Rear Drive Unit Hacking
Replies: 640
Views: 139021

Re: Tesla Model 3 Rear Drive Unit Hacking

The error we ran into was REGERRRR in STATUS2. Disabling DESAT in the gate driver fixes it. I guess using HVIL also would fix it. I run into DT_ERR now - something I was almost suspecting may happen. Unlike REGERRRR it at least doesn't put the driver into sleep. Datasheet: When the deadtime function...
by fbo
Sat Feb 12, 2022 6:20 am
Forum: Tesla
Topic: Tesla Model 3 Rear Drive Unit Hacking
Replies: 640
Views: 139021

Re: Tesla Model 3 Rear Drive Unit Hacking

All MCU side conditions for operation are met. After reading the data sheet again I can only guess that the driver is in safe state. This is due to DESAT protection which - IIUC - is controlled by HVIL. The DESAT flag should be set in STATUS1 but that is something I don't see due to CIO letting me d...
by fbo
Fri Feb 11, 2022 5:41 pm
Forum: Tesla
Topic: Tesla Model 3 Rear Drive Unit Hacking
Replies: 640
Views: 139021

Re: Tesla Model 3 Rear Drive Unit Hacking

Very good to have those pics. In the meantime I identified the transistor pairs - 6 N/P channel MOSFET pairs of - a ST STD46P4LLF6 40V P-channel and - a Infineon 3N0408 N-channel. Also found better isognd and measure now stable -5V permanent voltage at the source/sink gate output of the gate driver....
by fbo
Fri Feb 11, 2022 12:15 pm
Forum: Tesla
Topic: Tesla Model 3 Rear Drive Unit Hacking
Replies: 640
Views: 139021

Re: Tesla Model 3 Rear Drive Unit Hacking

Posting to wider audience. Maybe there are ideas. I am not able to see any meaningful output of the Gate Drivers. I have PWM on the input of the gate drivers. SS2 high, PSU enabled, Gate enabled, OE enabled. 5V on the isolated side everywhere, even on the HV 3-phase output. I have 66.7 V on the HV i...
by fbo
Fri Feb 11, 2022 12:00 pm
Forum: General
Topic: HV DC power supply for inverter testing
Replies: 9
Views: 1935

Re: HV DC power supply for inverter testing

I doubt regen is an issue here. The rotor is not even turning yet, it is not even connected and even further away from being pushed down a hill by 2t of metal around. I tested with a AC/DC charger at 66.7V max 2.5A. There is still something preventing the gate drivers to work. Either we need more th...
by fbo
Wed Feb 09, 2022 7:50 pm
Forum: Tesla
Topic: Tesla Model 3 Rear Drive Unit Hacking
Replies: 640
Views: 139021

Re: Tesla Model 3 Rear Drive Unit Hacking

Yes, I was joking (obviously). So, it is 3 things that need to be controlled: PSU Enable Pin, SS2 and GPIO78
by fbo
Wed Feb 09, 2022 6:51 pm
Forum: Tesla
Topic: Tesla Model 3 Rear Drive Unit Hacking
Replies: 640
Views: 139021

Re: Tesla Model 3 Rear Drive Unit Hacking

Yes, at least one more gate. Got the pwm on the mcu side now, SS1/2 high but still not measuring pwm on the gate driver IN+ and -. Guess I'll either watch through the videos (again) or just unscrew the board. Latter probably faster ;-) Hope it's max 4 layers with all signal traces on the outside for...