As part of the development of a custom board, I would like to use pin 66 of the Verdin AM62 board as a PWM. Despite several attempts, I have been unable to obtain /sys/class/pwm/pwmchip1 to export the desired PWM.
I am attaching the device tree configuration we are using. It is based on the “k3-am62-verdin.dtsi” file. Could you help me with the declaration of pin 66?
Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!
Did you like my answer?
Hello Arthur,
Thank you for reaching out with your question about configuring pin 66 as a PWM on the Verdin AM62. Let’s go through the steps to ensure your device tree is set up correctly for this purpose.
Identify the Correct PWM Controller and Pin Mapping:
First, confirm which PWM controller is associated with pin 66. This information is typically available in the SoC’s reference manual or pinmuxing guide.
Ensure that pin 66 can be configured as a PWM output.
Modify the Device Tree:
Open the device tree source file, such as k3-am62-verdin.dtsi, where the pin configuration is defined.
Add or modify the node for the PWM controller to include pin 66. This involves setting the correct pin function and muxing options.
Here is an example snippet for a PWM node in the device tree:
&pwm1 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_pwm1>;
};
&pinctrl_pwm1 {
pinmux = <PIN_66_MUX_OPTION>;
/* Replace PIN_66_MUX_OPTION with the actual mux option for PWM */
};
Ensure the status property is set to “okay” to enable the PWM controller.
Recompile and Deploy the Device Tree:
After making the necessary changes, recompile the device tree to generate the updated device tree blob (DTB).
Deploy the new DTB to your Verdin AM62 board.
Verify PWM Interface in Sysfs:
Once the board is booted with the updated device tree, check for the PWM interface in /sys/class/pwm/.
You should see directories like pwmchipX where you can export and configure the PWM channels.
Troubleshooting:
If the PWM interface is still not visible, double-check your device tree modifications for any errors.
Ensure that the kernel has PWM support enabled for your specific SoC.
By following these steps, you should be able to configure pin 66 as a PWM on the Verdin AM62. If you encounter any issues, reviewing the pinmuxing options and ensuring the correct PWM controller is targeted will be crucial.
Best regards,
Toradex AI Assistant
Please, also check if these links can help you solve your problem:
1: Check if any overlays are being applied: Ensure that no overlays are affecting the configuration of pin 66.
2: Verify alternate functions: According to the Verdin AM62 datasheet, pin 66 has alternate functions like SPI0 and CP_GEMAC_CPTS0_HW1TSPUSH. These alternate functions need to be disabled in your Device Tree Source (DTS) file. Make sure they are not enabled by any overlay.
If this is not what you see, please try to compare your device tree changes with the following snippet, which was enough to enable PWM on SODIMM_66 on my tests:
If you have both PWM controllers available, then your device tree should be correct.
To then use PWM, the pin needs to be exported. Please check the following documentation for more information: How to Use PWM on Torizon OS | Toradex Developer Center
You can skip the docker run command as it is Torizon OS-specific.
Indeed, an overlay was blocking access to the PWM. After removing it, I now have access to PWM pin 66. I can export it, set the parameters, and enable it.
Please double-check your oscilloscope configuration, maybe the trigger level is incorrect.
These are 1.8V signals.
I tested this here with PWM_1 (SODIMM_15) and it worked as expected.
The following examples are always using a period of 45000.
Can you try to reproduce these results with PWM_1 in a Verdin Development Board using the Toradex Reference Multimedia Image 6.8.1?
This way we can confirm that the measurement of the signal is correct and try to investigate what may be causing the problem.