Hi @FFont.1 ,
Ok thank you, I thought that you did not have the entire folder pwm.
To have the folder pwmchipx inside the folder /sys/class/pwm, you have to configure and enable a timer in your dts.
In this timer, you must define a child node pwm and set its pins.
https://wiki.st.com/stm32mpu/wiki/TIM_device_tree_configuration#DT_configuration
I looked at the DTS that you sent and I have the impression that you enabled timers1 for that purpose:
&timers1 {
/* spare dmas for other usage */
/delete-property/dmas;
/delete-property/dma-names;
status = "okay";
pwm1: pwm {
pinctrl-0 = <&pwm1_pins_a>;
pinctrl-1 = <&pwm1_sleep_pins_a>;
pinctrl-names = "default", "sleep";
status = "okay";
};
timer@0 {
status = "okay";
};
};
You have set the pwm pinctrl to pins a.
But your pinctrl settings in stm32mp15-pinctrl.dtsi are weird:
pwm1_pins_a: pwm1-0 {
pins {
pinmux = <STM32_PINMUX('A', 15, AF1)>,
<STM32_PINMUX('H', 6, AF1)>;
bias-pull-down;
drive-push-pull;
slew-rate = <0>;
};
};
pwm1_sleep_pins_a: pwm1-sleep-0 {
pins {
pinmux = <STM32_PINMUX('A', 15, ANALOG)>,
<STM32_PINMUX('H', 6, ANALOG)>;
};
};
If you look at the datasheet of the STM32MP157F, page 94: https://www.st.com/resource/en/datasheet/stm32mp157c.pdf
PA15 AF1 is not related to timers 1, but to TIM2
and
PH6 AF1 is not existing:
So it can't work.
I tested on my 157F-DK2 and as an example, I succeeded to have the content of /sys/class/pwm/ by configuring the timers8.
Since on my board the pin PC7 is available, I added a pwm pinmux into my pinctrl "stm32mp15-pinctrl.dtsi" :
pwm8_pins_b: pwm8-1 {
pins {
pinmux = <STM32_PINMUX('C', 7, AF3)>; /* TIM8_CH2 */
bias-pull-down;
drive-push-pull;
slew-rate = <0>;
};
};
pwm8_sleep_pins_b: pwm8-sleep-1 {
pins {
pinmux = <STM32_PINMUX('C', 7, ANALOG)>; /* TIM8_CH2 */
};
};
Because PC7 AF3 is dedicated to TIM8:
Then I configured the timers8 in stm32mp157f-dk2.dts to use these pins in its subnode pwm:
&timers8 {
status = "okay";
dmas = <&dmamux1 47 0x400 0x80000001>;
dma-names = "ch1";
pwm {
pinctrl-0 = <&pwm8_pins_b>;
pinctrl-1 = <&pwm8_sleep_pins_b>;
pinctrl-names = "default", "sleep";
status = "okay";
};
};
Once you are on the board, you can check if the pin is well claimed by viewing the content of:
cat /sys/kernel/debug/pinctrl/soc\:pin-controller@50002000/pinmux-pins | grep "timer"
It gives me:
pin 39 (PC7): device 44001000.timer:pwm function af3 group PC7
Which confirms that it worked.
Now you can verify the content of your folder:
root@stm32mp1:~# ls /sys/class/pwm/
pwmchip0
root@stm32mp1:~# ls /sys/class/pwm/pwmchip0/
device export npwm power subsystem uevent unexport
Done!
Hope it helps you,
Regards,
Kevin
In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'