Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8026

Interfacing (DSI, CSI, I2C, etc.) • Re: raspberry pi 4B unable to activate both hardware pwm channels

$
0
0
both PWM channels are active, will dot digest your SW though.

this is for disabling HDMI audio

Code:

dtoverlay=vc4-kms-v3d,noaudio
and doesn't matter to PWM

EDIT:
as I have no idea what you're doing and how you're testing let me show you how I would
having the overlay loaded first check if the two PWM nodes got created

Code:

pi@cm4nanob:~ $ sudo cat /sys/kernel/debug/pwm0: platform/fe20c000.pwm, 2 PWM devices pwm-0   ((null)              ): period: 0 ns duty: 0 ns polarity: normal pwm-1   ((null)              ): period: 0 ns duty: 0 ns polarity: normalpi@cm4nanob:~ $ pinctrl get 12,1312: a0    pd | lo // GPIO12 = PWM0_013: a0    pd | lo // GPIO13 = PWM0_1
Now change to the folder for pwmchip0.

Code:

pi@cm4nanob:~ $ cd /sys/class/pwmpi@cm4nanob:/sys/class/pwm $ cd pwmchip0
As nothing has claimed them one will have to do this manually

Code:

pi@cm4nanob:/sys/class/pwm/pwmchip0 $ echo 0 > exportpi@cm4nanob:/sys/class/pwm/pwmchip0 $ echo 1 > exportpi@cm4nanob:/sys/class/pwm/pwmchip0 $ dirdeviceexportnpwm  power  pwm0  pwm1  subsystem  uevent  unexport
Now we have two PWM devices available.

Let's configure the first one and fire it up.

Code:

pi@cm4nanob:/sys/class/pwm/pwmchip0 $ cd pwm0pi@cm4nanob:/sys/class/pwm/pwmchip0/pwm0 $ echo 10000 > periodpi@cm4nanob:/sys/class/pwm/pwmchip0/pwm0 $ echo 6000 > duty_cyclepi@cm4nanob:/sys/class/pwm/pwmchip0/pwm0 $ echo 1 > enablepi@cm4nanob:/sys/class/pwm/pwmchip0/pwm0 $ sudo cat /sys/kernel/debug/pwm0: platform/fe20c000.pwm, 2 PWM devices pwm-0   (sysfs               ): requested enabled period: 10000 ns duty: 6000 ns polarity: normal pwm-1   (sysfs               ): requested period: 0 ns duty: 0 ns polarity: normal
as you can see PWM0 is active now, there is nothing for PWM1 so far.

Let's configure that as well and start it to.

Code:

pi@cm4nanob:/sys/class/pwm/pwmchip0/pwm0 $ cd /sys/class/pwm/pwmchip0/pwm1pi@cm4nanob:/sys/class/pwm/pwmchip0/pwm1 $ echo 5000 > periodpi@cm4nanob:/sys/class/pwm/pwmchip0/pwm1 $ echo 3000 > duty_cyclepi@cm4nanob:/sys/class/pwm/pwmchip0/pwm1 $ echo 1 > enablepi@cm4nanob:/sys/class/pwm/pwmchip0/pwm1 $ sudo cat /sys/kernel/debug/pwm0: platform/fe20c000.pwm, 2 PWM devices pwm-0   (sysfs               ): requested enabled period: 10000 ns duty: 6000 ns polarity: normal pwm-1   (sysfs               ): requested enabled period: 5000 ns duty: 3000 ns polarity: normal
as my oszillocope is showing me two PWM's (one with 100kHz and another with 200kHz) I consider this as closed for me.

Statistics: Posted by aBUGSworstnightmare — Tue Nov 11, 2025 6:00 am



Viewing all articles
Browse latest Browse all 8026

Trending Articles