set gpio imx8mn

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

set gpio imx8mn

888 次查看
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 项奖励
回复
3 回复数

865 次查看
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 项奖励
回复

860 次查看
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 项奖励
回复

856 次查看
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 项奖励
回复