*** Please note that this reply is generated by LLM automatically ***
To set the initial state of the PWM signal to a high level on the Jetson Orin NX, you need to configure the pinmux settings and the PWM controller. Here’s a step-by-step guide to help you achieve this:
-
Pinmux Configuration: As you’ve already done, set the Req Initial State in the Pinmap config to Drive 1. This will configure the pin to output a high level when the PWM signal is not active.
-
PWM Controller Configuration: The PWM controller on the Jetson Orin NX is controlled by the Linux kernel’s PWM subsystem. To set the initial state of the PWM signal to a high level, you need to configure the PWM controller to output a high level when the PWM signal is not active.
You can do this by setting the pwm_polarity attribute of the PWM device to 1 (active high). You can use the devmem command to set this attribute.
For example, if the PWM device is /sys/class/pwm/pwmchip0/pwm0, you can set the pwm_polarity attribute to 1 using the following command:
echo 1 > /sys/class/pwm/pwmchip0/pwm0/pwm_polarity
Alternatively, you can use the pwmconfig command to configure the PWM controller. For example:
pwmconfig pwmchip0 pwm0 polarity 1
- PWM Signal Configuration: Once you’ve configured the PWM controller, you need to configure the PWM signal to output a high level when the PWM signal is not active. You can do this by setting the
pwm_duty_cycle attribute of the PWM device to 100% (maximum duty cycle).
For example, if the PWM device is /sys/class/pwm/pwmchip0/pwm0, you can set the pwm_duty_cycle attribute to 100% using the following command:
echo 100 > /sys/class/pwm/pwmchip0/pwm0/pwm_duty_cycle
Alternatively, you can use the pwmconfig command to configure the PWM signal. For example:
pwmconfig pwmchip0 pwm0 duty_cycle 100
- Verify the PWM Signal: Once you’ve configured the PWM controller and the PWM signal, you can verify that the PWM signal is outputting a high level when the PWM signal is not active. You can use a logic analyzer or an oscilloscope to verify the PWM signal.
Comparison with Other Methods:
- Using the
gpio command: You can also use the gpio command to set the initial state of the PWM signal to a high level. For example:
gpio -g pwm 13 1
However, this method only sets the initial state of the PWM signal and does not configure the PWM controller or the PWM signal.
- Using the
pwmconfig command: The pwmconfig command is a more comprehensive way to configure the PWM controller and the PWM signal. It allows you to set the PWM frequency, duty cycle, and polarity, as well as configure the PWM controller to output a high level when the PWM signal is not active.
In summary, to set the initial state of the PWM signal to a high level on the Jetson Orin NX, you need to configure the pinmux settings, the PWM controller, and the PWM signal. You can use the devmem command, the pwmconfig command, or the gpio command to achieve this. However, the pwmconfig command is the most comprehensive way to configure the PWM controller and the PWM signal.
*** Please give the thumbs up if you get answers you like. Or provide feedback to help us improve the answer. ***