How to come up with a Duty cycle for PWM pin

I’ll please like to know how I can express the duty_cycle value as a number in nano seconds based on its percentage while using the standard PWM commands below, for a pin enabled as PWM

echo 0 > /sys/devices/7000a000.pwm/pwm/pwmchip0/export (to use PWM0)
echo 48000 > /sys/devices/7000a000.pwm/pwm/pwmchip0/pwm0/period (set a period of 48000 ns)
echo *** > /sys/devices/7000a000.pwm/pwm/pwmchip0/pwm0/duty_cycle (set duty_cycle as this value *** in nano sec)
echo 1 > /sys/devices/7000a000.pwm/pwm/pwmchip0/pwm0/enable (to enable the PWM signal)

For example if I want a value of say 78% duty cycle, how can I get a corresponding value in nano seconds. Is there a reference for what the maximum duty_cycle value should be in nano second in a document that I can refer to? I believe the value should be on the same order of magnitude as the period which currently 48000 ns, i.e a fraction of it (0 - 99 %)

Thanks in advance

Hi sgamu,

I have seem the PWM working on TX2, here is a guide about enabling PWM:

The process may be similar in Jetson Nano.

Greivin F.

Thank you so much Greivin F.