set gpio imx8mn

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

set gpio imx8mn

546 Views
razriel
Contributor II

I am trying to set gpio immidiatly after power cycle.

I want to do it in u-boot enviormant before kernel loads.

found two possible solutions:

1. use gpio-hog in device tree. so few example how to use in device trees of other boards.

2. setting it in board_init function under board/freescale/imx8mn_evk/imx8mn_evk.c by adding gpio_request gpio_direction_output.

I am using yocto imx-5.15.5-1.0.0 honister and cannot find much information how to do this.

I belive both approaches cannot work together. one will overwrite the other. 

which one I should use ?

BR,

Roy

 

BR,

Roy 

0 Kudos
3 Replies

523 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @razriel,

I hope you are doing well.

 

To set the GPIO during startup in U-Boot one could add a script to set the IO.
E.g.,

# setenv set-io 'gpio set <gpio-number>'
# setenv bootcmd 'run set-io; run ubiboot; run sdboot'
# saveenv

 

Or else you can use the board_init  function to access the GPIO.

 

Either one can be used.

 

Thank you.
Best Regards,
Dhruvit.

0 Kudos

518 Views
razriel
Contributor II

The method you suggest is not could for prouductization.

how do I make it part of the image creation and not something to be done manualy ?

0 Kudos

514 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @razriel,

You can define a script in the environment variable, as described in my last reply for the automatic access of the GPIO. 

And for the board_init function method can also be part of the image creation. 

 

Best Regards,
Dhruvit.

0 Kudos