Calculation of back EMF by ADC measurement in MC9S12ZVM_BLDC_Sensorless

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Calculation of back EMF by ADC measurement in MC9S12ZVM_BLDC_Sensorless

Jump to solution
904 Views
2282242919
Contributor II

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.pastedImage_1.png

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.

Tags (1)
0 Kudos
1 Solution
674 Views
pachamatej
NXP Employee
NXP Employee

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

View solution in original post

0 Kudos
3 Replies
675 Views
pachamatej
NXP Employee
NXP Employee

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

0 Kudos
674 Views
2282242919
Contributor II

Hi 

   I have a new problem about right justified.The following is the official routine.

  

INTERRUPT void ADC0done_ISR(void)
{

// RIGHT justified result ADC data
/*
DCBusCurrent = ADC0ResultList[0] - DCBusCurrentOffset;
DCBusVoltageHalf = MLIB_Mul(ADC0ResultList[1] << 1, 27307 ,F16); // DC Bus Voltage * 2 * 10/12
phaseVoltage = ADC1ResultList[0] << 2; // Phase Voltage * 4
*/

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

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

}

According to your previous explanation.If  ADC data is right justified, phaseVoltage should be equal to ADC1ResultList[0] << 3。

If phaseVoltage  is equal to ADC1ResultList[0] << 2, phaseVoltage's tpye is not tFrac16 format (1.15).Why?

Thank you.

0 Kudos
674 Views
pachamatej
NXP Employee
NXP Employee

Hi,

The question I have identified in your post is "why the phaseVoltage is not of the tFrac16 type?" Actually, it doesn't really matter as long it is 16 bit variable type. The data stored in memory is the same, just our interpretation is different. As long as you are doing bitwise or basic arithmetic operations, the result would be the same.

Regards,

Matej

0 Kudos