Hi, I am trying to access a specific channel, channel 5 of the PWM1 output from flex_timer_1 on the S32G274. I am not sure what values to use on the command line or settings in the dts file in order to obtain an output?
In my dts file, I have the following:
已解决! 转到解答。
Thank you for the assistance so far. After reviewing the examples and delving into the links, I saw that I am doing pretty much the same thing as the example for imx8mmn-nitrogen8mm.dtsi example. I did notice that if I do the following command, "echo 4 > /sys/class/pwm/pwmchip0/export," I do see "/sys/class/pwm/pwmchip0/pwm4." But I am still not sure how to set the channel in the dts file?
Also, with pin 80 set for PWM5 output through the dts file pinmux, I still do not see any PWM on the output pin either.
Do I have to create a "PWM5" entry in the dts file for channel 5 of the PWM? If so, would I have to clone parameters from PWM1 in the s32cc.dtsi file? Is there an example of this? I could not find anything is my extensive search online.
Thanks again.
Thank you for the assistance so far. After reviewing the examples and delving into the links, I saw that I am doing pretty much the same thing as the example for imx8mmn-nitrogen8mm.dtsi example. I did notice that if I do the following command, "echo 4 > /sys/class/pwm/pwmchip0/export," I do see "/sys/class/pwm/pwmchip0/pwm4." But I am still not sure how to set the channel in the dts file?
Also, with pin 80 set for PWM5 output through the dts file pinmux, I still do not see any PWM on the output pin either.
Do I have to create a "PWM5" entry in the dts file for channel 5 of the PWM? If so, would I have to clone parameters from PWM1 in the s32cc.dtsi file? Is there an example of this? I could not find anything is my extensive search online.
Thanks again.
I found the problem. It was the wrong channel assignment. Note, for channel PWM5, use:
echo 5 > /sys/class/pwm/pwmchipio/export. I was using channel 4 since the PWM starts with one apparently and not with zero.
If in your kernel driver, the setting would be pwm_device = pwm_request(<channel number>, <pwm_chip>). So, for example, to obtain channel 5 with PWM0 enabled, it would be:
struct pwm_device *my_pwm_device;
my_pwm_device = pwm_request(5, pwmchip0);
Thanks for the help.
Hi @Tony-FM-Eng,
Thank you for contacting NXP Support.
It seems that the configurations are correct.
Could you please share the output of the following commands?
ls /sys/class/pwm/
ls /sys/class/pwm/pwmchip0/
ls /sys/class/pwm/pwmchip0/pwm1
Please try it and send me the outputs.
Have a great day!
Thanks for the reply. Here are the following outputs to the commds:
# ls /sys/class/pwm
pwmchip0
# ls /sys/class/pwm/pwmchip0
device export npwm power pwm1 subsystem uevent unexport
# ls /sys/class/pwm/pwmchip0/pwm1
capture duty_cycle enable period polarity power uevent
Let me know if you require any additional information.
Hi @Tony-FM-Eng,
Thank you very much for your response.
Based on your reply and your steps described on your question, Linux can interface correctly PWM driver.
However, it seems that you are missing a Kernel configuration to properly set up the PWM.
I couldn't find any specific manual for the S32G to enable PWM but please have a look to the following community thread of i.MX8MM Solved: Q: What is the preocedure to Enable PWM on imx8mm-evk? - NXP Community.
Please check and tell me if you have any questions or comments.