Part Number: TMS320F280025C
Other Parts Discussed in Thread: SYSCONFIG
I am using the "SYSConfig" to generate the setup code for the Pinmux etc.
I'm trying to get PWM1 to trigger and SOC event on the DAC. The interrupt handler of the ADC is setup correctly because I can to the the registers and force an SOC. The breakpoint I set in the interrupt shows that the interrupt got executed. However, the SOC doe4s NOT get fired by the PWM.
Here are code snippets from the setup routines...
ADC:
void ADC_init(){
//myADC0 initialization
// ADC Initialization: Write ADC configurations and power up the ADC
// Configures the ADC module's offset trim
ADC_setOffsetTrimAll(ADC_REFERENCE_INTERNAL,ADC_REFERENCE_2_5V);
// Configures the analog-to-digital converter module prescaler.
ADC_setPrescaler(myADC0_BASE, ADC_CLK_DIV_1_0);
// Sets the timing of the end-of-conversion pulse
ADC_setInterruptPulseMode(myADC0_BASE, ADC_PULSE_END_OF_CONV);
// Powers up the analog-to-digital converter core.
ADC_enableConverter(myADC0_BASE);
// Delay for 1ms to allow ADC time to power up
DEVICE_DELAY_US(5000);
// SOC Configuration: Setup ADC EPWM channel and trigger settings
// Disables SOC burst mode.
ADC_disableBurstMode(myADC0_BASE);
// Sets the priority mode of the SOCs.
ADC_setSOCPriority(myADC0_BASE, ADC_PRI_ALL_ROUND_ROBIN);
// Start of Conversion 0 Configuration
// Configures a start-of-conversion (SOC) in the ADC and its interrupt SOC trigger.
// SOC number : 0
// Trigger : ADC_TRIGGER_EPWM1_SOCB
// Channel : ADC_CH_ADCIN10
// Sample Window : 50 SYSCLK cycles
// Interrupt Trigger: ADC_INT_SOC_TRIGGER_NONE
ADC_setupSOC(myADC0_BASE, ADC_SOC_NUMBER0, ADC_TRIGGER_EPWM1_SOCB, ADC_CH_ADCIN10, 50U);
ADC_setInterruptSOCTrigger(myADC0_BASE, ADC_SOC_NUMBER0, ADC_INT_SOC_TRIGGER_NONE);
// Start of Conversion 1 Configuration
// Configures a start-of-conversion (SOC) in the ADC and its interrupt SOC trigger.
// SOC number : 1
// Trigger : ADC_TRIGGER_EPWM1_SOCB
// Channel : ADC_CH_ADCIN15
// Sample Window : 50 SYSCLK cycles
// Interrupt Trigger: ADC_INT_SOC_TRIGGER_NONE
ADC_setupSOC(myADC0_BASE, ADC_SOC_NUMBER1, ADC_TRIGGER_EPWM1_SOCB, ADC_CH_ADCIN15, 50U);
ADC_setInterruptSOCTrigger(myADC0_BASE, ADC_SOC_NUMBER1, ADC_INT_SOC_TRIGGER_NONE);
}
PWM:
void EPWM_init(){
EPWM_setClockPrescaler(EPWM1_RefA_BASE, EPWM_CLOCK_DIVIDER_1, EPWM_HSCLOCK_DIVIDER_1);
EPWM_setTimeBasePeriod(EPWM1_RefA_BASE, 2500);
EPWM_setTimeBaseCounter(EPWM1_RefA_BASE, 0);
EPWM_setTimeBaseCounterMode(EPWM1_RefA_BASE, EPWM_COUNTER_MODE_UP);
EPWM_disablePhaseShiftLoad(EPWM1_RefA_BASE);
EPWM_setPhaseShift(EPWM1_RefA_BASE, 0);
EPWM_setCounterCompareValue(EPWM1_RefA_BASE, EPWM_COUNTER_COMPARE_A, 1250);
EPWM_setCounterCompareShadowLoadMode(EPWM1_RefA_BASE, EPWM_COUNTER_COMPARE_A, EPWM_COMP_LOAD_ON_CNTR_ZERO);
EPWM_setCounterCompareValue(EPWM1_RefA_BASE, EPWM_COUNTER_COMPARE_B, 1250);
EPWM_setCounterCompareShadowLoadMode(EPWM1_RefA_BASE, EPWM_COUNTER_COMPARE_B, EPWM_COMP_LOAD_ON_CNTR_ZERO);
EPWM_setActionQualifierAction(EPWM1_RefA_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
EPWM_setActionQualifierAction(EPWM1_RefA_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_PERIOD);
EPWM_setActionQualifierAction(EPWM1_RefA_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
EPWM_setActionQualifierAction(EPWM1_RefA_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA);
EPWM_setActionQualifierAction(EPWM1_RefA_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPB);
EPWM_setActionQualifierAction(EPWM1_RefA_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPB);
EPWM_setActionQualifierAction(EPWM1_RefA_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
EPWM_setActionQualifierAction(EPWM1_RefA_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_PERIOD);
EPWM_setActionQualifierAction(EPWM1_RefA_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
EPWM_setActionQualifierAction(EPWM1_RefA_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA);
EPWM_setActionQualifierAction(EPWM1_RefA_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPB);
EPWM_setActionQualifierAction(EPWM1_RefA_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPB);
EPWM_enableADCTrigger(EPWM1_RefA_BASE, EPWM_SOC_A);
EPWM_setADCTriggerSource(EPWM1_RefA_BASE, EPWM_SOC_A, EPWM_SOC_TBCTR_U_CMPB);
interrupt:
void INTERRUPT_init(){
// Interrupt Setings for INT_myADC0_1
Interrupt_register(INT_myADC0_1, &INT_myADC0_1_ISR);
Interrupt_enable(INT_myADC0_1);
}
This is befuddling...:<(