GPIO configuration during image building using Yocto

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

GPIO configuration during image building using Yocto

跳至解决方案
5,833 次查看
ashoksowndar
Contributor II

Hi,

I have seen step to control gpio pins in various forum, all of them suggesting a common steps like

/ # echo 117 > /sys/class/gpio/export   --> this create a folder gpio117
/ # echo in > /sys/class/gpio/gpio117/direction

/ # echo 1 > /sys/class/gpio/gpio117/value

Here for creating of gpio117 after building the image. But I want to create the gpio117 before creating the build image using Yocto. 

Please help me with providing the above information?

If changes need to done in the device tree file, please provide a exact location of the file where can i find the device tree in my Yocto build with some example for i.MX 8M based SOM.

Thanks and Regards,

Ashok

0 项奖励
回复
1 解答
5,637 次查看
weidong_sun
NXP TechSupport
NXP TechSupport

Hi Ashok,

 Try these steps:

(1) The position of linux source
Let me take 4.14.98-2.2.0 for i.MX8QXPMEK as an example.
source code : build/tmp/work/imx8qxpmek-poky-linux/linux-imx/4.14.98-r0/git/
device tree: build/tmp/work/imx8qxpmek-poky-linux/linux-imx/4.14.98-r0/git/arch/arm64/boot/dts/freescale
device tree file: fsl-imx8mq-evk.dts

(2) Adding the GPIO you want to device tree
&iomuxc {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_hog>;

    imx8mq-evk {
        pinctrl_hog: hoggrp {
            fsl,pins = <
                MX8MQ_IOMUXC_NAND_READY_B_GPIO3_IO16        0x19
                MX8MQ_IOMUXC_NAND_WE_B_GPIO3_IO17        0x19
                MX8MQ_IOMUXC_NAND_WP_B_GPIO3_IO18        0x19
                MX8MQ_IOMUXC_SAI2_RXFS_GPIO4_IO21        0x19
            >;
        };
[comment]

GPIO4_IO21 ---> (4-1)x32+21 = 117  , which is  GPIO117
Above IOMUX of GPIO4_21 will use CPU pin "SAI2_RXFS"

(3) Recompiling kernel

# bitbake -c compile -f linux-imx

# bitbake -c deploy -f linux-imx

Have a nice day!

BR,

Weidong

在原帖中查看解决方案

0 项奖励
回复
3 回复数
5,638 次查看
weidong_sun
NXP TechSupport
NXP TechSupport

Hi Ashok,

 Try these steps:

(1) The position of linux source
Let me take 4.14.98-2.2.0 for i.MX8QXPMEK as an example.
source code : build/tmp/work/imx8qxpmek-poky-linux/linux-imx/4.14.98-r0/git/
device tree: build/tmp/work/imx8qxpmek-poky-linux/linux-imx/4.14.98-r0/git/arch/arm64/boot/dts/freescale
device tree file: fsl-imx8mq-evk.dts

(2) Adding the GPIO you want to device tree
&iomuxc {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_hog>;

    imx8mq-evk {
        pinctrl_hog: hoggrp {
            fsl,pins = <
                MX8MQ_IOMUXC_NAND_READY_B_GPIO3_IO16        0x19
                MX8MQ_IOMUXC_NAND_WE_B_GPIO3_IO17        0x19
                MX8MQ_IOMUXC_NAND_WP_B_GPIO3_IO18        0x19
                MX8MQ_IOMUXC_SAI2_RXFS_GPIO4_IO21        0x19
            >;
        };
[comment]

GPIO4_IO21 ---> (4-1)x32+21 = 117  , which is  GPIO117
Above IOMUX of GPIO4_21 will use CPU pin "SAI2_RXFS"

(3) Recompiling kernel

# bitbake -c compile -f linux-imx

# bitbake -c deploy -f linux-imx

Have a nice day!

BR,

Weidong

0 项奖励
回复
5,143 次查看
VinithNama
Contributor III

After adding the gpio in the device tree I'm deploying and building using  bitbake -c compile -f linux-imx bitbake -c deploy -f linux-imx after successful building of the kernel I am copying the image file and flashing through sdcard, After booting the board I'm checking the sys/class/gpio section for the pin which i have added, I'm unable to see the pin which i have updated in device tree.

Later I have exported the gpio pins using 

echo 88 > /sys/class/gpio/export


Then I can see the pin in gpio section as sys/class/gpio when I make the pin High and low and the pin as output I'm unable to see the voltage 3.3 at physical pin .

I'm using the J1003 EXP CN pins and

The exact pin is MX8MM_IOMUXC_SAI5_RXD3_GPIO3_IO24           0x19

In the dts file I have configured as

&iomuxc {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_hog>;

    imx8mm-evk {
        pinctrl_hog: hoggrp {
            fsl,pins = <

                     MX8MM_IOMUXC_SAI5_RXD3_GPIO3_IO24           0x19
             >;
        };

Can you please help me to find the solution for this

0 项奖励
回复
5,273 次查看
VinithNama
Contributor III

How do we choose the exact gpio and i'm planning to enable the iomux_sw_pad_ctl_pad_sai5_rxd3 and which address i can choose 

0 项奖励
回复