This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM3358: ECAP capture issue

Part Number: AM3358

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:

  1. HW_WR_REG32((SOC_CM_PER_REGS + CM_PER_EPWMSS0_CLKCTRL), 0x02);
    // Enabled clock for EPWMSS0 by writing 0x02
  2. HW_WR_REG32((SOC_PWMSS0_REGS + PWMSS_CLKCONFIG), 0x01);
    // Configured clock
  3. HW_WR_REG32((SOC_CONTROL_REGS + CONTROL_PWMSS_CTRL), 0x01);
    // Configured time base
  4. ECAPClockEnable(SOC_PWMSS0_REGS);
    // Enabled eCAP clock
  5. ECAPOperatingModeSelect(SOC_ECAP_0_REGS, ECAP_CAPTURE_MODE);
    // Set to capture mode
  6. ECAPPrescaleConfig(SOC_ECAP_0_REGS, 0x0);
    // Bypassed prescaler
  7. ECAPCapeEvtPolarityConfig(SOC_ECAP_0_REGS, 1, 1, 1, 1);
    // Configured polarity to rising edge
  8. ECAPContinousModeConfig(SOC_ECAP_0_REGS);
    // Set to continuous mode
  9. ECAPCounterControl(SOC_ECAP_0_REGS, ECAP_COUNTER_FREE_RUNNING);
    // Set counter to free-running mode
  10. ECAPSyncInOutSelect(SOC_ECAP_0_REGS, ECAP_SYNC_IN_DISABLE, ECAP_SYNC_OUT_DISABLE);
    // Disabled sync in and out
  11. ECAPCaptureLoadingEnable(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.

  • Hello Subhash,

    Are you programming the AM335x using TI-RTOS? If not, what are you using?

    Regards,

    Nick

  • Hello Subhash,

    Are you programming the AM335x using TI-RTOS? If not, what are you using?

    Regards,

    Nick

  • yes I am currently using TI-RTOS for the AM3358.

    Let me know if you need any further adjustments!

  • Hello Subhash,

    No support for TI-RTOS

    Please note that we can no longer support questions about TI-RTOS on AM335x, as per the notice on the SDK download page:
    https://www.ti.com/tool/PROCESSOR-SDK-AM335X
    https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1071334/notice-regarding-processor-sdk-ti-rtos-for-am335x-am437x-omap-l13x-c674x-k2g-devices

    Next debug steps

    We can provide some limited support in debugging the ECAP peripheral itself. I may end up passing you to a member of our hardware apps team to comment.

    Can you read the config register values (not just in the SoC control registers, also the registers in the ECAP peripheral itself) to verify that the register values have been written as expected?

    What about pinmuxing? 

    I do not understand your pinmuxing comment. Please attach your pinmux settings.

    Regards,

    Nick

  • With respect to pinmux configuration

    regVal=0x10;
    HW_WR_REG32((SOC_CONTROL_REGS+PIN_ECAP0_IN_PWM0_OUT), regVal);// mode 0 _ primary mode

    this is the setting i have made.

    The ECCTL1 and ECCTL2 registers have been set to 0x01FF and 0x0096, respectively.

    My query is regarding the necessity of enabling interrupts for capturing timestamps in the capture registers. Is it possible to directly view the captured timestamp without enabling the interrupt?

    Additionally, if the interrupt must be enabled in the ECAP_ECEINT register, I am unsure where to add the ISR for this interrupt. Could you please provide guidance on this?

    i tried with enabling interrupt in ECAP_ECEINT for all capture events still am not able to see the values in cap1-4 registers

  • Hello Subhash,

    your pinmux looks wrong to me.

    The muxmode = 0 looks fine to route the pin to signal "eCAP0_in_PWM0_out". However, you are setting RXACTIVE = 0 = "receiver disabled", when I would expect it needs to be equal to 1.

    From the AM335x technical reference manual (TRM):

    I am not able to comment on ISR, etc. The best I can do is point you to the TRM section PWMSS > eCAP module > Functional Description for more details about how the hardware works.

    Off the top of my head, I would expect that the captured timestamp will happen regardless of whether interrupts are enabled or not.

    This is about as far as I can take you. If updating the pinmux settings does not help, I can send you over to the hardware guy to comment.

    Regards,

    Nick

  • Apologies for the delay; due to the Independence Day holiday and the following weekend, I was unable to check earlier.

    Today, I reconfigured the PINMUX settings and can now see data in the capture registers.

    Thank you so much for your support, and a special thanks to the TI support team and Nick Saulnier.

  • Hello Subhash,

    Glad to hear that things are working for you, and thanks for confirming your solution!

    As mentioned above, we won't be able to answer any questions about TI-RTOS at this point in time - but if any other hardware related questions come up, please feel free to create a new e2e thread to talk about it with us.

    Regards,

    Nick