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.

AM335x on beaglebone, how to use ecap for event capture via linux shell

Hello dear community,

I´m currently investigating on AM335x using a beaglebone board.

From datahsheet of the device I know that the eCAP module can function either in PWM mode or Capture mode with :

 Dedicated external pin, 32 bit Time Base counter, 4 x 32 bit Time-stamp Capture registers (CAP1-CAP4),  Input Capture signal pre-scaling and  Interrupt capabilities on any of the 4 capture events.

In the TI guide http://processors.wiki.ti.com/index.php/AM335x_PWM_Driver%27s_Guide it is quite well described how to use for PWM from Linux shell level, but no glue on using ecap for event capturing.

Looking on the Linux filesystem ( using Angstrom-Cloud9-IDE-GNOME-eglibc-ipk-v2012.05-beaglebone-2012.11.22.img.xz distribution), I see ecap supported :

root@beaglebone:/sys/class/pwm/ecap.0# ls

device   duty_percent  period_ns  power    run        tick_hz

duty_ns  period_freq   polarity   request  subsystem  uevent

Everything seems to be promising , using ecap from Lunix shell.

Do anybody know how to use ecap for event capturing  from Linux shell ?

Many thanks in advance

BRgds

Thomas

 

 

 

  • Hi Thomas,

    As you can see in this section of the PWM Driver's Guide, the current release of the driver supports only PWM mode. Capture mode will probably be included in a future release of the driver.

    Best regards,
    Miroslav

  • Hello Miroslav,

    thanks for answer. Do you know, when the driver will provide also capture mode ?

    Thanks

    BRgds

    Thomas

  • Hi Thomas,

    I'm afraid I don't have that information. I checked the development branch of the Arago project linux git repository (not yet officially released) and I can't find anything related to eCap capture mode, so I don't think the capture mode feature will be added to the driver in the next release of the SDK/PSP. Perhaps you can try and implement it yourself.

    Best regards,
    Miroslav

  • Hello Miroslav,

    first thanks again for your effort and support.

    As I mentioned at the begin of the thread, my main intention is to use eCAP module in Capture mode.

    Indeed, I just want to use the ecap to count an event and read out continuously  by a register how many events occured ( clear value by read).

    I had a deeper look to the AM335 Technical Reference Manual revised Nov. 2012.

    I see several registers which are needed here(going with Capture 1) :

    - ECCTL1 (capture control 1 : Bit 8 Capture enable , Bit 1 Counter reset, Bit 0 Capture polarity)

    - ECCTL2 ( capture control 2:  bit 9 : configure APWM or CAP mode, Bit 1 to 2 wrap control of capturing)

    - CAP 1 ( capture 1 : read the counted number of events)

    All of these resgisters are used for capture as well as APWM mode

    Investigating on the Texas Instrument's Omap Processor's Linux development mailing list (http://comments.gmane.org/gmane.linux.ports.arm.omap/80653), I found explanations of  Avinash Philip . He added a "Patch #1 adds Generic PWM driver support for simple APWM functionality of ECAP". So I invited him to participate to our  thread.

    My impression is, since APWM mode and capture mode uses the same registers, with the patch by Avinash it should be

    a) possible to handle also the capture mode or

    b) at least that it only needs minimum adaptions to the Patch #1 to support capture mode.

    Many thanks for your support 

    Best regards

    Thomas

  • Hello Miroslav, hello Avinash,

    I would like to take the opportunity to ask you , if there was any progress with enabling the capture mode for

    AM335 ?

    If not., Avinash, since you provided the patch #1 in http://comments.gmane.org/gmane.linux.ports.arm.omap/80653, would it be possible

    by your side to extend the patch #1 for capture mode ?


    As mentioned in my post , APWM mode and capture mode use the same registers.

    It would be really great, if you could provide such an extension.


    Thanks in advance

    Best regards


    Thomas