Dear friend:

I have a problem of calculating of back EMF in the MC9S12ZVM_BLDC_Sensorless,which is Official routine.

Why is calculate the back EMF by the flowing routine?

INTERRUPT void ADC0done_ISR(void)

{// LEFT justified result ADC data

DCBusCurrent = ADC0ResultList[0] - DCBusCurrentOffset;

DCBusVoltageHalf = MLIB_Mul(ADC0ResultList[1]>>1, 13653 ,F16); // DC Bus Voltage * 5/6 / 2

phaseVoltage = ADC1ResultList[0]>>1;

bemfVoltage = phaseVoltage - DCBusVoltageHalf;

.....................................

...................................

}

According to information of AN4704.

we get a new equation from Eqn.7 ec=(2*uc-uDCB)/3

ADC0ResultList[1] is uDCB by ADC measurement. But this value is normal 1/5 by Internal shunt.

because LEFT justified result ADC data, now ADC0ResultList[1] is 16 times normal value.

ADC0ResultList[0] is uc (Phase voltage），this value is 16 times normal value by LEFT justified result ADC data.because Internal shunt, This value is divided by 6.

Finally, we get a equation ec=(4*uc-2*uDCB)/3 by Front program,

this EMF is two times theoretical value .

Please tell me where is wrong.

Hi,

all the voltages measured by ADC are left justified to fit the unsigned range of 16bit number. However, we need to fit the numbers within signed tFrac16 format (1.15), because of the backEMF will be threated as positive or negative. Therefore, both values are right-shifted by one to leave the sign-bit empty.

Now, we need to get the DC_bus/2 to identify the "zero point" of the backEMF. Therefore, we need to re-scale the DC bus voltage to the backEMF scale. The HW scale between the DC bus voltage and the phase voltage is 5/6. Therefore, the DC_bus voltage would be multiplied by 5/6 = 0.8333, which is 27306 in integer. In order to follow the new scale of the input signals (right-shifted, thus divided by two), the 5/6 is divided by two, which creates 13653 number (0.416667 in fraction format).

The scaling in tFrac16 format for all the variables is still (-1.0; 1.0), which refers to (-UDCmax; UDCmax) and (-UphaseMax; UphaseMax) respectively.

Is the explanation sufficient?

Best regards,

Matej