Quantcast
Viewing all articles
Browse latest Browse all 6084

Advanced users • Re: Pi5 - PWM on GPIO 18

I bailed on the stock dtoverlay pretty quickly since it doesn't seem to do anything much at all.

The following - I think - enables rp1_pwm0 and sets up each of the pins into the correct alt modes (confirmed after boot with pinctrl), but still no dice:

Code:

/dts-v1/;/plugin/;/{compatible = "brcm,bcm2712";fragment@0 {target = <&rp1_gpio>;__overlay__ {pwm_pins: pwm_pins {pins = "gpio12", "gpio13", "gpio18", "gpio19";function = "pwm0", "pwm0", "pwm0", "pwm0";};};};fragment@1 {target = <&rp1_pwm0>;frag1: __overlay__ {pinctrl-names = "default";pinctrl-0 = <&pwm_pins>;status = "okay";};};};
Is there some missing clock config or other confounding factor. PWM must be working in some capacity, or the cooling fan wouldn't work, right?

Bonus weirdness, PWM0 reports four PWMs but only lets me used three channels:

Code:

$ cat /sys/class/pwm/pwmchip2/npwm 4$ echo "3" | sudo tee -a /sys/class/pwm/pwmchip2/export 3tee: /sys/class/pwm/pwmchip2/export: Device or resource busy$ ls /sys/class/pwm/pwmchip2/device  export  npwm  power  pwm0  pwm1  pwm2  subsystem  uevent  unexport
This is especially interesting since that's the channel the fan uses...

AAH!

I was assuming the newly added pwmchip2 would be PWM0, but it's actually PWM1... *sigh*... is there actually any way to know this at runtime!?

Looks like it can kinda be...

Code:

$ ls /sys/class/pwm/pwmchip2/device/consumer:platform:cooling_fan  driver  driver_override  modalias  of_node  power  pwm  subsystem  supplier:platform:1f00018000.clocks  uevent

Statistics: Posted by gadgetoid — Wed Mar 06, 2024 1:35 pm



Viewing all articles
Browse latest Browse all 6084

Trending Articles