HI
Can I make a 25MHz PWM signal?
Currently, only up to 72khz is set.
This is the script I am using.
echo "PWM : $1 Hz"
period=$((1000000000 / $1))
duty=$(($period / 2))
if [ ! -d /sys/class/pwm/pwmchip0/pwm0 ] ; then
echo 0 | sudo tee -a /sys/class/pwm/pwmchip0/export > /dev/null; sleep 0.5
fi
echo $period | sudo tee -a /sys/class/pwm/pwmchip0/pwm0/period > /dev/null; sleep 0.1
echo $duty | sudo tee -a /sys/class/pwm/pwmchip0/pwm0/duty_cycle > /dev/null; sleep 0.1
echo 1 | sudo tee -a /sys/class/pwm/pwmchip0/pwm0/enable > /dev/null
Best Regards
hello soo_HyundaiMnSoft,
please customize the pinmux spreadsheet to configure the PWM.
please refer to TX2 Configuring Pinmux GPIO and PAD for the documentation.
thanks
hi JerryChang
I know the pin setting.
The PWM clock is also checked.
However, I would like to check if the clock is up to 25Mhz in spec.
thanks.
Hi soo_HyundaiMnSoft,
Based on “Tegra X2 (Parker Series SoC) Technical Reference Manual” (Chapter 40), there are 8 PWMs available for the TX2
In the image attached, you can see the frequency ranges supported for each PWM. The maximum rate you can get is 400 kHz for GP_PWM6-GP_PWM7. However those are not exposed at user space level, only the GP_PWM1-GP_PWM4 are available in ‘’‘/sys/class/pwm/’‘’.
In this chapter the following is specified:
- CLK_M (19.2 MHz) or PLLP/4 (102 MHz) are the clock sources available for the PWM controllers
- PWM clock frequency is divided by 256.
- Frequency division is a 13-bit programmable value.
So, if the PWM uses a 102 MHz source clock and this frequency is divided by 256, the maximum output you can reach is ~400 kHz.
Find examples about how to control PWMs here:
Regards,
2 Likes