Please help unable to generate PWM on AGX orin, it shows A 50MHz sine wave always on oscilloscope

#!/usr/bin/env python

# Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.

import RPi.GPIO as GPIO
import time

output_pins = {
    'JETSON_XAVIER': 18,
    'JETSON_NANO': 33,
    'JETSON_NX': 33,
    'CLARA_AGX_XAVIER': 18,
    'JETSON_TX2_NX': 32,
    'JETSON_ORIN': 18,
    'JETSON_ORIN_NX': 33,
    'JETSON_ORIN_NANO': 33
}
output_pin = output_pins.get(GPIO.model, None)
if output_pin is None:
    raise Exception('PWM not supported on this board')


def main():
    # Pin Setup:
    # Board pin-numbering scheme
    GPIO.setmode(GPIO.BOARD)
    # set pin as an output pin with optional initial state of HIGH
    GPIO.setup(output_pin, GPIO.OUT, initial=GPIO.HIGH)
    p = GPIO.PWM(output_pin, 1000)
    val = 50
    incr = 5
    p.start(val)

    print("PWM running. Press CTRL+C to exit.")
    try:
        while True:
            time.sleep(1.0)
    finally:
        p.stop()
        GPIO.cleanup()

if __name__ == '__main__':
    main()

This is the code I am using, I am on AGX orin 64gb devkit and jetpack version 6.2.2, I have checked everything is configured correctly. Also, if I use normal GPIO pins such as 31 and jetgpio library, I can generate correct wave. All of the pins are correctly configured also. Any idea? It always shows 50 Mhz sine wave and does not stop even if I stop programm, but If I remove jumper and insert agan the sine wave stops. is it some EMI interference?

*** Please note that this reply is generated by LLM automatically ***

Based on the provided information, it appears that you are experiencing issues with generating a sine wave using the Jetson AGX Orin 64GB devkit and Jetpack version 6.2.2. You have checked that everything is configured correctly, and you can generate a correct wave using normal GPIO pins such as 31 and the jetgpio library.

However, when using the specific pins for the sine wave generation, you are experiencing issues. The sine wave always shows 50 MHz and does not stop even if you stop the program. If you remove the jumper and insert it again, the sine wave stops.

There are a few possible explanations for this behavior:

  1. EMI Interference: As you mentioned, it’s possible that there is EMI (Electromagnetic Interference) interference affecting the signal. This could be due to various factors such as nearby electronic devices, cables, or other sources of electromagnetic radiation. To mitigate this, you can try using shielding or filtering techniques to reduce the EMI interference.
  2. Pin Configuration: Although you mentioned that the pins are correctly configured, it’s possible that there is an issue with the pin configuration or the signal routing. Double-check the pin configuration and ensure that the signals are properly routed to the correct pins.
  3. Signal Integrity: The signal integrity of the sine wave generation circuit might be compromised. This could be due to various factors such as signal attenuation, noise, or impedance mismatch. Check the signal integrity by using an oscilloscope to measure the signal quality.
  4. Software Issue: There might be a software issue that is causing the sine wave generation to malfunction. Check the code and ensure that it is correctly implemented. Also, try using a different software or library to generate the sine wave to rule out any software-related issues.
  5. Hardware Issue: There might be a hardware issue with the Jetson AGX Orin 64GB devkit or the surrounding circuitry. Check the hardware and ensure that it is functioning correctly.

To troubleshoot the issue, you can try the following:

  1. Use an Oscilloscope: Use an oscilloscope to measure the signal quality and integrity of the sine wave generation circuit.
  2. Check the Pin Configuration: Double-check the pin configuration and ensure that the signals are properly routed to the correct pins.
  3. Try a Different Software or Library: Try using a different software or library to generate the sine wave to rule out any software-related issues.
  4. Check for EMI Interference: Check for EMI interference and try using shielding or filtering techniques to reduce the EMI interference.
  5. Consult the Documentation: Consult the Jetson AGX Orin 64GB devkit documentation and the Jetpack version 6.2.2 documentation to ensure that you are using the correct configuration and settings.

By following these steps, you should be able to identify and resolve the issue with the sine wave generation on the Jetson AGX Orin 64GB devkit.

*** Please give the thumbs up if you get answers you like. Or provide feedback to help us improve the answer. ***

I am already using oscilloscope to check, but I am unable to get output and also I am not trying to make sine wave I am trying to make square wave but getting sine wave.

Hi chaudharyyash2004,

Do you mean PIN31 can output PWM signal as expected but not for PIN15/18/13 on the AGX Orin devkit?

What jumper are you using?

Please share the result of the following command on your board.

$ cat /etc/nv_tegra_release
$ cat /etc/nv_boot_control.conf

Yes pin 31 was able to output correct signal but not PWM pin(18/13/15).

synra@ubuntu:~$  cat /etc/nv_tegra_release
# R36 (release), REVISION: 5.0, GCID: 43688277, BOARD: generic, EABI: aarch64, DATE: Fri Jan 16 03:50:45 UTC 2026
# KERNEL_VARIANT: oot
TARGET_USERSPACE_LIB_DIR=nvidia
TARGET_USERSPACE_LIB_DIR_PATH=usr/lib/aarch64-linux-gnu/nvidia

synra@ubuntu:~$ cat /etc/nv_boot_control.conf
TNSPEC 3701-501-0005-G.0-1-1-jetson-agx-orin-devkit-
COMPATIBLE_SPEC 3701--0005--1--jetson-agx-orin-devkit-
TEGRA_BOOT_STORAGE nvme0n1
TEGRA_CHIPID 0x23
TEGRA_OTA_BOOT_DEVICE /dev/mtdblock0
TEGRA_OTA_GPT_DEVICE /dev/mtdblock0

I am using a bnc cable with female jumper wire ends.

Is there any stable jetpack for this, 6.2.2 released recently so I have doubts about bugs.

There is no update from you for a period, assuming this is not an issue anymore.
Hence, we are closing this topic. If need further support, please open a new one.
Thanks
~0408

Okay, we will locally verify if PWM is working with Jetpack 6.2.2(r36.5).

Could you also verify if there’s the issue with Jetpack 6.2.1(r36.4.4)?

Sorry that I’m not clear about this.
Could you simply connect pwm5(PIN18 of 40 pins header) to the scope to check its signal output?