How to use PWM on Xavier NX

Trying to use PWM instead of GPIO on pin 33 on the Jetson Xavier NX. I was using jetson.io to configure the 40 pin header. I try to save and reboot and it goes back to the default when I run the utility again.

Is there a “simple” way to enable PWM that I’m overlooking. I did see some information about pinmux from https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/mb1_platform_config_xavier.html

This seems really confusing! Hoping I’m missing something with jetson.io.

Any guidance is appreciated.

hello emurtha,

are you using Jetson-IO python script to configure the 40 pin header?
according to developer guide, Configuring the 40-Pin Expansion Header.

Jetson‑IO is a Python-based tool that runs on the developer kit and modifies the Device Tree Blob (DTB) firmware so that a new configuration for the 40‑pin expansion header is applied when the developer kit is rebooted.

hello emurtha,

please access Pinmux spreadsheets via download center.
you may have pinmux customization and generate several *.dtsi files; after that, please convert those *dtsi files into a board configuration file.
please also check MB1 Configuration Changes for more details.
as you can see, there’s python tool, pinmux-dts2cfg.py to convert pinmux, gpio and pad dts file to cfg format.
after that,
you may perform flash.sh script to flash the board.
thanks

Hi and thanks for your reply. Looking through the docs I see:

“If your board schematic differs from that for Jetson Xavier NX Developer Kit board, you must change the pinmux configuration applied by the software.”

I’m not changing anything related to the board here I just want to use pin 32 (any capable pin is OK too). If I’m misinterpreting things please let me know. I had a NvMe installed on this Jetson and thought it might be screwing things up and now I see some changes I make with jetson.io persist across reboots.

If I run jetson.io I see this by default

I then choose to configure the 40 pin board like:

image

and I get back:

What is “gp” ? I’m I still going to have generate this cfg to address this?

Update:

When I use the command line I get:

It’s really strange honestly. After checking this I checked using jetson.io and it also says pwm8. Then I rebooted to check and jetson.io will show me ‘gp’ again. I then used the command line and it shows me ‘pwm8’. So… maybe theres a problem here.

I can try some testing on pwm and see but I don’t feel confident in this output.

Edit: Now that I’ve done a bit of reading I realize I’m probably posting in the wrong place. I’m using a Jetson Xavier NX development kit and not trying to use this as a module in another system. Any advice on the right place for this topic?

Also, how do I access the pinmux-dts2cfg.py file you referenced?

I see this: https://docs.nvidia.com/jetson/archives/l4t-archived/l4t-3243/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide%2Fmanifest_tx2_tx2i.html%23

But I don’t see how to access this? Download it? Thanks!

hello emurtha,

I’ve check Pinmux spreadsheets again, pin-32 (GPIO07) has by default configured as GPIO3_PR.00;
you may select the customer usage to update the configuration as PWM pin.

you may also refer to below thread for an example of NX’s GPIO, GPIO customization on Jetson Platform
thanks

hello emurtha,

you may install JetPack release image via SDKManager,
it’ll download the image to your local host machine, for example, ~/nvidia/nvidia_sdk/JetPack_4.4_Linux_JETSON_AGX_XAVIER/
you should also found the pinmux-dts2cfg.py python script under Linux_for_Tegra/kernel/pinmux/t19x/
thanks

Thanks again. I will try the SDKManager and see what I can figure out. Crash course on my part and I appreciate the support.

I installed SDK Manager on a host Ubuntu Laptop. Connected the device (choosing Jetson Xavier NX (Dev Kit) and all software options.

Upon completion I still do not se the directories you mentioned. Searching for the .py references returns no results.

“L4T 32.4.4 is included as part of JetPack 4.4.1.” not that I can see.

I was able to find https://developer.nvidia.com/embedded/linux-tegra but not installed as part of jetpack. Again I’m probably missing something.

Questions:

  1. You said to Install “Jetpack release image”… is that something I’m missing? I used the 4.4.1 version.
  2. What is Jetson.io utility for if not for this express purpose?
  3. If I were to need to use the pinmux spreadsheet… what values are changing in like 193 that you referenced? I need PWM as an output.

Thanks again.

I found this in https://github.com/NVIDIA/jetson-gpio/blob/master/samples/test_all_apis.py

'JETSON_NX': {
    # Pre-test configuration, if boot-time pinmux doesn't set up PWM pins:
    # Set BOARD pin 32 as mux function PWM (func 1):
    # busybox devmem 0x2430040 32 0x401
    # Set BOARD pin 33 as mux function PWM (func 2):
    # busybox devmem 0x2440020 32 0x402
    # Board mode pins
    'out_a': 32,
    'in_a': 31,
    'out_b': 29,
    'in_b': 26,
    'unimplemented_pins': (),
    # Other pin modes:
    'cvm_pin': 'GPIO09',
    'tegra_soc_pin': 'AUD_MCLK',
    'all_pwms': (32, 33),
},

I used the “sudo busybox devmem 0x2430040 32 0x401” command and now my servo moves as expected.