How to use PWM perpherial output a single controllable square wave in orin nano?

I used the orin nano’s pwm output to drive the buzzer to play music and it worked fine with no issues. But there is really no way for me to make pwm output an independent waveform (non-periodic output) in CCPLX (Linux) side. As long as the pwm peripheral is enabled, it will continue to output waveforms, that do not meet my need.

So, How to use pwm output a square wave (non-periodic output) with a duty cycle of 14% and a frequency of 500khz? just one signal wave.

Hi HeapCorrupt,

Are you using the devkit or custom board for Orin Nano?
What’s your Jetpack version in use?

Do you mean that you want to condifure the duty cycle for your PWM?
If so, you could refer to the following thread for this use case.
Strange behaviour with Jetson Nano DevKit PWM signal - #5 by WayneWWW

(20000 for period, 2800 for duty_cycle)

Hi @KevinFFF

I am use Official development board jetson-orin-nano-devkit, Jetpack = 35.4.1.


What I want to do is like this, pwm frequency = 500Khz, and duty be adjustable for encode as logic 0 and logic 1, to dirver the 1-wire bus LEDs(like ws2812).

It seems the 45% duty cycle reflecting it to be 1, and 14% duty cycle reflecting it to be 0 so that you could just configure the duty cycle for your use case.


The problem I am encountering is that the pwm peripheral of nvidia orin nano does not support such output.

Once the pwm is enabled, the pwm waveform will be continuously output.

What I need is to set a 45% duty cycle to output a waveform, send and stop, and then set a 14% duty cycle to output, send and stop.

What output do you mean that Orin Nano could not?

Could you use sysfs to control and configure the pwm?

Have you tried to echo 0 to stop pwn output?

Hi @KevinFFF

It’s true use that command can stop pwm. The new issue comes out.

The logic 0 and logic 1 are at uS level, so I need a delay API at the uS(microsecond) level to control the delay then stop the PWM peripherals. Currently, NVIDIA does not have such an API for users to use.

If you have the requirement to control pwm continuously, I would not suggest using sysfs to control them.

Please refer to GitHub - NVIDIA/jetson-gpio: A Python library that enables the use of Jetson's GPIOs for your use case.


Yes, I’ve used jetson-gpio before I come to ask the question.

The reason is the jetson-gpio does not has API to output a single pwm wave. Once the pwm is enabled, the pwm waveform will be continuously output.

There is no way to control the number of output waveforms, such as outputting only one square wave at a time.

Yes, it seems no API for this use case.
For more advanced use case, it is recommended that the user modify the gpio pin register directly through a c program.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.