I’m struggling to get PWM2A functioning on Debian bookworm with kernel 5.10.168-r76 minimal install.
If I use the command gpioinfo, the system gives me line 22: "P8_19 [ehrpwm2a]" unused output active-high so it seems like the PWM is indeed set up correctly. As I understand things, the PWM2 is set up by default when loading the linux image.
I have access to the PWM settings in /dev/bone/pwm/2/a, however, when I echo 1 > /dev/bone/pwm/2/a/enable I do not get any output.
This pwm output is hooked in to a simple piezo buzzer. I know that the buzzer is functional because if I do gpioset gpiochip0 22=1 I get a “tick” sound out of my buzzer.
My question is: what am I missing? It seems like I have a PWM set up, the pin itself is functional, but the PWM enable command doesn’t trigger an output.
and then write to the dev/pwm/ehrpwm2a file locations
EDIT:
I believe you need to set the Period and Duty Cycle before you Enable.
For example:
echo 0 > /dev/pwm/ehrpwm2a/enable #Disable just In Case
echo 10000 > /dev/pwm/ehrpwm2a/period #period in ns
echo 1000 > /dev/pwm/ehrpwm2a/duty_cycle #again, in ns
echo 1 > /dev/pwm/ehrpwm2a/enable #turn on
Sets the period to 10us with a duty cycle of 10%
We use pin 8.45 for pwm2a though, so it’s not quite identical to your use case.
Looks like they forgot the 2 uarts. More that I look at it, it appears all they did was scrape some website. Assumed some “magic” might be working but, not.