i am using a S12ZVML128 to drive a DC motor (in fact 2 DC Motors) (not a DC brushless motor). To detect short circuit and other failtures i am trying to monitor the phase status of the HSX. Therforce the selected phase voltage in the GDU Phase Multiplexer is routed to internal ADC channel. Unfortunally I always read the current HD Voltage dividet by 12 instead of the selected phase voltage.
In the datasheet is written:
"The value written to the GDUPHMUX register does not take effect until the LDOK bit is set and the next PWM reload cycle begins. Reading GDUPHMUX register reads the value in the buffer. It is not necessary the value which is currently used."
I am just using the PWM-Generator A and no PTU/Global Load OK.
To set the LDOKA bit of the PWM Generator A i use this peace of code whitch gets called periodically.
if(PMFENCA_LDOKA == 0)
PMFENCA_LDOKA = 1;
/* Set PWM Enable to reload new PWM Values */
PMFENCA_PWMENA = 1;
How can i read the current voltage on the HS0/HS1/HS2?