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.

PROCESSOR-SDK-AM57X: ecap with processor-sdk-linux

Part Number: PROCESSOR-SDK-AM57X


Hello,

we need to use the time stamping functionality to implement a pll in order to synchronize to an external clock (e.g.1kHz) with precisions better than 200 ns. The ecap functionality in the pwmss is predestinated for such application. However, there is no kernel driver available to access this function. A way to access the registers could be the uio-module-driver. I am able to open and access the pruss1 registers and memory regions (adding am57xx-idk-pru-uio-swissQprint.dtsi to the am57xx-idk.dts). Adding similar entries for the pwmss register map I am able to open and map the registers to memory (according to example in the extra-driver uio-module-drv-2.2.1.0). However, when reading I get a 'bus error' exception.

Do you have any hints for me? Or do you know of a kernel driver which supports capturing events?

Thanks a lot for your help,

Bernd

  • The kernel trace of the above exception is:

    am57xx-evm login: [  297.096612] ------------[ cut here ]------------
    [  297.101278] WARNING: CPU: 0 PID: 31 at drivers/bus/omap_l3_noc.c:147 l3_interrupt_handler+0x330/0x380
    [  297.110542] 44000000.ocp:L3 Custom Error: MASTER MPU TARGET L4_PER2_P3 (Read): Data Access in User mode during Functionals
    [  297.122157] Modules linked in: xfrm_user xfrm4_tunnel ipcomp xfrm_ipcomp esp4 ah4 af_key xfrm_algo rpmsg_proto xhci_plat_)
    [  297.178200] CPU: 0 PID: 31 Comm: irq/23-l3-app-i Tainted: G        W  O      4.19.79-rt28-g0df36f903cba-dirty #3
    [  297.178203] Hardware name: Generic DRA74X (Flattened Device Tree)
    [  297.178207] Backtrace:
    [  297.178221] [<c020c6a8>] (dump_backtrace) from [<c020c9e0>] (show_stack+0x18/0x1c)
    [  297.178229]  r7:c0df43e4 r6:600d0113 r5:00000000 r4:c1253c9c
    [  297.178239] [<c020c9c8>] (show_stack) from [<c09f09e4>] (dump_stack+0x90/0xa4)
    [  297.178250] [<c09f0954>] (dump_stack) from [<c022d0a8>] (__warn+0xdc/0xf8)
    [  297.178256]  r7:c0df43e4 r6:00000009 r5:00000000 r4:dfa4be24
    [  297.178265] [<c022cfcc>] (__warn) from [<c022ccc4>] (warn_slowpath_fmt+0x50/0x6c)
    [  297.178271]  r9:dfa25c40 r8:e0882564 r7:c0df4310 r6:c0df4250 r5:c0df43b4 r4:c1207488
    [  297.178281] [<c022cc78>] (warn_slowpath_fmt) from [<c0556aec>] (l3_interrupt_handler+0x330/0x380)
    [  297.178285]  r3:dfa24800 r2:c0df43b4
    [  297.178288]  r5:00000002 r4:80080003
    [  297.178298] [<c05567bc>] (l3_interrupt_handler) from [<c0289eb4>] (irq_forced_thread_fn+0x28/0xa0)
    [  297.178304]  r10:00000001 r9:c0289e8c r8:00000000 r7:ffffe000 r6:dfa24c24 r5:dfa24c00
    [  297.178307]  r4:df877800
    [  297.178315] [<c0289e8c>] (irq_forced_thread_fn) from [<c028a288>] (irq_thread+0x140/0x22c)
    [  297.178319]  r7:ffffe000 r6:dfa24c24 r5:dfa24c00 r4:df877800
    [  297.178328] [<c028a148>] (irq_thread) from [<c024c1e4>] (kthread+0x160/0x168)
    [  297.178334]  r10:df87ba94 r9:c028a148 r8:dfa24c00 r7:dfa4a000 r6:00000000 r5:dfa24c40
    [  297.178336]  r4:df9fa0c0
    [  297.178344] [<c024c084>] (kthread) from [<c02010e0>] (ret_from_fork+0x14/0x34)
    [  297.178347] Exception stack(0xdfa4bfb0 to 0xdfa4bff8)
    [  297.178352] bfa0:                                     00000000 00000000 00000000 00000000
    [  297.178357] bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    [  297.178362] bfe0: 00000000 00000000 00000000 00000000 00000013 00000000
    [  297.178368]  r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c024c084
    [  297.178370]  r4:dfa24c40
    [  297.178373] ---[ end trace 0000000000000005 ]---

    Thanks a lot for your help,

    Bernd

  • This also happens when I enable the devices in the device tree via

    &ecap0 {
        status = "okay";
    };
    &ehrpwm0 {
        status = "okay";
    };
    &epwmss0 {
        status = "okay";
    };

    and then use

    omapconf read 0x4843e200

    to read the registers from the console...

  • Hi Bernd,

    As you have observed the Linux
    SDK does not support the input event counting part. It's only the PWM side that is supported.
    I checked with the PWM expert and apparently no use case thus far has required

    However some quick googling i could find some non upstreamed code that is here:

    https://linux-arm-kernel.infradead.narkive.com/zeEA4MIa/patch-v3-0-6-iio-pulse-capture-support-for-ti-ecap

    Also the newer SoCs have some more documentation related to ECAP use cases:

    http://www.ti.com/lit/ug/spruil1a/spruil1a.pdf

    Page: 11690
    12.4.1.5 ECAP Use Cases

    Hope this helps you.


    Regards,
    Keerthy