Generating PWM in Wandboard Quad

This is the place for software discussions not having a dedicated subforum

Generating PWM in Wandboard Quad

Postby Must_ba » Thu Jan 19, 2017 11:33 pm

Hi;
I want to generate PWM in my wandboard quad and i found some documentation about exporting PWM's with linux user command line like ;

echo 0> /sys/class/pwm/pwmchip3....../export

then the duty cycle and period is adjusted with

echo 1000000 > /sys/class/pwm/......./pwm0/period

My question is, in my system the pwm file doest'n exist in the /sys/class .. so I can't control the pwm's and In my /sys/kernel/debug/ file I can see the pwm's adresses and other things about pwm information .

sys-class.png
sys-class.png (236.44 KiB) Viewed 444 times


Second thing I tried to recompile the dtb file for access the pwm's by changing the imx6q-wandboard.dtsi . In that attempt was failed again :cry:
Screenshot from 2017-01-19 23-26-39.png
Screenshot from 2017-01-19 23-26-39.png (210.24 KiB) Viewed 444 times



Can you give me any idea about how to solve this problem ?

Thanks...
Must_ba
 
Posts: 22
Joined: Thu Jan 19, 2017 11:07 pm

Re: Generating PWM in Wandboard Quad

Postby Richard » Wed Feb 08, 2017 8:15 am

Hello, Must_ba:

I check the device tree file of wandboard, the PWM nodes are marked.
It needs to modify the device tree file of wandboard to get PWM work.

The available PWM pins are SD4_DAT1 and SD4_DAT2. (SD4_DAT1 is for PWM3, and SD4_DAT2 is for PWM4).
Then, remove the backlight driver for PWM to prevent from that backlight driver controls PWMs.

The modification is as follows:
Code: Select all
diff --git a/arch/arm/boot/dts/imx6qdl-wandboard.dtsi b/arch/arm/boot/dts/imx6qdl-wandboard.dtsi
index 5244e95..60713b6 100644
--- a/arch/arm/boot/dts/imx6qdl-wandboard.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-wandboard.dtsi
@@ -169,20 +169,6 @@
       status = "okay";
    };
 
-   backlight_lcd {
-      compatible = "pwm-backlight";
-      pwms = <&pwm1 0 5000000>;
-      brightness-levels = <0 4 8 16 32 64 128 255>;
-      default-brightness-level = <7>;
-   };
-
-   backlight_lvds {
-      compatible = "pwm-backlight";
-      pwms = <&pwm4 0 5000000>;
-      brightness-levels = <0 4 8 16 32 64 128 255>;
-      default-brightness-level = <7>;
-   };
-
    v4l2_cap_0 {
       compatible = "fsl,imx6q-v4l2-capture";
       ipu_id = <0>;
@@ -423,25 +409,17 @@ reference manual.
    status = "okay";
 };
 
-#if 0
-&pwm1 {
-   pinctrl-names = "default";
-   pinctrl-0 = <&pinctrl_pwm1_1>;
-   status = "okay";
-};
-
 &pwm3 {
    pinctrl-names = "default";
-   pinctrl-0 = <&pinctrl_pwm3_2>;
+   pinctrl-0 = <&pinctrl_pwm3_1>;
    status = "okay";
 };
 
 &pwm4 {
    pinctrl-names = "default";
-   pinctrl-0 = <&pinctrl_pwm4_2>;
+   pinctrl-0 = <&pinctrl_pwm4_1>;
    status = "okay";
 };
-#endif
 
 &spdif {
         pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index 95bd7b1..878e3ab 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -1467,6 +1467,14 @@
       };
    };
 
+   pwm4 {
+      pinctrl_pwm4_1: pwm4grp-1 {
+         fsl,pins = <
+            MX6QDL_PAD_SD4_DAT2__PWM4_OUT 0x1b0b1
+         >;
+      };
+   };
+
    spdif {
       pinctrl_spdif_1: spdifgrp-1 {
          fsl,pins = <

Then, you need to make a patch and apply this patch in the linux-wandboard_3.10.17.bb as the following link.
http://www.yoctoproject.org/docs/2.1/kernel-dev/kernel-dev.html#applying-patches
I don't try this in practice. I hope it works for you.

BR,

Richard
Richard
Site Admin
 
Posts: 136
Joined: Tue Dec 17, 2013 6:57 am

Re: Generating PWM in Wandboard Quad

Postby snehapinky » Thu Jul 13, 2017 11:08 am

available in dual- and quad-core models. ... The RIoTboard features a variety of expansion interfaces including GPIO, I2C, SPI, and PWM.
snehapinky
 
Posts: 1
Joined: Thu Jul 13, 2017 11:05 am


Return to Software - General

Who is online

Users browsing this forum: No registered users and 3 guests