I've been trying to setup ECAP1 in delta-mode to capture a square signal, but the capture events are not changing, I only read 0, could you have a look at the code below please, maybe you can spot something?
PSCModuleControl(SOC_PSC_1_REGS, HW_PSC_ECAP0_1_2, PSC_POWERDOMAIN_ALWAYS_ON, PSC_MDCTL_NEXT_ENABLE);
//Select Pin E4 ECAP1
/* ECAP1 */
HWREG(SOC_SYSCFG_0_REGS + SYSCFG0_PINMUX(1)) = (HWREG(SOC_SYSCFG_0_REGS + SYSCFG0_PINMUX(1)) & (~(SYSCFG_PINMUX1_PINMUX1_31_28))) | (SYSCFG_PINMUX1_PINMUX1_31_28_ECAP1 << SYSCFG_PINMUX1_PINMUX1_31_28_SHIFT);
ECAPCapeEvtPolarityConfig(SOC_ECAP_1_REGS, 1, 1, 1, 1);
//rising, rising, rising, rising edges so that after 3 rising edges I have full rotation
ECAPCaptureEvtCntrRstConfig(SOC_ECAP_1_REGS, 1, 1, 1, 1 );
//reset counter each time rising edge is found
//set ecap in continuous mode to measure speed continuously
ECAPIntDisable(SOC_ECAP_1_REGS, ECAP_CEVT1_INT | ECAP_CEVT2_INT | ECAP_CEVT3_INT | ECAP_CEVT4_INT | ECAP_CNTOVF_INT | ECAP_PRDEQ_INT | ECAP_CMPEQ_INT);
ECAPSyncInOutSelect(SOC_ECAP_1_REGS, ECAP_SYNC_IN_DISABLE, ECAP_SYNC_OUT_DISABLE);
//capture time base =>reset ecap
//timer base counter to increase
Thank you in advance,
I think I found the problems:
In ecap.h the definitions for the ECAP_CAPTURE_MODE parameter for ECAPOperatingModeSelect function should be 0 instead of 1
#define ECAP_CAPTURE_MODE 0 //check page spruh79a.pdf, bit 9#define ECAP_APWM_MODE 1 ...correction, it was ok, ECAPOperatingModeSelect is a bit confusing, set parameter to 1 to clear bit.
Also, for ECAPSyncInOutSelect function the definitions are wrong, it overwrites the bit 9 setting it back to pwm mode
#define ECAP_SYNC_IN (00 << ECAP_ECCTL2_SYNCO_SEL_SHIFT) #define ECAP_PRD_EQ (01 << ECAP_ECCTL2_SYNCO_SEL_SHIFT) #define ECAP_SYNC_OUT_DISABLE (10 << ECAP_ECCTL2_SYNCO_SEL_SHIFT) //this should be 2 <<
Hope someone can confirm this.
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.