Part Number: TMS320F28379D
Hello TI support,
I have setup an eCAP module in single-shot mode to capture three events:
EVT1: rising, reset counter
EVT2: falling, do not reset counter
EVT3: rising, reset counter
The pulse train that is connected to the eCAP input has a frequency of 100 kHz (generated by ePWM). The software is re-arming the module at 10 kHz from an ISR triggered by the ePWM.
Since quite a bit of time elapses between EVT3 and re-arming, I would expect the EVT1 capture value to be large (since the counter presumably keeps running while the mod4 counter is stopped after EVT3). However, very strangely, the capture values for EVT1 and EVT3 are identical: 1999 (at SYSCLK = 200 MHz). So this looks like the behavior that I would expect from continuous mode, not single-shot operation. I verified that I am indeed running single-shot operation by removing the periodic ECCTL2.bit.REARM = 1 statement, and confirming that the EVT3 flag is no longer being set.
My conclusion is that I do not properly understand the eCAP operation - any further insight would therefore be appreciated.
Init code (virtually identical to "ECap_Capture_Pwm_Xbar_cpu01" example):
ECap1Regs.ECEINT.all = 0x0000; // disable interrupts
ECap1Regs.ECCLR.all = 0xFFFF; // clear flags
ECap1Regs.ECCTL1.bit.CAPLDEN = 0; // disable CAP1-CAP4 register loads
ECap1Regs.ECCTL2.bit.TSCTRSTOP = 0; // stop counter
ECap1Regs.ECCTL2.bit.CONT_ONESHT = 1;
ECap1Regs.ECCTL2.bit.STOP_WRAP = 2; // when to stop
ECap1Regs.ECCTL1.bit.CAP1POL = 0; // rising
ECap1Regs.ECCTL1.bit.CAP2POL = 1; // falling
ECap1Regs.ECCTL1.bit.CAP3POL = 0; // rising
ECap1Regs.ECCTL1.bit.CTRRST1 = 1; // reset counter
ECap1Regs.ECCTL1.bit.CTRRST2 = 0; // don't reset counter
ECap1Regs.ECCTL1.bit.CTRRST3 = 1; // reset counter
ECap1Regs.ECCTL2.bit.SYNCI_EN = 0; // disable sync in
ECap1Regs.ECCTL2.bit.SYNCO_SEL = 0; // pass through
ECap1Regs.ECCTL1.bit.CAPLDEN = 1; // enable unit
ECap1Regs.ECCTL2.bit.TSCTRSTOP = 1; // start counter
ECap1Regs.ECCTL2.bit.REARM = 1; // arm one-shot
ECap1Regs.ECCTL1.bit.CAPLDEN = 1; // enable unit
