-
Notifications
You must be signed in to change notification settings - Fork 7.3k
drivers: pwm: Channel > 1 not working on rp2040 (Raspberry Pi Pico) #50876
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Did you test this on a few PWM channels to make sure that it works?
It took me a long time to figure out, why PWM doesn't work. Even the "samples" don't work on a RPi Pico. I testet Pin 2 (with a scope) and Pin 25 (onboard LED). And if you just look at valid parameters for "pwm_set_chan_level" it's clear the "full" channel number (2, 25) cannot work. |
39c71c5
to
f8cbd69
Compare
I just realised, I used my work email. And I didn't sign-off the commit. It is fixed (I hope) in the force-push. |
pwm_set_chan_level uses slice channels A(=0) or B(=1) and not Zephyr channel (0..15). So PWM doesn't work for channels > 1. There is already a function (pwm_rpi_channel_to_pico_channel) which does the right thing, but it isn't used for pwm_set_chan_level. Signed-off-by: Jan Hilsdorf <[email protected]>
f8cbd69
to
5351c58
Compare
Sorry, another force push, to get the compliance checks fixed. I'm really sorry. |
Don't worry, we all do that :) |
I tested it successfully on two pins (2 and 25). If you want, I can try it on all available pins (maybe except one pair of UART pins). |
A few random pins should be fine |
pwm_set_chan_level uses slice channels A(=0) or B(=1) and not Zephyr channel (0..15). So PWM doesn't work for channels > 1. There is already a function (pwm_rpi_channel_to_pico_channel) which does the right thing, but it isn't used for pwm_set_chan_level.