Tool/software:
Hello,
I am currently facing an issue with PWM capture using the eCAP0 module on the AM3358. Since there are no available examples for eCAP capture, I have configured the eCAP as follows:
HW_WR_REG32((SOC_CM_PER_REGS + CM_PER_EPWMSS0_CLKCTRL), 0x02);
// Enabled clock for EPWMSS0 by writing 0x02HW_WR_REG32((SOC_PWMSS0_REGS + PWMSS_CLKCONFIG), 0x01);
// Configured clockHW_WR_REG32((SOC_CONTROL_REGS + CONTROL_PWMSS_CTRL), 0x01);
// Configured time baseECAPClockEnable(SOC_PWMSS0_REGS);
// Enabled eCAP clockECAPOperatingModeSelect(SOC_ECAP_0_REGS, ECAP_CAPTURE_MODE);
// Set to capture modeECAPPrescaleConfig(SOC_ECAP_0_REGS, 0x0);
// Bypassed prescalerECAPCapeEvtPolarityConfig(SOC_ECAP_0_REGS, 1, 1, 1, 1);
// Configured polarity to rising edgeECAPContinousModeConfig(SOC_ECAP_0_REGS);
// Set to continuous modeECAPCounterControl(SOC_ECAP_0_REGS, ECAP_COUNTER_FREE_RUNNING);
// Set counter to free-running modeECAPSyncInOutSelect(SOC_ECAP_0_REGS, ECAP_SYNC_IN_DISABLE, ECAP_SYNC_OUT_DISABLE);
// Disabled sync in and outECAPCaptureLoadingEnable(SOC_ECAP_0_REGS);
// Enabled capture loading
After the above configurations, I attempted to read the CAP registers:
capture_1 = ECAPTimeStampRead(SOC_ECAP_0_REGS, ECAP_CAPTURE_EVENT_1);
appPrint("\n capture1 is %x", capture_1); // Reading CAP_1 register
capture_2 = ECAPTimeStampRead(SOC_ECAP_0_REGS, ECAP_CAPTURE_EVENT_2);
appPrint("\n capture2 is %x", capture_2); // Reading CAP_2 register
capture_3 = ECAPTimeStampRead(SOC_ECAP_0_REGS, ECAP_CAPTURE_EVENT_3);
appPrint("\n capture3 is %x", capture_3); // Reading CAP_3 register
capture_4 = ECAPTimeStampRead(SOC_ECAP_0_REGS, ECAP_CAPTURE_EVENT_4);
appPrint("\n capture4 is %x", capture_4); // Reading CAP_4 register
However, all the CAP registers are reading 0. I have verified that the eCAP0 module's clock is enabled and that the ECCTL1 and ECCTL2 registers are updating correctly.
pinmux also verified the same pin if i used for APWM output means it working fine but i configured to capture mode am facing this.
Could someone please point out where I might be going wrong? Any assistance would be greatly appreciated.
Thank you.