Part Number: TMS320F280049C
Hello,
Several times review hal.c HAL_setupPWMs() seems comp C counter compare sub module was mistakenly made ADC trigger source and later value load source.
EPWM generator D was configured booster sites 1/2, not generator C. How does time base (TB) maintain correct timing triggering ADC samples for an unconfigured generator?
Is it assumed the time base (TBCTR) remains synchronous to each generator load count time (TBPRD)? So CompA=GENA, CompB=GENB, CompC=GenC, CompD=GenD respectively relative to phase relationships of the generator/s counter/s? Might using CompC change the ADC sample window phase relationship to the actual voltage and current events? Might timing benefit trigger to EPWM_SOC_TBCTR_D_CMPD in both cases below, so InstaSpin mainISR ROM calls occur synchronous start of 50µs edges?
Oddly 20Khz modulation each 50µs period begins well before rising edge of GPIO monitor mainISR(). There is no written explanation why Comp C was chosen over D, makes one question why how come etc...
Code from SDK (hal.c)
// setup the Event Trigger Selection Register (ETSEL)
// COMP-C=Dn or SOC_TBCTR=0
EPWM_disableInterrupt(obj->pwmHandle[0]);
EPWM_setADCTriggerSource(obj->pwmHandle[0],
EPWM_SOC_A,EPWM_SOC_TBCTR_D_CMPC);
// write the PWM data value for ADC trigger
EPWM_setCounterCompareValue(obj->pwmHandle[0],
EPWM_COUNTER_COMPARE_C, 5);
