I was measuring the resistance of a hoverboard motor using a VESC 6 MKIII. The value I get is about 140 mΩ.
I also tested the motor directly on my power supply. 0.4 V phase-phase gives 1 Amp, meaning the phase-zero resistance is about 200 mΩ (400 mV / 1 A / 2).
As the difference was quite large I started to check some things. When checking the VQ and IQ in the realtime data after the RL measurement I manually calculate close to 200 mΩ (Rs=Vq/Iq for stationary motor and current). Then in the source code I found the following in mcpwm_foc_measure_resistance:
return (voltage_avg / current_avg) * (2.0 / 3.0);
I do not think this factor 2/3 should be used here. The voltage and current in the dq domain divided by each other directly gives you the phase-zero resistance. If this factor 2/3 was not there the value would have been 210 mΩ, much closer to my measured value.
I also see the same factor used in the inductance measurement. But then, when the inductance value is used for the PMSM decoupling a factor 3/2 is applied again, making it correct there. However, as the current controller parameters use the R and L with the factor 2/3 the current controller has a control bandwidth (zero-dB crossing) of 2/3th of the setting in the calculation screen.
I hope I am wrong and the code is correct, can somebody please explain the factor 2/3?
PS. The controller and software are really awesome, great job Benjamin!