sd.shi 发表于 2024-1-8 16:06:41

F280025C,内置比较器触发TZ中断,能单独关闭EPWMA或EPWMB吗?

我这段代码,TZ一触发会把整个EPWM2关闭,我只想关闭EPWMB这一路的输出。
{
    // Enable CMPSS and configure the negative input signal to come from the DAC
    CMPSS_enableModule(CMPSS3_BASE);
    // Use VDDA as the reference for the DAC and set DAC value to midpoint for arbitrary reference.
    CMPSS_configDAC(CMPSS3_BASE, CMPSS_DACREF_VDDA);

    ASysCtl_selectCMPLPMux(ASYSCTL_CMPLPMUX_SELECT_3, 3);//LDr2

    // Configure the output signals. Both CTRIPH will be fed by the asynchronous comparator output.
    //LDr1
    CMPSS_configHighComparator(CMPSS3_BASE, CMPSS_INSRC_DAC);            // Threshold drive by GPIO or input DAC
    CMPSS_setDACValueHigh(CMPSS3_BASE, max_dac_cmpss);                     // Define threshold
    CMPSS_configOutputsHigh(CMPSS3_BASE, CMPSS_TRIP_SYNC_COMP);            // Set output comparator (synchronous or asynchronous)
    //LDr2
    CMPSS_configLowComparator(CMPSS3_BASE, CMPSS_INSRC_DAC);               // Threshold drive by GPIO or input DAC
    CMPSS_setDACValueLow(CMPSS3_BASE, max_dac_cmpss);                      // Define threshold
    CMPSS_configOutputsLow(CMPSS3_BASE, CMPSS_TRIP_SYNC_COMP);             // Set output comparator (synchronous or asynchronous)

    // Configure TRIP to be CTRIP1H using the ePWM X-BAR. Attach CMPSS output to TRIPINx via EPWMXBAR module

    XBAR_setEPWMMuxConfig(XBAR_TRIP8, XBAR_EPWM_MUX05_CMPSS3_CTRIPL);//LDr2
    XBAR_enableEPWMMux(XBAR_TRIP8, XBAR_MUX05);//LDr2

    EPWM_selectDigitalCompareTripInput(EPWM2_BASE, EPWM_DC_TRIP_TRIPIN8, EPWM_DC_TYPE_DCBH);
    EPWM_setTripZoneDigitalCompareEventCondition(EPWM2_BASE, EPWM_TZ_DC_OUTPUT_B1, EPWM_TZ_EVENT_DCXH_HIGH);
    EPWM_setTripZoneAction(EPWM2_BASE, EPWM_TZ_ACTION_EVENT_TZB, EPWM_TZ_ACTION_LOW);
    EPWM_enableTripZoneSignals(EPWM2_BASE, EPWM_TZ_SIGNAL_DCBEVT1);
    EPWM_forceTripZoneEvent(EPWM2_BASE,EPWM_TZ_FORCE_EVENT_DCBEVT1);
    EPWM_clearOneShotTripZoneFlag(EPWM2_BASE,EPWM_TZ_OST_FLAG_DCBEVT1);
    EPWM_clearTripZoneFlag(EPWM2_BASE, (EPWM_TZ_INTERRUPT | EPWM_TZ_FLAG_DCBEVT1));
}

86180A 发表于 2024-1-8 17:14:38

ti的dsp命名太魔幻了。

F2808
F28027 F28035 F28069
F280025

再过几年
F280000000033

summarize 发表于 2024-1-10 15:01:39

通过EPWM_setTripZoneAction
显式配置TZA事件发生时,无动作。

sd.shi 发表于 2024-1-11 09:11:52

summarize 发表于 2024-1-10 15:01
通过EPWM_setTripZoneAction
显式配置TZA事件发生时,无动作。
(引用自3楼)

EPWMA路我也用到了,A,B是独立发波,所以需求是A路短路关A路,B路短路关B路。我现在是A或B短路,2路都同时关闭了

sd.shi 发表于 2024-1-12 08:34:45


      EPWM_selectDigitalCompareTripInput(base, EPWM_DC_TRIP_TRIPIN4,EPWM_DC_TYPE_DCAH);
      EPWM_selectDigitalCompareTripInput(base, EPWM_DC_TRIP_TRIPIN8,EPWM_DC_TYPE_DCBH);
      EPWM_setTripZoneAction(base,EPWM_TZ_ACTION_EVENT_DCAEVT1,EPWM_TZ_ACTION_LOW);
      EPWM_setTripZoneAction(base,EPWM_TZ_ACTION_EVENT_DCBEVT1,EPWM_TZ_ACTION_LOW);

    //
    // DCAEVT1 is generated when DCAH is high. DCBEVT2 is generated when DCBH
    // is high
    //
    EPWM_setTripZoneDigitalCompareEventCondition(base, EPWM_TZ_DC_OUTPUT_A1,EPWM_TZ_EVENT_DCXH_HIGH);
    EPWM_setTripZoneDigitalCompareEventCondition(base, EPWM_TZ_DC_OUTPUT_B1,EPWM_TZ_EVENT_DCXH_HIGH);
    //
    // DCAEVT1/DCBEVT2 uses the unfiltered version of DCAEVT1/DCBEVT2
    //
    EPWM_setDigitalCompareEventSource(base, EPWM_DC_MODULE_A,
                            EPWM_DC_EVENT_1, EPWM_DC_EVENT_SOURCE_ORIG_SIGNAL);
    EPWM_setDigitalCompareEventSource(base, EPWM_DC_MODULE_B,
                            EPWM_DC_EVENT_1, EPWM_DC_EVENT_SOURCE_ORIG_SIGNAL);
    //
    // DCAEVT1/ DCBEVT2 is asynchronous
    //
    EPWM_setDigitalCompareEventSyncMode(base, EPWM_DC_MODULE_A,
                              EPWM_DC_EVENT_1, EPWM_DC_EVENT_INPUT_NOT_SYNCED);
    EPWM_setDigitalCompareEventSyncMode(base, EPWM_DC_MODULE_B,
                              EPWM_DC_EVENT_1, EPWM_DC_EVENT_INPUT_NOT_SYNCED);


这样就可以单独关闭EPWMA或EPWMB了
页: [1]
查看完整版本: F280025C,内置比较器触发TZ中断,能单独关闭EPWMA或EPWMB吗?