PWM cannot be enabled

  • Problem
    Hello.
    I’m not good at English so some parts may be difficult to understand.
    I apologize in advance.
    I’m trying to run a DC motor on a Jetson AGX Xvier.
    I had a problem with jetson-io.py crashing, but I have solved it regarding that.

  • Coping strategies already tried
  1. Prerequisite
$ sudo apt update
$ sudo apt upgrade
$ sudo reboot

  1. pinmux spreadsheets&re-flash Jetpack

  1. change the pin settings
$ sudo /opt/nvidia/jetson-io/jetson-io.py

  1. enable GPIOs manually
$ sudo cat /sys/kernel/debug/gpio | grep PQ.01
$ echo 436 > /sys/class/gpio/export
$ cd /sys/class/gpio/PQ.01

bash: cd: /sys/class/gpio/PQ.01: そのようなファイルやディレクトリはありません


  • Other Information
  1. Xavier version
$ cat /etc/nv_tegra_release

.# R32 (release), REVISION: 7.2, GCID: 30192233, BOARD: t186ref, EABI: aarch64, DATE: Sun Apr 17 09:53:50 UTC 2022


  1. Jetpack version
$ sudo apt show nvidia-jetpack

Package: nvidia-jetpack
Version: 4.6.2-b5
Priority: standard
Section: metapackages
Maintainer: NVIDIA Corporation
Installed-Size: 199 kB
Depends: nvidia-cuda (= 4.6.2-b5), nvidia-opencv (= 4.6.2-b5), nvidia-cudnn8 (= 4.6.2-b5), nvidia-tensorrt (= 4.6.2-b5), nvidia-visionworks (= 4.6.2-b5), nvidia-container (= 4.6.2-b5), nvidia-vpi (= 4.6.2-b5), nvidia-l4t-jetson-multimedia-api (>> 32.7-0), nvidia-l4t-jetson-multimedia-api (<< 32.8-0)
Homepage: http://developer.nvidia.com/jetson
Download-Size: 29.4 kB
APT-Sources: https://repo.download.nvidia.com/jetson/t194 r32.7/main arm64 Packages
Description: NVIDIA Jetpack Meta Package
N: 追加レコードが 1 件あります。表示するには ‘-a’ スイッチを付けてください。


  1. Boot config(?)
$ cat /etc/nv_boot_control.conf

TNSPEC 2888-400-0004-G.0-1-2-jetson-xavier-mmcblk0p1
COMPATIBLE_SPEC 2888-400-0004–1-2-jetson-agx-xavier-devkit-
TEGRA_CHIPID 0x19
TEGRA_OTA_BOOT_DEVICE /dev/mmcblk0boot0
TEGRA_OTA_GPT_DEVICE /dev/mmcblk0boot1


  • References
  1. Crash jetson-io.py
  2. Running two simple DC motors (5 Amp) Forward and Backward in Jetson Nano
  3. GPIO PWM not work.

hello asuka.za,

that’s incorrect steps, since l4t-r32.7.2 is using kernel-4.9, please refer to developer guide To check the GPIO number.
you may see-also https://jetsonhacks.com/nvidia-jetson-agx-xavier-gpio-header-pinout/, it’s gpio417.

Thank you for your reply.

I am trying it out as I read the article you shared with me.

I’m not sure about the fourth “Because the Jetson module registers GPIOs dynamically, search kernel messages to check GPIO allocation ranges for each GPIO group.” in “To check the GPIO number”.
When I run the command, I am told that there is no such file or directory.

/home/ubuntu# dmesg | grep gpiochip_setup_dev

bash: /home/ubuntu#: そのようなファイルやディレクトリはありません

I ran the command without moving to “/home/ubuntu” to try it out and got some output.
For now, let us assume that this is the correct method and proceed to the next step.

dmesg | grep gpiochip_setup_dev

[ 0.915846] gpiochip_setup_dev: registered GPIOs 288 to 511 on device: gpiochip0 (tegra-gpio)
[ 0.923694] gpiochip_setup_dev: registered GPIOs 248 to 287 on device: gpiochip1 (tegra-gpio-aon)
[ 1.066924] gpiochip_setup_dev: registered GPIOs 240 to 247 on device: gpiochip2 (max77620-gpio)

The formula is written, but I cannot get the result “gpio417” when I actually do the calculation.
(16*8+18)+288=420

hello asuka.za,

where is 18 coming? which pin you’re going to check??

here’s an example, pin-22 on the 40-pin expansion header, it is… GPIO17 / GPIO3_PQ.01.
according to the formula… ((16 * 8) + 1) + 288 = 417

Thank you for your reply.

I see that I use that side of the number.
I was mistaken.
I totally understood it.

By the way… I have the number, but how do I activate the pin?
I looked at " To check the GPIO number" and all I could figure out was how to identify the pin.

hello asuka.za,

here’s an example to toggle the pin through sysfs.
for example,
please obtain root permission and enter the location of the GPIOs
$ sudo -i
# cd /sys/class/gpio

please generate gpio name, taking 417 as example.
# echo 417 > export

you’ll see gpio417 created, please enter the node and enable the pin as below.
# cd gpio417
# echo out > direction && echo 1 > value

Thank you for your reply.

I did what you said and it seems to be working maybe.
But when I tried to check, I got this indication.
After rebooting, pin 22 is disabled again.
Do I have to do it every time after startup ?

hello asuka.za,

you have to do it every time after reboot since this approaches to toggle the pin through sysfs.

Thank you for your reply.

Doing this every time I start up Jetson is time consuming. And since this Jetson is used for a product, it is not feasible for the customer to do this every time.
Is there any other way to do this?

Also, please tell me about the error shown in the attached image.

Please reply as this has not been resolved yet.
I am very troubled.

hello asuka.za,

it looks this topic has been solved.


okay, let’s back to your question.
which pin you’re going to enable as PWM?
had you follow this… $ sudo python /opt/nvidia/jetson-io/jetson-io.py to configure 40-pin expansion header?
you may select [Configure Jetson 40pin Header] → [Configure header pins manually].
after that, you shall see pwm1 (pin-15), pwm5 (pin-18), pwm8 (pin-13) available.
please mark them as * to select desired functions, and export device-tree overlay file.

I don’t see failure to configure those pin on AGX Xavier Developer Kits.
or,
you’re not using developer kits?

Thank you for your reply.

I have already set up a 40-pin expansion header.
However, even though the pin was enabled in the settings, the pin was never actually activated.
Also, after a reboot, the pin is deactivated.

What does it mean to output a device-tree overlay file?

I’m using AGX Xavier Developer Kits.

hello asuka.za,

could you please take single pin for testing,
for example, pwm-5 (0x032c0000).

  1. DT configurations of kernel-dts/tegra194-soc/tegra194-soc-pwm.dtsi
        tegra_pwm5: pwm@32c0000 {
                compatible = "nvidia,tegra194-pwm";
                ...
-               status = "disabled";
+               status = "okay"
  1. Settings required for gpio12(pwm-5) as…
      pinmux.0x02434090 = 0x00000401;
  1. Configure PWM fields.
    please find out correct pwmchip for 0x032c0000 and cd to that path, export the node for usage,
$ cd /sys/devices/32c0000.pwm/...
$ echo 0 > export
$ cd pwm0
$ echo 4812345 > period
$ echo 480000 > duty_cycle
$ echo 1 > enable

Thank you for your reply.

Where is “kernel-dts/tegra194-soc/tegra194-soc-pwm.dtsi”?
Perhaps I need to re-burn the OS (jetpack) again?
And where do I enter “pinmux.0x02434090 = 0x00000401;”?

hello asuka.za,

it’s within public sources package, please access to Jetson Linux R32.7.2 Release Page | NVIDIA Developer to download [L4T Driver Package (BSP) Sources].

you may see-also developer guide, Building the NVIDIA Kernel to re-compiler a new dtb file.

pinmux configuration is under $OUT/Linux_for_Tegra/bootloader/t186ref/BCT/
for example, tegra19x-mb1-pinmux-p2888-0000-a00-p2822-0000-a00.cfg
please check your flash message to double check the cfg file that your platform is using.

Thank you for your reply.

I know how this story goes.
After all, it means I have to bake Jetpack into Jetson again, right?
I was recommended that way by you,but in the end the problem was not solved.
I also told you that things were not going well at that time, but you never asked me for advice.
So this is how I created this topic.

I would like you to reply as a conversation, not as a canned response.
Why am I going through all this trouble to do something as simple as “output gpio, a jetson feature”?
I would like all solutions to be explained in a precise, step-by-step manner.

Please reply as soon as possible.
Essentially, the fact that gpio cannot be used properly after installing Jetpack is a flaw in the Jetson AGX Xavier and not a problem that users should struggle to solve.
Why doesn’t nvidia make gpio available from the start?

Why don’t you reply?
I tried the methods you mentioned and could not activate gpio.
Do your job properly.
The SDKMnager you guys made is buggy and doesn’t work properly, and gpio is not available even if you write Jetpack. Even if I do as you said, gpio will not work. You told me to re-burn Jetpack, so I did it, but still gpio doesn’t work. Stop screwing around.
Activate gpio, why are they selling Jetson without teaching you this simple thing?
I only have one thing to say." Please carefully walk me through the entire process of how to reliably activate gpio".