Part Number: LAUNCHXL-F28377S
Hello everyone,
I'm trying to measure time differences for some input signals. Therefore I want to use the eCap Peripherals from the F28377S. After reading through several threads in the forum I cannot find the problem with my application.
I configure all ecaps as followed:
void eCaps_init(void)
{
gpioInit();
EALLOW;
SysCtl_setSyncInputConfig(SYSCTL_SYNC_IN_ECAP1, SYSCTL_SYNC_IN_SRC_EPWM10SYNCOUT);
SysCtl_setSyncInputConfig(SYSCTL_SYNC_IN_ECAP4, SYSCTL_SYNC_IN_SRC_ECAP1SYNCOUT);
for(unsigned i = 0; i < DIM(ecap_bases); ++i)
{
singleEcapInit(ecap_bases[i]);
}
irqInit();
EDIS;
}
static void singleEcapInit(uint32_t base)
{
ECAP_disableInterrupt(base, ALL_ECAP_EVENTS);
ECAP_clearInterrupt(base, ALL_ECAP_EVENTS);
ECAP_stopCounter(base);
ECAP_disableTimeStampCapture(base);
ECAP_setPhaseShiftCount(base, 0u);
ECAP_enableLoadCounter(base);
ECAP_setSyncOutMode(base, ECAP_SYNC_OUT_SYNCI);
ECAP_setCaptureMode(base, ECAP_CONTINUOUS_CAPTURE_MODE, ECAP_EVENT_4);
ECAP_setEventPolarity(base, ECAP_EVENT_1, ECAP_EVNT_FALLING_EDGE);
ECAP_setEventPolarity(base, ECAP_EVENT_2, ECAP_EVNT_RISING_EDGE);
ECAP_setEventPolarity(base, ECAP_EVENT_3, ECAP_EVNT_FALLING_EDGE);
ECAP_setEventPolarity(base, ECAP_EVENT_4, ECAP_EVNT_RISING_EDGE);
ECAP_disableCounterResetOnEvent(base, ECAP_EVENT_1);
ECAP_disableCounterResetOnEvent(base, ECAP_EVENT_2);
ECAP_disableCounterResetOnEvent(base, ECAP_EVENT_3);
ECAP_disableCounterResetOnEvent(base, ECAP_EVENT_4);
ECAP_enableCaptureMode(base);
ECAP_enableTimeStampCapture(base);
ECAP_enableInterrupt(base, USED_ECAP_IRQS);
ECAP_startCounter(base);
}
The counters are running as expected but when I want to synchronize the eCaps by setting ECap1Regs.ECCTL2.SWSYNC only eCap 1 resets.
If I do the same with ECap2Regs.ECCTL2.SWSYNC only eCap2 resets (and not eCap3) -> As I can reset eCap2, I suppose SYNCI_EN is OK and the failure is that the signal from eCap1 doesn't popule as configured within SYNCO_SEL?
From the Technical_Reference_Manual for SWSYNC: Writing a one forces a TSCTR shadow load of current module and any modules down-stream providing the SYNCO_SEL bits are 0, 0.
I have following Configuration for all eCaps (as seen in Registers view within CCS):
CTRPHS 0x00000000 Counter Phase Offset Value Register [Memory Mapped]
ECCTL1 0x0111 Capture Control Register 1 [Memory Mapped]
ECCTL2 0x0036 Capture Control Register 2 [Memory Mapped]
ECEINT 0x003E Capture Interrupt Enable Register [Memory Mapped]
For synchronization I suppose following bits are the most interresting ones (also taken from debug view):
SYNCO_SEL 00 Sync-out mode
SYNCI_EN 1 Counter sync-in select
I get the interrupts as I want them to with anything else. Only synchronization fails.
Is there anything else I have to look out in order to use SYNC_OUT as I intend to?