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 Welcome — Jetson Linux<br/>Developer Guide 34.1 documentation

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: Tegra Linux Driver

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 Jetson Linux | NVIDIA Developer 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 jetson-gpio/test_all_apis.py at master · NVIDIA/jetson-gpio · GitHub

'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.

@JerryChang
Could you extend how to get 4 pwm total on a just reflashed Jetson devkit NX board, please? Will it require reflashing or just will work with jetson-io tool?
Thank you very much!
Could you also point out at the other thread which exactly is A5, A6 pins at the PCI-e image, please?

hello Andrey1984,

Jetson Xavier NX has four Pulse Width Modulator (PWM) outputs.
they’re pin-206/GPIO07; pin-218/GPIO12; pin-228/GPIO13; pin-230/GPIO14.

so, you should have pin customization to set those pin as PWM.
thanks

@JerryChang
Thank you for your response.
What exactly customization would be required to set these four? Coudl you extend, please?
Just the jetson-io utility won’t manage it, will it?
Which examtly steps will need to be implemented in order to get these four activated? With use of jetson-io? without use of jetson-io?

hello Andrey1984,

may I know which pin you’re not able to configure it as PWM?

Jetson-IO tool to simplify the configuration of the I/Os exposed by the 40‑pin expansion header.
please have pinmux spreadsheet customize to update the cfg for the board configuration, you should modify the customer usage to toggle the pin as PWM through pinmux.
thanks

@JerryChang
from devs:
" pins that are marked blue (so routed to 40-pin header) only has 3 PWM available pins
GPIO14 is not routed to this header
soldering to some SOC place is bad idea I guess
and FAN pin present on SOC is not clear for me"

hello Andrey1984,

that’s correct.

as you can see from the pinmux spreadsheet.
there shows the sample usage that pin-230/GPIO14 is used by baseboard FAN PWM.
you may used that if you’re having your own carrier board design.
thanks

@JerryChang
Thank you for following up!
What are the choices to use the devkit nx developers board with 4PWM, is it possible? how to rearrange the GPIO14 also address the FAN somehow?
After cfg got generated which are the further steps ?
Whuch files to move to where?
Which command to use for flashing?

@JerryChang
from devs [ they updated pinmux → cfg]
then flashed nx with flash.sh from sdkmanager folder
"
works for 2 PWM
on pins 32 and 33
tested with jetson-gpio
seems its not available to test PWM on FAN pin from it
as well as PWM on board pin 15 doesn’t work too"

hello Andrey1984,

if you don’t have fan, you can use that PWM for something else.

@JerryChang
Thank you for your response
we got the nx devkit
I am trying to assist remote dev to get 4PWM that is a fixed requirement.
However they were able to get only 2 PWM .
Will you be able to give a helping hand with getting all four somehow? Or at least 3 at the very beginning? What are the options to detach the fan from devkit NX without it getting burned overheated?