再问几个个问题~
Q1.请问DCAH/L 与DCAEVT1/2 是一一对应的关系吗?还是需要在库函数里配置?具体是哪个库函数呢?
Q2. 请问CMPSS的CMPSS1_CTRIPH 可以通过配置X-BAR 同时产生TRIP4 及 TRIP5吗?
我想用TRIP4以及TRIP5 用于PCMC,分别控制TZAD,TZBU,实现对滞后桥臂的控制。
如果这样不行,请问可以用一个TRIP4控制TZAD,TZBU吗?
谢谢!
Regards sincerely.
Yach
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.
1 您可以看一下用户指南内的说明Table 18-66. TZDCSEL Register Field Descriptions
如下
2 您可以尝试第2种解决方案,参考API
XBAR_setEPWMMuxConfig(XBAR_TripNum trip, XBAR_EPWMMuxConfig muxConfig)
以及Table 9-2. ePWM X-BAR Mux Configuration Table
https://www.ti.com.cn/cn/lit/ug/sprui33c/sprui33c.pdf?ts=1591318506386
Hi,Susan
感谢您的耐心回复,这些内容我在手册里都看到了,
1.这是在寄存器里配置的,我也找到这个寄存器了。但是我想找到对应的API,API的说明太模糊了,所以才来发帖的。。。
2.第二点我已经了解了怎么配置,我的问题不是配置的问题,是CMPSS1_CTRIPH能不能同时触发CTRIP4及CTRIP5(TRIP4用于拉低EPWM2A when TZAU;TRIP用于拉低EPWM2B when TZBD )
或者用一个TRIP4分别控制DCAEVT2,DCBEVT2,然后实现上述括号里的功能(我们知道,TRIP4还是为了触发DCA/BEVTx)
基于我的上面的设想,给出了下列code,
我的目的:PSFB_PCMC,EPWM1配置为固定50%带死区的2路互补输出,向上向下计数;EPWM2也同样配置,同步信号来自EPWM1;
下面是我配置PCMC的code,主要是想在Ipri=IREF时,关断EPWM2A或EPWM2B,
(PS:毕竟现在也没有官方例程,国外的工程师本来说是Q2,,2020发布的,结果现在又说至少是Q3,2020。这个问题一直没解决啊,希望能和我一起推进这个问题解决!)
Best Regards!
/* EPWM X-BAR Configuration */ XBAR_setEPWMMuxConfig(XBAR_TRIP4,XBAR_EPWM_MUX00_CMPSS1_CTRIPH);//CMPSS1_CTRIPH->EPWM X-BAR->TRIP4->DCAL->DCAEVT2:used to PCMC(使用CMPSS1H) XBAR_setEPWMMuxConfig(XBAR_TRIP5,XBAR_EPWM_MUX00_CMPSS1_CTRIPH);//CMPSS1_CTRIPH->EPWM X-BAR->TRIP5->DCBL->DCBEVT2:used to PCMC XBAR_setEPWMMuxConfig(XBAR_TRIP7,XBAR_EPWM_MUX01_CMPSS1_CTRIPL);//CMPSS1_CTRIPL->EPWM X-BAR->TRIP7->DCAH->DCAEVT1:used to OCP(使用CMPSS1L) XBAR_enableEPWMMux(XBAR_TRIP4,0); XBAR_enableEPWMMux(XBAR_TRIP5,0); XBAR_enableEPWMMux(XBAR_TRIP7,1); XBAR_invertEPWMSignal(XBAR_TRIP4,false);//not invert XBAR_invertEPWMSignal(XBAR_TRIP5,false);//not invert XBAR_invertEPWMSignal(XBAR_TRIP7,false);//not invert ———————————————————————————————————————————————————————————————————————————————— /* EPWM_DC Module Configuration */ EPWM_selectDigitalCompareTripInput(EPWM2_BASE,EPWM_DC_TRIP_TRIPIN4,EPWM_DC_TYPE_DCAL);//DCAL<--TRIP4-> USED FOR PCMC EPWM_selectDigitalCompareTripInput(EPWM2_BASE,EPWM_DC_TRIP_TRIPIN5,EPWM_DC_TYPE_DCBL);//DCBL<--TRIP5-> USED FOR PCMC EPWM_selectDigitalCompareTripInput(EPWM2_BASE,EPWM_DC_TRIP_TRIPIN7,EPWM_DC_TYPE_DCAH);//DCAH<--TRIP7-> USED FOR OCP EPWM_setDigitalCompareEventSource(EPWM2_BASE,EPWM_DC_MODULE_A,EPWM_DC_EVENT_2,EPWM_DC_EVENT_SOURCE_FILT_SIGNAL); EPWM_setDigitalCompareEventSource(EPWM2_BASE,EPWM_DC_MODULE_B,EPWM_DC_EVENT_2,EPWM_DC_EVENT_SOURCE_FILT_SIGNAL); EPWM_setDigitalCompareEventSource(EPWM2_BASE,EPWM_DC_MODULE_A,EPWM_DC_EVENT_1,EPWM_DC_EVENT_SOURCE_FILT_SIGNAL); ———————————————————————————————————————————————————————————————————————————————— /* EPWM_TZ Module Configuration */ (已经配置epwm2为up-dowm模式,并且向上计数时,epwmA(B)输出高(低),向下计数时,epwmA(B)输出低(高),相当于互补,并加了死区) EPWM_enableTripZoneAdvAction(EPWM2_BASE); EPWM_enableTripZoneSignals(EPWM2_BASE,EPWM_TZ_SIGNAL_DCAEVT2|EPWM_TZ_SIGNAL_DCBEVT2|EPWM_TZ_SIGNAL_DCAEVT1); //Trip zone input signals=DCAEVT2(CBC),DCBEVT2(CBC),DCAEVT1(OSHT) EPWM_setTripZoneDigitalCompareEventCondition(EPWM2_BASE,EPWM_TZ_DC_OUTPUT_A2,EPWM_TZ_EVENT_DCXL_HIGH); //i think this configuration means DCA/BL got High then trigger DCAEVT2; EPWM_setTripZoneDigitalCompareEventCondition(EPWM2_BASE,EPWM_TZ_DC_OUTPUT_B2,EPWM_TZ_EVENT_DCXL_HIGH); EPWM_setTripZoneDigitalCompareEventCondition(EPWM2_BASE,EPWM_TZ_DC_OUTPUT_A1,EPWM_TZ_EVENT_DCXH_HIGH); EPWM_setTripZoneAdvDigitalCompareActionA(EPWM2_BASE,EPWM_TZ_ADV_ACTION_EVENT_DCxEVT2_D,EPWM_TZ_ADV_ACTION_LOW); //我的理解是:当DCAEVT2触发,且epwm2向上计数时,迫使epwm2A输出low,经过死区之后,epwm2B输出高; EPWM_setTripZoneAdvDigitalCompareActionB(EPWM2_BASE,EPWM_TZ_ADV_ACTION_EVENT_DCxEVT2_D,EPWM_TZ_ADV_ACTION_LOW); //当DCBEVT2触发,且epwm2向下计数,迫使epwm2B输出low,经过死区之后,epwm2A输出高; EPWM_setTripZoneAdvDigitalCompareActionA(EPWM2_BASE,EPWM_TZ_ADV_ACTION_EVENT_DCxEVT1_D,EPWM_TZ_ADV_ACTION_DISABLE);// 用于OCP,直接关断EPWM2P输出 EPWM_setTripZoneAdvDigitalCompareActionA(EPWM2_BASE,EPWM_TZ_ADV_ACTION_EVENT_DCxEVT1_U,EPWM_TZ_ADV_ACTION_DISABLE);
您可以看一下下面的API
//*****************************************************************************
//
//! Set Digital compare conditions that cause Trip Zone event.
//!
//! \param base is the base address of the EPWM module.
//! \param dcType is the Digital compare output type.
//! \param dcEvent is the Digital Compare output event.
//!
//! This function sets up the Digital Compare output Trip Zone event sources.
//! The dcType variable specifies the event source to be whether Digital
//! Compare output A or Digital Compare output B. The dcEvent parameter
//! specifies the event that causes Trip Zone.
//! Valid values for the parameters are:
//! - dcType
//! - EPWM_TZ_DC_OUTPUT_A1 - Digital Compare output 1 A
//! - EPWM_TZ_DC_OUTPUT_A2 - Digital Compare output 2 A
//! - EPWM_TZ_DC_OUTPUT_B1 - Digital Compare output 1 B
//! - EPWM_TZ_DC_OUTPUT_B2 - Digital Compare output 2 B
//! - dcEvent
//! - EPWM_TZ_EVENT_DC_DISABLED - Event Trigger is disabled
//! - EPWM_TZ_EVENT_DCXH_LOW - Trigger event when DCxH low
//! - EPWM_TZ_EVENT_DCXH_HIGH - Trigger event when DCxH high
//! - EPWM_TZ_EVENT_DCXL_LOW - Trigger event when DCxL low
//! - EPWM_TZ_EVENT_DCXL_HIGH - Trigger event when DCxL high
//! - EPWM_TZ_EVENT_DCXL_HIGH_DCXH_LOW - Trigger event when DCxL high
//! DCxH low
//!
//! \note x in DCxH/DCxL represents DCAH/DCAL or DCBH/DCBL
//!
//! \return None.
//
//*****************************************************************************
static inline void
EPWM_setTripZoneDigitalCompareEventCondition(uint32_t base,
EPWM_TripZoneDigitalCompareOutput dcType,
EPWM_TripZoneDigitalCompareOutputEvent dcEvent)
{
//
// Check the arguments
//
ASSERT(EPWM_isBaseValid(base));
//
// Set Digital Compare Events conditions that cause a Digital Compare trip
//
EALLOW;
HWREGH(base + EPWM_O_TZDCSEL) =
((HWREGH(base + EPWM_O_TZDCSEL) & ~(0x7U << (uint16_t)dcType)) |
((uint16_t)dcEvent << (uint16_t)dcType));
EDIS;
}