This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
I want to select DCBEVT1.sync as the input sync for the EPWM module, to update TBPHS value into TBCTR value.
But I couldn't find any register for configuring DCBEVT1.sync as the input sync for the EPWM module.
Please let me know solution for this ASAP.
Thanks,
Chandana
DCBECT1.sync is automatically connected to the OR gate which drives the TBPHS load trigger.
There is not need for a register to be configured.
Nima
Hi ,
Here I want to generate a DCBEVT1.sync from EPWM1 / EPWM4 whenever i get a zero crossing (Configured through CMPSS), and this DCBEVT1.sync event should trigger TBPHS value into TBPRD of EPWM1 / EPWM4.
But as you said DCBEVT1.sync is routed into TBPHS trigger in hardware itself. Considering this I have written code.
PS:
I have confirmed that DCBEVT1 event is generating properly, by triggering trip interrupt through DCBEVT1 signal.
I am finding problem in routing this DCBEVT1 event to Timer module.
Below is my code, Please see the attached code.
#include "PFC_valley.h" // initCMPSS - Function to configure the high comparator of CMPSS1 void initCMPSS(void) { // Enable CMPSS and configure the negative input signal to come from // the DAC CMPSS_enableModule(CMPSS1_BASE); CMPSS_configHighComparator(CMPSS1_BASE, CMPSS_INSRC_DAC); // Use VDDA as the reference for the DAC and set DAC value to midpoint for // arbitrary reference. CMPSS_configDAC(CMPSS1_BASE, CMPSS_DACREF_VDDA | CMPSS_DACVAL_SYSCLK | CMPSS_DACSRC_SHDW); CMPSS_setDACValueHigh(CMPSS1_BASE, 2048); //1.65V // Configure the output signals. CTRIPH will be fed by // the asynchronous comparator output. CMPSS_configOutputsHigh(CMPSS1_BASE, CMPSS_TRIP_ASYNC_COMP); } // initEPWM - Function to configure ePWM8 and the ePWM X-BAR to take CTRIPH as // the DC trip input void initEPWMDC(void) { // Configure TRIP4 to be CTRIP1H using the ePWM X-BAR XBAR_setEPWMMuxConfig(XBAR_TRIP4, XBAR_EPWM_MUX00_CMPSS1_CTRIPH); //check XBAR_enableEPWMMux(XBAR_TRIP4, XBAR_MUX00); EPWM_selectDigitalCompareTripInput(EPWM4_BASE,EPWM_DC_TRIP_TRIPIN4,EPWM_DC_TYPE_DCBH); // Configure the DCB path to be unfiltered and asynchronous EPWM_setDigitalCompareEventSource(EPWM4_BASE, EPWM_DC_MODULE_B, EPWM_DC_EVENT_1, EPWM_DC_EVENT_SOURCE_ORIG_SIGNAL); // Trigger event when DCBH is high EPWM_setTripZoneDigitalCompareEventCondition(EPWM4_BASE, EPWM_TZ_DC_OUTPUT_B1, EPWM_TZ_EVENT_DCXH_LOW); EPWM_setDigitalCompareEventSyncMode(EPWM4_BASE, EPWM_DC_MODULE_B, EPWM_DC_EVENT_1, EPWM_DC_EVENT_INPUT_NOT_SYNCED); EPWM_enableDigitalCompareSyncEvent(EPWM4_BASE,EPWM_DC_MODULE_B); } void initEPWM1() { // Set-up 200kHz EPWM_setTimeBasePeriod(EPWM4_BASE, 250U); EPWM_setPhaseShift(EPWM4_BASE, 0U); EPWM_setTimeBaseCounter(EPWM4_BASE, 0U); EPWM_setTimeBaseCounterMode(EPWM4_BASE, EPWM_COUNTER_MODE_UP_DOWN); EPWM_disablePhaseShiftLoad(EPWM4_BASE); //sync when DCevent occurs EPWM_enablePhaseShiftLoad(EPWM4_BASE); SysCtl_setSyncInputConfig(SYSCTL_SYNC_IN_EPWM4, SYSCTL_SYNC_IN_SRC_EPWM4SYNCOUT); EPWM_setPhaseShift(EPWM4_BASE,0U); EPWM_setCountModeAfterSync(EPWM4_BASE, EPWM_COUNT_MODE_UP_AFTER_SYNC); // Set the time base clock prescalers to /1 EPWM_setClockPrescaler(EPWM4_BASE, EPWM_CLOCK_DIVIDER_1, EPWM_HSCLOCK_DIVIDER_1); // Set up shadowing EPWM_setCounterCompareShadowLoadMode(EPWM4_BASE, EPWM_COUNTER_COMPARE_A, EPWM_COMP_LOAD_ON_CNTR_ZERO); // Set-up compare 25% duty cycle EPWM_setCounterCompareValue(EPWM4_BASE, EPWM_COUNTER_COMPARE_A, 125U); // Set actions EPWM_setActionQualifierAction(EPWM4_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA); EPWM_setActionQualifierAction(EPWM4_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA); EPWM_setActionQualifierAction(EPWM4_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO); } //initEPWMGPIO - Configure ePWM GPIO void initEPWMGPIO(void) { // Disable pull up on GPIO 0 and GPIO 2 and configure them as PWM1A and // PWM2A output respectively. GPIO_setPadConfig(0, GPIO_PIN_TYPE_STD); GPIO_setPinConfig(GPIO_0_EPWM1A); GPIO_setPadConfig(1, GPIO_PIN_TYPE_STD); GPIO_setPinConfig(GPIO_1_EPWM1B); GPIO_setPadConfig(2, GPIO_PIN_TYPE_STD); GPIO_setPinConfig(GPIO_2_EPWM2A); GPIO_setPadConfig(3, GPIO_PIN_TYPE_STD); GPIO_setPinConfig(GPIO_3_EPWM2B); GPIO_setPadConfig(6, GPIO_PIN_TYPE_STD); GPIO_setPinConfig(GPIO_6_EPWM4A); }
MAke sure you have this register set:
DCBCTL[EVT1SYNCE] other than that everything should be hardwired.
Nima
I see you have this: EPWM_enableDigitalCompareSyncEvent
That should be all that is needed. Now you have the DCBEVT1 SYNC event enabled and everything should pass to the PHSEN.
Hi,
Thank you for your reply!!
Yes, as you have mentioned. DCBEVT has been enabled through EPWM_enableDigitalCompareSyncEvent() API in the above code. But still i am unable to get the result as per expectation??!!.
My requirement is to load TBPHS( value =0) value into TBRD of EPWM1 or EPWM4 whenever DCBEVT occurs.