Part Number: TMS320F280025C
Other Parts Discussed in Thread: C2000WARE
Hi
I'm tripping the ePWM modul from an input XBAR (TZ1 or TZ2) and would like to connect a output XBAR GPIO pin, that gives out the tripping state (OR logic of the two inputs) without any CPU interaction.
For this, I decided to use GPIO24, but I'm stuck on what is necessary for the configuration to just give out the tripping state directly from the inputs. I found the example in C:\ti\c2000\C2000Ware_4_00_00_00\driverlib\f28002x\examples\cmpss and there, the comparator submodule is configured with ramp generator and everything. Is this really necessary for just OR the inputs?
Here is my code so far, but it does not work yet:
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Select the value for CMPHNMXSEL.
ASysCtl_selectCMPHNMux(ASYSCTL_CMPHNMUX_SELECT_1);
// Select the value for CMPLNMXSEL.
ASysCtl_selectCMPLNMux(ASYSCTL_CMPLNMUX_SELECT_1);
// Select the value for CMPHPM[object Object]SEL.
ASysCtl_selectCMPHPMux(ASYSCTL_CMPHPMUX_SELECT_1,0U);
// Select the value for CMPLPM[object Object]SEL.
ASysCtl_selectCMPLPMux(ASYSCTL_CMPLPMUX_SELECT_1,0U);
//myCMPSS0 initialization
// Sets the configuration for the high comparator.
CMPSS_configHighComparator(CMPSS1_BASE,(CMPSS_INSRC_DAC));
// Sets the configuration for the high comparator.
CMPSS_configLowComparator(CMPSS1_BASE,(CMPSS_INSRC_DAC));
// Sets the configuration for the internal comparator DACs.
CMPSS_configDAC(CMPSS1_BASE,(CMPSS_DACVAL_SYSCLK | CMPSS_DACREF_VDDA | CMPSS_DACSRC_SHDW));
// Sets the value of the internal DAC of the high comparator.
CMPSS_setDACValueHigh(CMPSS1_BASE,2048U);
// Sets the value of the internal DAC of the low comparator.
CMPSS_setDACValueLow(CMPSS1_BASE,0U);
// Configures the digital filter of the high comparator.
CMPSS_configFilterHigh(CMPSS1_BASE, 0U, 1U, 1U);
// Configures the digital filter of the low comparator.
CMPSS_configFilterLow(CMPSS1_BASE, 0U, 1U, 1U);
// Sets the output signal configuration for the high comparator.
CMPSS_configOutputsHigh(CMPSS1_BASE,(CMPSS_TRIPOUT_ASYNC_COMP | CMPSS_TRIP_ASYNC_COMP));
// Sets the output signal configuration for the low comparator.
CMPSS_configOutputsLow(CMPSS1_BASE,(CMPSS_TRIPOUT_ASYNC_COMP | CMPSS_TRIP_ASYNC_COMP));
// Sets the comparator hysteresis settings.
CMPSS_setHysteresis(CMPSS1_BASE,0U);
// Configures the comparator subsystem's ramp generator.
CMPSS_configRamp(CMPSS1_BASE,0U,0U,0U,1U,true);
// Disables reset of HIGH comparator digital filter output latch on PWMSYNC
CMPSS_disableLatchResetOnPWMSYNCHigh(CMPSS1_BASE);
// Disables reset of LOW comparator digital filter output latch on PWMSYNC
CMPSS_disableLatchResetOnPWMSYNCLow(CMPSS1_BASE);
// Sets the ePWM module blanking signal that holds trip in reset.
CMPSS_configBlanking(CMPSS1_BASE,1U);
// Disables an ePWM blanking signal from holding trip in reset.
CMPSS_disableBlanking(CMPSS1_BASE);
// Configures whether or not the digital filter latches are reset by PWMSYNC
CMPSS_configLatchOnPWMSYNC(CMPSS1_BASE,false,false);
// Enables the CMPSS module.
CMPSS_enableModule(CMPSS1_BASE);
// Delay for CMPSS DAC to power up.
DEVICE_DELAY_US(500);
uint16_t gp = 24;
GPIO_setPinConfig(GPIO_24_OUTPUTXBAR1);
GPIO_setDirectionMode(gp, GPIO_DIR_MODE_OUT);
GPIO_setPadConfig(gp, GPIO_PIN_TYPE_STD);
GPIO_setQualificationMode(gp, GPIO_QUAL_ASYNC);
XBAR_setOutputLatchMode(OUTPUTXBAR_BASE, XBAR_OUTPUT1, false);
XBAR_invertOutputSignal(OUTPUTXBAR_BASE, XBAR_OUTPUT1, false);
XBAR_setOutputMuxConfig(OUTPUTXBAR_BASE, XBAR_OUTPUT1, XBAR_OUT_MUX01_INPUTXBAR1);
XBAR_enableOutputMux(OUTPUTXBAR_BASE, XBAR_OUTPUT1, XBAR_MUX00);
XBAR_setEPWMMuxConfig(XBAR_TRIP4, XBAR_EPWM_MUX00_CMPSS1_CTRIPH);
XBAR_enableEPWMMux(XBAR_TRIP4, XBAR_MUX00);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

