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.
Team,
Fig. 9.1 page 118 of SPRUHM8I shows how the GPIO can be mapped to some XBAR INPUT signal that go to the ePWM.
How is done the control of those signals (TZ1/TRIP1, ... TRIP6) to a given ePWM modules (ePWM0, ePWM1, ..etc)?
Fig 15-1 shows that TZ1 to TZ6 are mapped to all ePWM modules.
Section 15.91 says:
'Trip inputs TZ1 to TZ6 can be flexibly mapped to any ePWM module"
But how to enable one signal for one ePWM and not for the other ePWM?
For example: How to enable TZ1\ and TRIP6 for ePWM2?
Thanks in advance!
A.
The statements are correct, TZ1-6 come from the EPWM XBAR and INPUT XBAR and are accessibile on all ePWM modules. In each EPWM module, you can select whether to use them or not.
Hi Nima, Thanks!
This is in fact the point:
How to select in each PWM module which signal to use with this given ePWM module
-Where can we find details on this on the UG?
-Could you point to a C2000Ware example that is doing this setup?
Thanks,
A.
Here is an example:
// // Included Files // #include "driverlib.h" #include "device.h" // // Globals // uint32_t epwm1TZIntCount; // // Function Prototypes // void initEPWM1(void); void initTZGPIO(void); void initEPWMGPIO(void); __interrupt void epwm1TZISR(void); void main(void) { // // Initialize global variables // epwm1TZIntCount = 0U; // // Initialize device clock and peripherals // Device_init(); // // Disable pin locks and enable internal pull-ups. // Device_initGPIO(); // // Initialize PIE and clear PIE registers. Disables CPU interrupts. // Interrupt_initModule(); // // Initialize the PIE vector table with pointers to the shell Interrupt // Service Routines (ISR). // Interrupt_initVectorTable(); // // Interrupts that are used in this example are re-mapped to ISR functions // found within this file. // Interrupt_register(INT_EPWM1_TZ, &epwm1TZISR); // // Configure ePWM1, and TZ GPIOs // initEPWMGPIO(); initTZGPIO(); // // Disable sync(Freeze clock to PWM as well) // SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_GTBCLKSYNC); SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC); // // Initialize ePWM1 // initEPWM1(); // // Enable sync and clock to PWM // SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC); // // Enable interrupts required for this example // Interrupt_enable(INT_EPWM1_TZ); // // Enable Global Interrupt (INTM) and real time interrupt (DBGM) // EINT; ERTM; // // IDLE loop. Just sit and loop forever (optional): // for(;;) { NOP; } } // // epwm1TZISR - ePWM1 TZ ISR // __interrupt void epwm1TZISR(void) { epwm1TZIntCount++; // // Clear the CBC flags using TRIPIN1 as DCAEVT2 // EPWM_clearCycleByCycleTripZoneFlag(EPWM1_BASE, EPWM_TZ_CBC_FLAG_1 | EPWM_TZ_CBC_FLAG_DCAEVT2); // // re-enable the interrupts and the ePWM output if using CBC // EPWM_clearTripZoneFlag(EPWM1_BASE, EPWM_TZ_INTERRUPT | EPWM_TZ_FLAG_DCAEVT2 | EPWM_TZ_FLAG_CBC); // // Acknowledge this interrupt to receive more interrupts from group 2 // Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP2); } // // initEPWM1 - Configure ePWM1 // void initEPWM1() { // // DCAEVT2 as CBC trip sources // You can only use TZ1 to TZ6, DCAEVT2 or DCBEVT2 for CBC // You cannot use DCAEVT1 or DCBEVT1 for CBC // DCAEVT1 and DCBEVT1 can only be used with OST mode // EPWM_enableTripZoneSignals(EPWM1_BASE, EPWM_TZ_SIGNAL_DCAEVT2); // // Next, setup DCAEVT2 used as CBC source // // // Select TRIPIN1 (INPUT XBAR INPUT1) as the source for DCAH // The INPUT XBAR INPUT 1 is set up as GPIO25 // EPWM_selectDigitalCompareTripInput( EPWM1_BASE, EPWM_DC_TRIP_TRIPIN1, EPWM_DC_TYPE_DCAH); // // DCAEVT2 is generated when DCAH is low // You can use DCAH/DCAL for DCAEVT1 and DCAEVT2 // You can use DCBH/DCBL for DCBEVT1 and DCBEVT2 // In this example, only DCAH is used for DCAEVT2 // EPWM_setTripZoneDigitalCompareEventCondition( EPWM1_BASE, EPWM_TZ_DC_OUTPUT_A2, EPWM_TZ_EVENT_DCXH_LOW); // // DCAEVT2 uses the unfiltered version of DCAEVT2 // EPWM_setDigitalCompareEventSource( EPWM1_BASE, EPWM_DC_MODULE_A, EPWM_DC_EVENT_2, EPWM_DC_EVENT_SOURCE_ORIG_SIGNAL); // // DCAEVT2 is asynchronous // EPWM_setDigitalCompareEventSyncMode( EPWM1_BASE, EPWM_DC_MODULE_A, EPWM_DC_EVENT_2, EPWM_DC_EVENT_INPUT_NOT_SYNCED); // // Action on TZA, which is connected to CBC (which has DCAEVT2 as source) // Force the EPWMA LOW since TZA corresponds to EPWMA // EPWM_setTripZoneAction(EPWM1_BASE, EPWM_TZ_ACTION_EVENT_TZA, EPWM_TZ_ACTION_LOW); // // CBC latch is reset and EPWMA is re-enabled, when CNTR=ZERO and the TRIPIN/DCAEVT2 // is no longer present // EPWM_selectCycleByCycleTripZoneClearEvent(EPWM1_BASE, EPWM_TZ_CBC_PULSE_CLR_CNTR_ZERO); // // Enable TZ interrupt // EPWM_enableTripZoneInterrupt(EPWM1_BASE, EPWM_TZ_INTERRUPT_CBC); // // Set-up TBCLK // EPWM_setTimeBasePeriod(EPWM1_BASE, 12000U); EPWM_setPhaseShift(EPWM1_BASE, 0U); EPWM_setTimeBaseCounter(EPWM1_BASE, 0U); EPWM_setTimeBaseCounterMode(EPWM1_BASE, EPWM_COUNTER_MODE_UP_DOWN); EPWM_disablePhaseShiftLoad(EPWM1_BASE); // // Set ePWM clock pre-scaler // EPWM_setClockPrescaler(EPWM1_BASE, EPWM_CLOCK_DIVIDER_4, EPWM_HSCLOCK_DIVIDER_4); // // Set up shadowing // EPWM_setCounterCompareShadowLoadMode(EPWM1_BASE, EPWM_COUNTER_COMPARE_A, EPWM_COMP_LOAD_ON_CNTR_ZERO); // // Set-up compare // EPWM_setCounterCompareValue(EPWM1_BASE, EPWM_COUNTER_COMPARE_A, 6000U); // // Set actions // EPWM_setActionQualifierAction(EPWM1_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA); EPWM_setActionQualifierAction(EPWM1_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA); } // // initTZGPIO - Configure TZ GPIO // void initTZGPIO(void) { // // Set GPIO 25 as as Asynchronous input with pull up enabled // GPIO_setPadConfig(25, GPIO_PIN_TYPE_PULLUP); GPIO_setPinConfig(GPIO_25_GPIO25); GPIO_setDirectionMode(25, GPIO_DIR_MODE_IN); GPIO_setQualificationMode(25, GPIO_QUAL_ASYNC); // // Set GPIO 25 as TZ1/TRIPIN1 input, connect this // pin to GND when a TRIP is required // XBAR_setInputPin(XBAR_INPUT1, 25); } // // initEPWMGPIO - Configure ePWM GPIO // void initEPWMGPIO(void) { // // Disable pull up on GPIO 0 configure them as PWM1A // GPIO_setPadConfig(0, GPIO_PIN_TYPE_STD); GPIO_setPinConfig(GPIO_0_EPWM1A); }
Its also available under Trip Zone subsection of the EPWM chapter in the TRM.
Nima
Hi Nima,
Thanks!
Is the below use case possible?
Each 12 ePWM modules are:
-used as an independent module`
-will use 3 pins (2 OUT and 1 INPUT)
For this 1 pin INPUT:
-How to select the pins in order to use it as fault detection for each module separately (ie 1 separate fault detection per ePWM module)?
-Is it possible to have a total of 12 pins (ie 12 INPUTS for external signals) and use 1 dedicated signal for each ePWM module for this fault detection scheme?
The goal is to stop only the ePWM module for which the fault condition occurred.
Any relevant C2000Ware example you can point us to and that are relevant for this use case?
Thanks!
Yes that looks possible.
You can use TRIPIN1-12. "Digital-Compare Submodule High-Level Block Diagram" is the diagram you want to look at.
You need to use the DC module.
For TRIPIN1,2,3,6 you have to only configure INPUT XBAR. For all other TRIPIN events, you have to use both INPUT XBAR + EPWM XBAR.
Nima
Hi Nima,
Thanks!
Looking into it in more details:
If we take a concrete example like
12 GPIOs: GPIO96 to GPIO107 (12 GPIOs) to be used as:
• GPIO96 -> INPUT1 INPUT X-BAR -> TRIP1
• GPIO97 -> INPUT2 INPUT X-BAR -> TRIP2
• GPIO98 -> INPUT3 INPUT X-BAR -> TRIP3
• GPIO99 -> INPUT4 INPUT X-BAR -> ePWM X-BAR -> TRIP4
• GPIO100 -> INPUT5 INPUT X-BAR -> ePWM X-BAR ->TRIP5
• GPIO101 -> INPUT6 INPUT X-BAR -> TRIP6
But how to proceed for the next GPIOs ?
-Since all the inputs of the INPUT X-BAR crossbar are already how to use more GPIO?
-How to access the ePWM X-BAR to configure TRIP7…TRIP12?
-Is it possible to configure 1 input of the INPUT X-BAR to more than one TRIP?
For example GPIO96 > INPUT1 INPUT X-BAR > TRIP1; GPIO102 > INPUT1 INPUT X-BAR > ePWM X-BAR > TRIP7 and so on
Thanks in advance!
A.
For example GPIO96 > INPUT1 INPUT X-BAR > TRIP1; GPIO102 > INPUT1 INPUT X-BAR > ePWM X-BAR > TRIP7 and so on
No thats not possible. INPUTx to GPIOy mapping is a one to one mapping. TRIPx to INPUTy (epwm xbar to input xbar) is not a one to one mapping.
But this is what you would actually do:
GPIO96 -> INPUT1 INPUT X-BAR -> TRIP1
GPIO97 -> INPUT2 INPUT X-BAR -> TRIP2
GPIO98 -> INPUT3 INPUT X-BAR -> TRIP3
GPIO99 -> INPUT4 INPUT X-BAR -> ePWM X-BAR -> TRIP4
GPIO100 -> INPUT5 INPUT X-BAR -> ePWM X-BAR ->TRIP5
GPIO101 -> INPUT6 INPUT X-BAR -> TRIP6
GPIOx -> INPUT XBAR 7 -> eCAP1 -> CLB1_OUT4 -> TRIP7
GPIOx_with_EQEP1A -> CLB1_OUT5 -> TRIP8
GPIOx -> INPUT XBAR 8 -> eCAP2 -> CLB2_OUT4 -> TRIP9
GPIOx_with_EQEP2A -> CLB2_OUT5 -> TRIP10
GPIOx -> INPUT XBAR 9 -> eCAP3 -> CLB3_OUT4 -> TRIP11
GPIOx -> INPUT XBAR 10 -> eCAP4 -> CLB4_OUT4 -> TRIP12
Sorry, I made a bad assumption that the routing for the rest would be very simple as well, but it actually needed the CLB. For F28004x, F2838x it is just INPUT XBAR since there are INPUT1-14 that go to the EPWM XBAR.