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.

[参考译文] AM6442:AM64X 中是否有适用于 eQEP 外设的 Linux (A53)驱动程序

Guru**** 2550030 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1363410/am6442-is-there-a-linux-a53-driver-for-the-eqep-peripheral-in-am64x

器件型号:AM6442

我看到今年早些时候发布了 AM62x 吗? TI 是否有人为 AM6x 的 eQEP 外设开发了64位 Linux (A53内核)驱动程序? (我要求使用 AM64x)

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Jim、您好!

    问得好。 我们添加了 eQEP 驱动程序(我认为在 SDK 9.1中)、当我检查 SDK 9.2时、我看到为 AM62x、AM62Ax、AM62Px 和 AM64x 定义的 eQEP 器件树节点。

    但是、我在 Linux SDK 文档中看不到任何文档、SDK 9.2的 AM64x 软件构建表仍将 eQEP 列为"在 Linux 中未启用"。

    因此、我假设驱动程序存在并且在 AM64x 上进行了测试、我们只是还没有完成添加文档。 我将与开发人员核实、然后提交一些内部票证以更新文档。

    此致、

    尼克

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    实际上、看起来驱动程序可能仅从 SDK 9.2开始提供。

    此致、

    尼克

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    2024年5月22日编辑:文档的最终版本已推送。 请参阅 https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1363410/am6442-is-there-a-linux-a53-driver-for-the-eqep-peripheral-in-am64x/5210141#5210141 

    最后的后续行动,文件在草稿/审议状态中被搁置。 我将在此处包含源代码以生成文档。 可能会出现问题、因为这不是"已完成"的产品。

    EQEP
    ---------------------------------
    
    .. rubric:: Introduction
       :name: introduction-linux-eqep
    
    Linux has support for EQEP (enhanced Quadature Encoder Pulse).
    EQEP channels can be used to interface with rotary encoder hardware.
    
    #. AM62x SK: EQEP0: k3-am62x-sk-eqep.dtso
    #. AM62Ax SK: EQEP0: k3-am62x-sk-eqep.dtbo
    #. AM64x SK: EQEP0: k3-am642-sk.dts
    #. AM62p SK: EQEP0: k3-am62p5-sk-eqep.dtso
    
    |
    
    .. rubric:: Kernel Configuration
       :name: driver-configuration-eqep
    
    .. rubric:: Enable the eHRPWM driver
       :name: enable-the-eqep-driver
    
    .. code-block:: console
    
       Device Drivers --->
           <M> Counter support  --->
             <M> TI eQEP counter driver
    
    .. note::
    
       EQEP driver should be enabled by default as a module in TI Linux kernel.
    
    |
    
    .. rubric:: Driver Usage
       :name: driver-usage-eqep
    
    .. rubric:: Using EQEP with the sysfs interface
       :name: using-eqep-with-sysfs-interface
    
    Several sysfs attributes are generated by the Generic Counter interface, and reside under the
    /sys/bus/counter/devices/counterX directory, where X is to the respective counter device id.
    
    Please see Documentation/ABI/testing/sysfs-bus-counter for detailed information on each Generic
    Counter interface sysfs attribute.
    
    Through these sysfs attributes, programs and scripts may interact with the Generic Counter paradigm
    Counts, Signals, and Synapses of respective counter devices.
    
    -  **Example**
    
    .. code-block:: console
    
       root@am62xx-evm:/sys/bus/counter/devices/counter0/count0# echo 0xff > ceiling
       root@am62xx-evm:/sys/bus/counter/devices/counter0/count0# cat ceiling
       255
       root@am62xx-evm:/sys/bus/counter/devices/counter0/count0# echo 1 > enable
       root@am62xx-evm:/sys/bus/counter/devices/counter0/count0# cat count
    
    |
    
    **Character device nodes**
    
    Counter character device nodes are created under the /dev directory as counterX, where X is the respective counter device id.
    
    .. code-block:: console
    
       $ ls /dev/counter*
       /dev/counter0
    
    **Counter Events**
    
    Please read the Generic counter API doc to implement events:
    
    - docs.kernel.org/.../generic-counter.html
    

    此致、

    尼克

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    如需其他信息、 请访问:https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1290183/am625-eqep 

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Nick:实施是否经过某种形式的回归测试?

    在 FreeRTOS 中的 R5上使用 MCU+ SDK 的 eQEP_CAPTURE 示例并将其更改为 A53上的 Linuc 是否会相当简单?

    谢谢

    吉姆

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Jim、您好!

    代码是在 AM64x 上测试的、但我不确定运行的是什么测试。 如果需要、我可以询问开发人员。

    我无法评论如何 将 MCU+ SDK eQEP 示例移植到 Linux。 首先、我将尝试按照上述文档草稿在 Linux 中运行示例、如果不能按预期运行、您可以问后续问题:
    https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1363410/am6442-is-there-a-linux-a53-driver-for-the-eqep-peripheral-in-am64x/5205034#5205034

    此致、

    尼克

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Nick -我们应要求开发人员披露所运行的测试、这样您就可以确定哪些测试是必要的且足够的、可以使 Linux 代表成为  AM6x 中的"成品"产品。 我怀疑有人来自休斯敦斯塔福德(PaulaCarrillo?) 应参与其中?

    同时、我将查看您提供的表示。

    谢谢

    吉姆

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Jim、您好!

    Paula 更注重 MCU+方面的内容、目前我将继续处理 Linux eQEP 问题。

    开发人员告诉我、由于该驱动程序是如此之新、他们仍在为未来的 SDK 版本设置 eQEP 测试基础架构。 我希望将来您能够在此处看到 CICD 快照的测试输出:
    https://software-dl.ti.com/cicd-report/linux/index.html?section=platform&platform=am64xx 

    他们昨晚也完成了 Linux SDK 文档中 eQEP 驱动程序文档的合并。 我将在此处附加更新的源代码、因为我不确定 AM64x SDK 9.2文档是否会在近期内再次重新生成、或者此更新是否会首次显示在 SDK 10.0文档中:

    EQEP
    ----
    
    .. rubric:: Introduction
       :name: introduction-linux-eqep
    
    Linux has support for EQEP (Enhanced Quadature Encoder Pulse).
    EQEP channels can be used to interface with rotary encoder hardware.
    
    .. ifconfig:: CONFIG_part_variant in ('AM62X', 'AM62AX')
    
    	- AM62x SK: EQEP0: k3-am62x-sk-eqep.dtso
    
    .. ifconfig:: CONFIG_part_variant in ('AM64X')
    
    	- AM64x SK: EQEP0: k3-am642-sk.dts
    
    .. ifconfig:: CONFIG_part_variant in ('AM62PX')
    
    	- AM62p SK: EQEP0: k3-am62p5-sk-eqep.dtso
    
    .. rubric:: Kernel Configuration
       :name: driver-configuration-eqep
    
    Using menuconfig, enable the following driver:
    
    .. code-block:: console
    
       Device Drivers --->
           <M> Counter support  --->
             <M> TI eQEP counter driver
    
    .. note::
    
       EQEP driver should be enabled by default as a kernel module in TI Linux kernel.
    
    .. rubric:: Features supported in TI SDK
       :name: features-supported-eqep
    
    - position
    - overflow/underflow events
    - direction
    - unit timer
    - latched position
    - edge capture
    
    .. rubric:: Using eQEP with SYSFS interface
       :name: sysfs-interface-eqep
    
    Several sysfs attributes are generated by the Generic Counter interface, and reside under
    the :file:`/sys/bus/counter/devices/counterX` directory, where X is to the respective counter
    device id.
    
    Please see the counter sysfs documentation `upstream <www.kernel.org/.../sysfs-bus-counter>`__
    or in TI Linux kernel :file:`/Documentation/ABI/testing/sysfs-bus-counter` for detailed information on each
    generic counter interface sysfs attribute.
    
    Through these sysfs attributes, programs and scripts may interact with the Generic Counter paradigm
    Counts, Signals, and Synapses of respective counter devices.
    
    The following sysfs atributes can be found in :file:`/sys/bus/counter/devices/counterX` in TI SDK:
    
    - countY/ceiling
    - countY/count
    - countY/direction
    - countY/enable
    - countY/function
    - countY/latched_count
    - countY/signal0_action
    - countY/signal1_action
    - edge_capture_unit_enable
    - edge_capture_unit_latched_period
    - edge_capture_unit_max_period
    - edge_capture_unit_prescaler
    - latch_mode
    - unit_timer_enable
    - unit_timer_period
    - unit_timer_time
    
    .. rubric:: Character device nodes
       :name: character-device-nodes-eqep
    
    Counter character device nodes are created under the /dev directory as counterX, where X is the respective counter device id.
    
    .. code-block:: console
    
       $ ls /dev/counter*
       /dev/counter0
    
    .. rubric:: Counter Events
       :name: counter-events
    
    Please read the generic counter API `upstream <docs.kernel.org/.../generic-counter.html>`__ or in
    TI Linux kernel :file:`/Documentation/driver-api/generic-counter.rst` documentation to implement events:
    
    .. rubric:: Test eQEP on AM62x SK
       :name: test-eqep-am62x
    
    +------------------------------------------+---------------------------------------------------------+
    | .. Image:: /images/am62x_sk_eqep.jpg     | .. Image:: /images/am62x_sk_rotary_encoder_breakout.jpg |
    |       :width: 380px                      |       :width: 380px                                     |
    |       :align: center                     |       :align: center                                    |
    +------------------------------------------+---------------------------------------------------------+
    | AM62x SK & rotary encoder breakout board | Example Diligent rotary encoder breakout board          |
    +------------------------------------------+---------------------------------------------------------+
    
    The example rotary encoder breakout board used in this example can be found `here <www.digikey.com/.../4090075.
    
    The following is an example for testing eQEP using sysfs interface:
    
    .. code-block:: console
    
    	root@am62xx-evm:~# echo 0xff > /sys/bus/counter/devices/counter0/count0/ceiling 
    	root@am62xx-evm:~# cat /sys/bus/counter/devices/counter0/count0/ceiling
    	255
    	root@am62xx-evm:~# echo 1 > /sys/bus/counter/devices/counter0/count0/enable 
    	root@am62xx-evm:~# cat /sys/bus/counter/devices/counter0/count0/count
    	0
    	root@am62xx-evm:~# cat /sys/bus/counter/devices/counter0/count0/count
    	92
    	root@am62xx-evm:~# cat /sys/bus/counter/devices/counter0/count0/count
    	148
    	root@am62xx-evm:~# cat /sys/bus/counter/devices/counter0/count0/count
    	188
    	root@am62xx-evm:~# cat /sys/bus/counter/devices/counter0/count0/count
    	252
    	root@am62xx-evm:~# cat /sys/bus/counter/devices/counter0/count0/count
    	12
    
    Notice in this example that turning the rotary shaft encoder counterclockwise increases the count
    until reaching the ceiling, then wraps around to zero and starts again. Also, turning the rotary
    shaft encoder clockwise decreases the count.

    此致、

    尼克