Hi,
Using some earlier guidance in the forum to set an overlay (dtoverlay=pwm-pio,gpio=18) in /boot/firmware/config.txt to use the PWM driver embedded in area sys/class/pwm/, I've tried the following to see if I can obtain a waveform on GPIO 18 but I've had no joy.
I used these command prompts but I'm seeing no response on the scope.
# Export PWM channel 0
echo 0 | sudo tee /sys/class/pwm/pwmchip0/export
# Set PWM period (e.g., 2 ms = 2,000,000 ns)
echo 2000000 | sudo tee /sys/class/pwm/pwmchip0/pwm0/period
# Set PWM duty cycle (e.g., 50% of period)
echo 1000000 | sudo tee /sys/class/pwm/pwmchip0/pwm0/duty_cycle
# Enable PWM output
echo 1 | sudo tee /sys/class/pwm/pwmchip0/pwm0/enable
Any ideas on what else needs configuring or why the expected waveform isn't appearing?
Using some earlier guidance in the forum to set an overlay (dtoverlay=pwm-pio,gpio=18) in /boot/firmware/config.txt to use the PWM driver embedded in area sys/class/pwm/, I've tried the following to see if I can obtain a waveform on GPIO 18 but I've had no joy.
I used these command prompts but I'm seeing no response on the scope.
# Export PWM channel 0
echo 0 | sudo tee /sys/class/pwm/pwmchip0/export
# Set PWM period (e.g., 2 ms = 2,000,000 ns)
echo 2000000 | sudo tee /sys/class/pwm/pwmchip0/pwm0/period
# Set PWM duty cycle (e.g., 50% of period)
echo 1000000 | sudo tee /sys/class/pwm/pwmchip0/pwm0/duty_cycle
# Enable PWM output
echo 1 | sudo tee /sys/class/pwm/pwmchip0/pwm0/enable
Any ideas on what else needs configuring or why the expected waveform isn't appearing?
Statistics: Posted by dannyboi — Thu Aug 07, 2025 12:46 pm — Replies 6 — Views 84