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-AM68A:配置40引脚接头的 spidev

Guru**** 2482105 points
Other Parts Discussed in Thread: AM68, SYSCONFIG

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

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1448448/processor-sdk-am68a-configuring-spidev-for-the-40-pin-header

器件型号:PROCESSOR-SDK-AM68A
主题中讨论的其他器件:AM68SysConfig

工具与软件:

我将尝试通过 AM68开发板的40引脚 RPI 接头(SDK 版本为09.02.00.04)添加 SPI 器件。 我参考了 https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1313556/processor-sdk-am68a-how-to-configure-spidev-for-am68a 并能够启用 spidev 节点、但我想知道由于可以更轻松地进行引脚排列、是否可以使用40引脚接头。

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

    尊敬的 Faheem:

    由于 MCU_SPI1连接到扩展接头、因此应该可以启用 MCU_SPI1。 如果您已设置 SPI、则需要使用 SysConfig 对 MCU_SPI1进行引脚多路复用、并在 SPI 节点中使用新的引脚多路复用引脚。

    此致、

    Takuma

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

    我将 SPI 节点启用为 spidev1。 我还需要将两个 GPIO 引脚用于中断信号和复位信号。 但/sys/class 中没有任何 GPIO 节点

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

    https://software-dl.ti.com/jacinto7/esd/processor-sdk-linux-am68a/09_02_00/exports/edgeai-docs/devices/AM68A/linux/pi_hdr_programming.html?highlight=rpi 参考了本文档、并遵循启用 GPIO 引脚的步骤。  https://github.com/TexasInstruments/ti-gpio-py 此处的示例脚本无法访问 GPIO 引脚。

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

    尊敬的 Faheem:

    1.您是否可以查看 /run/media/BOOT-mmcblk1p1/uEnv.txt 以确保覆盖图已按照说明添加?

    2.是否可以共享引导日志?

    3.是否可以共享运行示例脚本的日志?

    此致、

    Takuma

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

    尊敬的 Faheem:

    我已尝试为 SK-AM68A 安装9.2 SDK、并尝试设置 GPIO 示例、但未出现问题。 附加可用作设置 GPIO 库参考的日志:

    root@am68a-sk:/opt/edgeai-gst-apps#
    root@am68a-sk:/opt/edgeai-gst-apps# ./scripts/install_ti_gpio_libs.sh
    ti-gpio-py
    Installing TI.GPIO python libraries.
    Processing /opt/ti-gpio-py
      Preparing metadata (setup.py) ... done
    Building wheels for collected packages: TI.GPIO
      Building wheel for TI.GPIO (setup.py) ... done
      Created wheel for TI.GPIO: filename=TI.GPIO-1.3.0-py3-none-any.whl size=21344 sha256=1bb48afb64d85a576d49c2342c0ae7627c21f32a32766f39b5aec9a22f0e6cda
      Stored in directory: /home/root/.cache/pip/wheels/53/02/57/12ddf9a5dfa25dd4fcc95e85ac9e20910e2e4472dfd5ad1762
    Successfully built TI.GPIO
    Installing collected packages: TI.GPIO
      Attempting uninstall: TI.GPIO
        Found existing installation: TI.GPIO 1.3.0
        Uninstalling TI.GPIO-1.3.0:
          Successfully uninstalled TI.GPIO-1.3.0
    Successfully installed TI.GPIO-1.3.0
    WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: pip.pypa.io/.../venv
    Cloning gpiozero project.
    Cloning into 'gpiozero'...
    remote: Enumerating objects: 8955, done.
    remote: Counting objects: 100% (1171/1171), done.
    remote: Compressing objects: 100% (486/486), done.
    remote: Total 8955 (delta 793), reused 965 (delta 674), pack-reused 7784 (from 1)
    Receiving objects: 100% (8955/8955), 28.26 MiB | 4.05 MiB/s, done.
    Resolving deltas: 100% (6184/6184), done.
    Switched to a new branch 'ti_gpio_patch'
    ../ti-gpio-py/patches/gpiozero.patch:55: new blank line at EOF.
    +
    warning: 1 line adds whitespace errors.
    Processing /opt/gpiozero
      Preparing metadata (setup.py) ... done
    Collecting colorzero
      Downloading colorzero-2.0-py2.py3-none-any.whl (26 kB)
    Requirement already satisfied: setuptools in /usr/lib/python3.10/site-packages (from colorzero->gpiozero==1.6.1) (59.5.0)
    Building wheels for collected packages: gpiozero
      Building wheel for gpiozero (setup.py) ... done
      Created wheel for gpiozero: filename=gpiozero-1.6.1-py3-none-any.whl size=145013 sha256=26a912dfa21b0f75047a6f459dbfbf32b1908d68ab3192aec63af35e38095f09
      Stored in directory: /tmp/pip-ephem-wheel-cache-hfnelpzv/wheels/31/5b/60/61b11f04cd82de4be6f5dbb8c07362149abe10f3bba5f8a03c
    Successfully built gpiozero
    Installing collected packages: colorzero, gpiozero
    Successfully installed colorzero-2.0 gpiozero-1.6.1
    WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: pip.pypa.io/.../venv
    ti-gpio-cpp
    Building and installing TI GPIO CPP libraries.
    -- The C compiler identification is GNU 11.4.0
    -- The CXX compiler identification is GNU 11.4.0
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Check for working C compiler: /usr/bin/cc - skipped
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Check for working CXX compiler: /usr/bin/c++ - skipped
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    Build type: Release
    -- CMAKE_BUILD_TYPE = Release PROJECT_NAME = ti_gpio
    INCLUDE_INSTALL_DIR = /usr/include
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /opt/ti-gpio-cpp/build
    [  9%] Building CXX object CMakeFiles/ti_gpio.dir/src/gpio.cpp.o
    [  9%] Building CXX object CMakeFiles/ti_gpio.dir/src/gpio_event.cpp.o
    /opt/ti-gpio-cpp/src/gpio_event.cpp: In function 'int GPIO::_write_sysfs_edge(int, GPIO::Edge, bool)':
    /opt/ti-gpio-cpp/src/gpio_event.cpp:120:23: warning: 'ssize_t write(int, const void*, size_t)' reading 7 bytes from a region of size 5 [-Wstringop-overread]
      120 |         result = write(edge_fd, "both", 7);
          |                  ~~~~~^~~~~~~~~~~~~~~~~~~~
    In file included from /opt/ti-gpio-cpp/src/gpio_event.cpp:32:
    /usr/include/unistd.h:378:16: note: in a call to function 'ssize_t write(int, const void*, size_t)' declared with attribute 'access (read_only, 2, 3)'
      378 | extern ssize_t write (int __fd, const void *__buf, size_t __n) __wur
          |                ^~~~~
    /opt/ti-gpio-cpp/src/gpio_event.cpp:127:23: warning: 'ssize_t write(int, const void*, size_t)' reading 7 bytes from a region of size 5 [-Wstringop-overread]
      127 |         result = write(edge_fd, "none", 7);
          |                  ~~~~~^~~~~~~~~~~~~~~~~~~~
    In file included from /opt/ti-gpio-cpp/src/gpio_event.cpp:32:
    /usr/include/unistd.h:378:16: note: in a call to function 'ssize_t write(int, const void*, size_t)' declared with attribute 'access (read_only, 2, 3)'
      378 | extern ssize_t write (int __fd, const void *__buf, size_t __n) __wur
          |                ^~~~~
    [ 13%] Building CXX object CMakeFiles/ti_gpio.dir/src/gpio_pin_data.cpp.o
    [ 18%] Building CXX object CMakeFiles/ti_gpio.dir/src/gpio_common.cpp.o
    [ 22%] Building CXX object CMakeFiles/ti_gpio.dir/src/gpio_sw_pwm.cpp.o
    [ 27%] Building CXX object CMakeFiles/ti_gpio.dir/src/gpio_hw_pwm.cpp.o
    [ 31%] Building CXX object CMakeFiles/ti_gpio.dir/src/python_functions.cpp.o
    [ 36%] Linking CXX static library ../lib/Release/libti_gpio.a
    [ 36%] Built target ti_gpio
    [ 45%] Building CXX object CMakeFiles/ti_gpio_test.dir/samples/ti_gpio_test.cpp.o
    [ 45%] Building CXX object CMakeFiles/button_event.dir/samples/button_event.cpp.o
    [ 50%] Linking CXX executable ../bin/Release/button_event
    [ 50%] Built target button_event
    [ 54%] Building CXX object CMakeFiles/button_interrupt.dir/samples/button_interrupt.cpp.o
    [ 59%] Linking CXX executable ../bin/Release/button_interrupt
    [ 63%] Linking CXX executable ../bin/Release/ti_gpio_test
    [ 63%] Built target button_interrupt
    [ 68%] Building CXX object CMakeFiles/simple_out.dir/samples/simple_out.cpp.o
    [ 68%] Built target ti_gpio_test
    [ 72%] Building CXX object CMakeFiles/simple_pwm.dir/samples/simple_pwm.cpp.o
    [ 77%] Linking CXX executable ../bin/Release/simple_out
    [ 77%] Built target simple_out
    [ 81%] Building CXX object CMakeFiles/test_all_pins_input.dir/samples/test_all_pins_input.cpp.o
    [ 86%] Linking CXX executable ../bin/Release/simple_pwm
    [ 86%] Built target simple_pwm
    [ 90%] Building CXX object CMakeFiles/test_all_pins_pwm.dir/samples/test_all_pins_pwm.cpp.o
    [ 95%] Linking CXX executable ../bin/Release/test_all_pins_pwm
    [ 95%] Built target test_all_pins_pwm
    [100%] Linking CXX executable ../bin/Release/test_all_pins_input
    [100%] Built target test_all_pins_input
    Consolidate compiler generated dependencies of target ti_gpio
    [ 36%] Built target ti_gpio
    Consolidate compiler generated dependencies of target ti_gpio_test
    [ 45%] Built target ti_gpio_test
    Consolidate compiler generated dependencies of target button_event
    [ 54%] Built target button_event
    Consolidate compiler generated dependencies of target button_interrupt
    [ 63%] Built target button_interrupt
    Consolidate compiler generated dependencies of target simple_out
    [ 72%] Built target simple_out
    Consolidate compiler generated dependencies of target simple_pwm
    [ 81%] Built target simple_pwm
    Consolidate compiler generated dependencies of target test_all_pins_input
    [ 90%] Built target test_all_pins_input
    Consolidate compiler generated dependencies of target test_all_pins_pwm
    [100%] Built target test_all_pins_pwm
    Install the project...
    -- Install configuration: "Release"
    -- Installing: /usr/lib/libti_gpio.a
    -- Installing: /usr/include/GPIO.h
    -- Installing: /usr/cmake/ti_gpio/ti_gpioTargets.cmake
    -- Installing: /usr/cmake/ti_gpio/ti_gpioTargets-release.cmake
    -- Installing: /usr/cmake/ti_gpio/ti_gpioConfig.cmake
    -- Installing: /usr/cmake/ti_gpio/ti_gpioConfigVersion.cmake
    root@am68a-sk:/opt/edgeai-gst-apps# cd /opt/ti
    ti-gpio-cpp/ ti-gpio-py/  tidl_test/
    root@am68a-sk:/opt/edgeai-gst-apps# cd /opt/ti
    ti-gpio-cpp/ ti-gpio-py/  tidl_test/
    root@am68a-sk:/opt/edgeai-gst-apps# cd /opt/ti-gpio-py/
    root@am68a-sk:/opt/ti-gpio-py# ls
    LICENSE.txt  MANIFEST.in  README.md  build  lib  manifest.html  patches  samples  setup.py
    root@am68a-sk:/opt/ti-gpio-py# cd samples/
    root@am68a-sk:/opt/ti-gpio-py/samples# python3 simple_input.py
    Starting demo now! Press CTRL+C to exit
    Value read from pin 18 : HIGH
    ^CTraceback (most recent call last):
      File "/opt/ti-gpio-py/samples/simple_input.py", line 53, in <module>
        main()
      File "/opt/ti-gpio-py/samples/simple_input.py", line 47, in main
        time.sleep(1)
    KeyboardInterrupt
    
    root@am68a-sk:/opt/ti-gpio-py/samples#
    

    我注意到 ti-gpi-py 位于主目录中、而不是日志中的/opt/目录下。 /opt/edgeai-gst-apps/scripts 下有一个"install_ti_gpio_libs.sh"脚本、但使用了此脚本、或者是否手动安装了库?

    此致、

    Takuma

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

    你好、Takuma、

    我能够按照上述日志启用 RPI 接头。

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

    你好、Takuma、
    我想检查此 SPI 节点是否对应于 MCU SPI1、是否可从 RPI 接头进行访问。 您能否确认这一点?

    spidev0.0 -> ../../devices/platform/bus@100000/bus@100000:bus@28380000/40310000.spi/spi_master/spi0/spi0.0/spidev/spidev0.0

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

    尊敬的 Faheem:

    是的、 40310000应该对应于 MCU_SPI1

    此致、

    Takuma