How can i use PTU to measure DCbus current

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

How can i use PTU to measure DCbus current

602 Views
张_强
Contributor I

Hi, i'm using 9s12ZVML31, and the project uses the example project S12ZVML-MINIBRD_BLDC_Sensorless_CW_IDE. But now i found that hign side in the first period of commutation event can't be charged and opened because the PWM signals in the example project is congifured to start with high side before turning on the low side. So i read the reference manual as belows:

图片1.png

   I configure PMFCINV = 0x3F as the reference manial said,  the DCbus current and phase voltage should be re_configured, so how can i re_configure the PTU to measure the DCbus current and phase voltage.

The example project: 

//UpdateDutycycle()

 PMFVAL0 = duty_cycle;

 delay1 = duty_cycle >> 2;            // middle of the pulse - DC Bus current
 if (delay1 < MIN_ADC_TRIGGER_FIRST) delay1 = MIN_ADC_TRIGGER_FIRST;
 PTUTriggerEventList[0][0][0] = delay1;

 delay2 = MLIB_Mul(duty_cycle,BEMF_SENSING_POINT_FRAC,F16);   // end of the pulse
 PTUTriggerEventList[1][0][0] = delay2;        // ADC1 - phase voltage

 if (delay2 < (delay1 + MIN_ADC_TRIGGER_SECOND)) delay2 = delay1 + MIN_ADC_TRIGGER_SECOND;
 PTUTriggerEventList[0][0][1] = delay2;        // ADC0 second sample - DC Bus Voltage

PTUC_PTULDOK = 1;

MY project:

//initPMF()

PMFCINV = 0x3F ;

//UpdateDutycycle()

 PMFVAL0  = PWM_MODULO - duty_cycle;


 delay1 = (PWM_MODULO - (duty_cycle >> 1)) >> 1;
 if (delay1 > ((PWM_MODULO - MIN_ADC_TRIGGER_FIRST) >> 1))
  delay1 = (PWM_MODULO - MIN_ADC_TRIGGER_FIRST) >> 1;
 PTUTriggerEventList[0][0][0] = delay1;
 // end of the pulse
 delay2 =  ((PWM_MODULO - duty_cycle ) >> 1) + MLIB_Mul(duty_cycle,BEMF_SENSING_POINT_FRAC,F16);   
 PTUTriggerEventList[1][0][0] = delay2;        // ADC1 - phase voltage

 if (delay2 < (delay1 + MIN_ADC_TRIGGER_SECOND)) delay2 = delay1 + MIN_ADC_TRIGGER_SECOND;
 PTUTriggerEventList[0][0][1] = delay2;        // ADC0 second sample - DC Bus Voltage
 
 PTUC_PTULDOK = 1;

When i am using my project, the ADC0done_ISR cant't be reached ,so what's the problem?

0 Kudos
Reply
0 Replies