Hi folks!
Is there a way with the S12G128 to sync or trigger an ADC sample & conversion from the start of the PWM period?
PWM Frequence is 20k
I use HalfBridge to control a brush DC by PWM and need measure the current ,the current sense is a square wave(20k) .
Is there a clever way to solve the problem ? it is too late for me to change the chip.
Thanks
Solved! Go to Solution.
Hi,
Yes, there is internal HW connection between PW0 and ETRIG0, PWM1 and ETRIG1, etc ... Please check chapter 2.6.4 ADC External Triggers ETRIG3-0 in reference manual (page 254,255). If PWM is enabled, ETRIG will be driven by PWM (internally or trough pin). Since PWM outputs in 16-Bit Mode are PWM1, PWM3, PWM5 and PWM7, only two internal links ETRIG1 and ERIG3) could be used of ADC triggering. I would like to recommend in your case external link from PWM outputs into some of remaining port AD inputs (ETRIGSEL=0, ETRIGCH[3:0] refers to appropriate PAD input). For more details please see Table 11-5. External Trigger Channel Select Coding (page 427). Best regards, Ladislav
Hi,
Yes, there is internal HW connection between PW0 and ETRIG0, PWM1 and ETRIG1, etc ... Please check chapter 2.6.4 ADC External Triggers ETRIG3-0 in reference manual (page 254,255). If PWM is enabled, ETRIG will be driven by PWM (internally or trough pin). Since PWM outputs in 16-Bit Mode are PWM1, PWM3, PWM5 and PWM7, only two internal links ETRIG1 and ERIG3) could be used of ADC triggering. I would like to recommend in your case external link from PWM outputs into some of remaining port AD inputs (ETRIGSEL=0, ETRIGCH[3:0] refers to appropriate PAD input). For more details please see Table 11-5. External Trigger Channel Select Coding (page 427). Best regards, Ladislav