iMX6sx configure GPIO2_IO16

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

iMX6sx configure GPIO2_IO16

1,928件の閲覧回数
abelussi
Contributor III

On my Demoboard imx6sx-sabre, I want to use the GPIO2_IO16 as a simply input/output, and control it by my 'C' program under Linux

I know that I have to create a patch to the imx6sx-sdb.dtsi file , but is not clear has to put and setting the "MX6SX_PAD_KEY_ROW1__GPIO2_IO_16" in this file.

Someone can explain me which setting I have to do in the .dtsi file

Is there an example in 'C' source code to manage it ?

Thanks in advanced

ラベル(1)
0 件の賞賛
返信
4 返答(返信)

1,599件の閲覧回数
diegoadrian
NXP Employee
NXP Employee

Hello

I really helpful tool that could help you modifying the dtb, is the i.mx pinmux tool.

This tool can throw you the .dts file only by selecting the pin that you are willing to use.

For example, configuring the PIN E18 of the i.MX6SX as GPIO2_IO16, throws you this C code configuration.

/dts-v1/;

#include "skeleton.dtsi"
#include "imx6sx-pinfunc.h"

/ {
    model = "Freescale i.MX 6SoloX User Board";
    compatible = "fsl,imx6sx-board", "fsl,imx6sx";

    soc {
        #address-cells = <1>;
        #size-cells = <1>;

        iomuxc: iomuxc@020e0000 {
            compatible = "fsl,imx6sx-iomuxc";
            reg = <0x020e0000 0x4000>;
        };
    };
};

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

    imx6sx-board {

        BOARD_InitPins: BOARD_InitPinsgrp {                /*!< Function assigned for the core: Cortex-A9[ca9] */
/*
 * TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
BOARD_InitPins:
- options: {callFromInitBoot: 'false', coreID: ca9}
- pin_list:
  - {pin_num: E18, peripheral: GPIO2, signal: 'io, 16', pin_signal: KEY_ROW1}
 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
 */
            fsl,pins = <
                MX6SX_PAD_KEY_ROW1__GPIO2_IO_16            0x000010B0
            >;
        };

    };
};

Hope this can solve your problem.

Best regards,

Diego.

0 件の賞賛
返信

1,599件の閲覧回数
abelussi
Contributor III

Thanks Cuevas

I follow your suggestion and it works....   

I test it by the following command:

         echo 48 > /sys/class/gpio/export

         sudo echo "out" > /sys/class/gpio/gpio48/direction

         echo 1 > /sys/class/gpio/gpio48/value

But if I want to control this pin by kernel , by my 'C' source code .

I have to use a library or could I access it directly ?

Thanks in advanced

0 件の賞賛
返信

1,599件の閲覧回数
diegoadrian
NXP Employee
NXP Employee

Hello,

Unfortunately, we cannot provide that type of support since that is out of our scope. However, I found an example that controls the GPIOS and it uses some libraries. 

it uses the below libraries

linux/module.h

linux/fs.h

linux/platform_device.h

linux/miscdevice.h

linux/delay.h

linux/uaccess.h

linux/gpio.h // required for the GPIO functions

linux/interrupts.h

This is as far as I can go. I apologize for the inconveniences.

Best Regards,

Diego.

0 件の賞賛
返信

1,599件の閲覧回数
abelussi
Contributor III

Thanks

0 件の賞賛
返信