cancel
Showing results for 
Search instead for 
Did you mean: 

GPIO input state by default.

_Krishna
Associate III

Post edited by ST moderator to be inline with the community rules for the code sharing. In next time please use </> button to paste your code. Please read this post: How to insert source code.

Hello,

     I am trying to set few pins as input states by default right after boot and power on state so I have written 2 nodes:-

turn_latch_if {
compatible = "gpio";
status = "okay";

turn_dc_dc_conv_off {
label = "TURN_DC_DC_CONV_OFF";
gpios = <&gpiog 4 GPIO_ACTIVE_LOW>;  /* PG4 */
status = "okay";
};

turn_bat_charge_off {
label = "TURN_BAT_CHARGE_OFF";
gpios = <&gpiog 6 GPIO_ACTIVE_LOW>;  /* PG6 */
status = "okay";
};

bat_charge_status {
label = "BAT_CHARGE_STATUS";
gpios = <&gpiog 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;  /* PG7 */
status = "okay";
};

lrelay_status {
label = "LRELAY_STATUS";
gpios = <&gpioa 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;  /* PA9 */
status = "okay";
};

latching_relay {
label = "LATCHING_RELAY";
gpios = <&gpioj 6 GPIO_ACTIVE_LOW>;  /* PJ6 */
status = "okay";
};
};


digio_if {
compatible = "gpio";
status = "okay";

/* Digital inputs D1..D4 on GPIOB (PB0..PB3) */
dig_in1 {
label = "DIG_IN1";
gpios = <&gpiob 0 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;  /* PB0 */
status = "okay";
};
dig_in2 {
label = "DIG_IN2";
gpios = <&gpiob 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;  /* PB1 */
status = "okay";
};
dig_in3 {
label = "DIG_IN3";
gpios = <&gpiob 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;  /* PB2 */
status = "okay";
};
dig_in4 {
label = "DIG_IN4";
gpios = <&gpiob 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;  /* PB3 */
status = "okay";
};

/* Digital I/O lines D5..D7 on GPIOB (PB4..PB6) */
dig_io5 {
label = "DIG_IO5";
gpios = <&gpiob 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;  /* PB4 */
status = "okay";
};
dig_io6 {
label = "DIG_IO6";
gpios = <&gpiob 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;  /* PB5 */
status = "okay";
};
dig_io7 {
label = "DIG_IO7";
gpios = <&gpiob 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;  /* PB6 */
status = "okay";
};

/* Digital I/O 8 on PB9 */
dig_io8 {
label = "DIG_IO8";
gpios = <&gpiob 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;  /* PB9 */
status = "okay";
};

/* Digital output enables EN5..EN8 on GPIOD (PD1..PD4) */
dig_out_en5 {
label = "DIG_OUT_EN5";
gpios = <&gpiod 1 GPIO_ACTIVE_LOW>;  /* PD1 */
status = "okay";
};
dig_out_en6 {
label = "DIG_OUT_EN6";
gpios = <&gpiod 2 GPIO_ACTIVE_LOW>;  /* PD2 */
status = "okay";
};
dig_out_en7 {
label = "DIG_OUT_EN7";
gpios = <&gpiod 3 GPIO_ACTIVE_LOW>;  /* PD3 */
status = "okay";
};
dig_out_en8 {
label = "DIG_OUT_EN8";
gpios = <&gpiod 4 GPIO_ACTIVE_LOW>;  /* PD4 */
status = "okay";
};

/* Digital outputs D1..D8 on various ports:
   PC4, PC6, PC8, PC9, PC10, PC12, PD0, PZ7 */
dig_out1 {
label = "DIG_OUT1";
gpios = <&gpioc 4 GPIO_ACTIVE_LOW>;  /* PC4 */
status = "okay";
};
dig_out3 {
label = "DIG_OUT3";
gpios = <&gpioc 8 GPIO_ACTIVE_LOW>;  /* PC8 */
status = "okay";
};
dig_out4 {
label = "DIG_OUT4";
gpios = <&gpioc 9 GPIO_ACTIVE_LOW>;  /* PC9 */
status = "okay";
};
dig_out5 {
label = "DIG_OUT5";
gpios = <&gpioc 10 GPIO_ACTIVE_LOW>; /* PC10 */
status = "okay";
};
dig_out6 {
label = "DIG_OUT6";
gpios = <&gpioc 12 GPIO_ACTIVE_LOW>; /* PC12 */
status = "okay";
};
dig_out7 {
label = "DIG_OUT7";
gpios = <&gpiod 0 GPIO_ACTIVE_LOW>;  /* PD0 */
status = "okay";
};
dig_out8 {
label = "DIG_OUT8";
gpios = <&gpioc 6 GPIO_ACTIVE_LOW>;  /* PZ7 */
status = "okay";
};
};



In this list I am trying to put:- dig_in1, dig_in2, dig_in3, dig_in4, dig_io5, dig_io6, dig_io7, dig_io8, lrelay_status, bat_charge_status these pins to be in input state during power on and after boot modes.


Should I have to modify any other file in my yocto of STM32MP257F-EV1 based yocto directory to achieve this.

When reading thier states are 1,1,1,1,0,0,0,1,0,1
 dig_in1, dig_in2, dig_in3, dig_in4, dig_io5, dig_io6, dig_io7, dig_io8, lrelay_status, bat_charge_status respectively.

0 REPLIES 0