JetPack4.3使用Jetson-IO tool设置Pinmux

Jetson Nano Developer Kit扩展了40PIN的GPIO接口,兼容树莓派的40PIN接口。使用JetPack4.3(r32.3.1)中新增的Jetson-IO 工具,Pinmux表的设定变得容易了。


配置

启动Jetson-IO tool:

$ sudo /opt/nvidia/jetson-io/jetson-io.py

按照步骤执行jetson-io.py 时,可能会出现输出错误:

$ sudo /opt/nvidia/jetson-io/jetson-io.py
[sudo] password for jetson: 
Traceback (most recent call last):
  File "/opt/nvidia/jetson-io/jetson-io.py", line 25, in <module>
    from Jetson import board
ImportError: cannot import name 'board'

则执行:

$ sudo find /opt/nvidia/jetson-io/ -mindepth 1 -maxdepth 1 -type d -exec touch {}/__init__.py \;

再一次执行jetson-io.py,画面会一闪而过,用less确认错误内容:

$ sudo /opt/nvidia/jetson-io/jetson-io.py | less

FATAL ERROR!
No DTB found for NVIDIA Jetson Nano Developer Kit!
Press any key to terminate

在NVIDIA Developer的页面上发现了解决方法:

因为DTB文件存在于/boot目录属下,所以制作/boot/dtb目录,复制到其中:

$ cd /boot
$ sudo mkdir dtb
$ sudo cp *.dtb* dtb/

再次执行jetson-io.py,配置40pin表:

在Jetson-IO tool的GUI画面中启用PWM,选择pwm0(32)和pwm2(33),(在该行中按空格键时会加上”*”号)选择“Back”。

确认pin32中pwm0、pin33中是否设定了pwm2,选择”Save and reboot to reconfigure pins”(更改设置后重新启动)。

重新启动后确认设置是否生效(/boot/tegra210-p3448-0000-p3449-0000-b00-user-custom.dtb 已生成的文件)。

$ ls -l /boot/*.dtb
-rw-r--r-- 1 root root 487148 12月 10 15:59 /boot/tegra210-jetson-tx1-p2597-2180-a01-devkit.dtb
-rw-r--r-- 1 root root 487677 12月 10 15:59 /boot/tegra210-jetson-tx1-p2597-2180-a02-devkit-24x7.dtb
-rw-r--r-- 1 root root 214243 12月 10 15:59 /boot/tegra210-p3448-0000-p3449-0000-a00.dtb
-rw-r--r-- 1 root root 214203 12月 10 15:59 /boot/tegra210-p3448-0000-p3449-0000-a01.dtb
-rw-r--r-- 1 root root 214705 12月 10 15:59 /boot/tegra210-p3448-0000-p3449-0000-a02.dtb
-rw-r--r-- 1 root root 214705 12月 17 04:21 /boot/tegra210-p3448-0000-p3449-0000-b00.dtb
-rw-r--r-- 1 root root 215778  1月  5 19:23 /boot/tegra210-p3448-0000-p3449-0000-b00-user-custom.dtb
-rw-r--r-- 1 root root 214687 12月 10 15:59 /boot/tegra210-p3448-0002-p3449-0000-a02.dtb
-rw-r--r-- 1 root root 214683 12月 10 15:59 /boot/tegra210-p3448-0002-p3449-0000-b00.dtb

extlinux.conf /boot/tegra210-p3448-0000-p3449-0000-b00-user-custom.dtb 已设置。

$ cat /boot/extlinux/extlinux.conf
TIMEOUT 30
DEFAULT JetsonIO

MENU TITLE L4T boot options

LABEL primary
      MENU LABEL primary kernel
      LINUX /boot/Image
      INITRD /boot/initrd
      APPEND ${cbootargs} quiet

# When testing a custom kernel, it is recommended that you create a backup of
# the original kernel and add a new entry to this file so that the device can
# fallback to the original kernel. To do this:
#
# 1, Make a backup of the original kernel
#      sudo cp /boot/Image /boot/Image.backup
#
# 2, Copy your custom kernel into /boot/Image
#
# 3, Uncomment below menu setting lines for the original kernel
#
# 4, Reboot

# LABEL backup
#    MENU LABEL backup kernel
#    LINUX /boot/Image.backup
#    INITRD /boot/initrd
#    APPEND ${cbootargs}

LABEL JetsonIO
    MENU LABEL Custom 40-pin Header Config
    LINUX /boot/Image
    FDT /boot/tegra210-p3448-0000-p3449-0000-b00-user-custom.dtb
    INITRD /boot/initrd
    APPEND ${cbootargs}

PWM的操作方法参照以下,向系统写入命令:

$ sudo su
# cd /sys/devices/7000a000.pwm/pwm/pwmchip0