Hi, I want to know how to define a pin function which has many alternatives like GPIO, I2C, UART, and so on.
At first, I am a begginer of embedded linux, so I may not know the common sense.
I use Pins for i.MX tool and i.mx6ul board.OS is yocto linux.
I know that if I want to set a GPIO state of a pin, I should change a device tree (dts).
If a pin has many alternatives such as GPIO, I2C and UART, I think I should specify the function I want to set for the pin. However I couldn't find out what file I should change.
Are there any files which decides a pin function in yocto project?
# What I checked
I set a pin for GPIO (direction: input, pull up 100K) in dts with i.MX pins tool and compiled it to dtb.
I put the dtb file on the boot partition of a yocto image.
I measured a wave of the pin I set with oscilloscope.
I checked the wave is HIGH ('cause it is pulled up) after booting. So I judged I could set GPIO state correctly.
The part of dtsi file is as follows.
&iomuxc {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_hog_1>;
imx6ul-evk {
pinctrl_hog_1: hoggrp-1 {
fsl,pins = <
MX6UL_PAD_CSI_HSYNC__GPIO4_IO20 0x1b0b0
MX6UL_PAD_CSI_DATA00__GPIO4_IO21 0x1b0b0
>;
};
I checked the register value(0x1b0b0 ) and register address(MX6UL_PAD_CSI_HSYNC__GPIO4_IO20) with i.mx pins tool.
I am waiting for your answer.
Thank you.
Best regards,
Hiro
已解决! 转到解答。
Hello Hiro,
There are a couple of good documents that cover the Device Tree topic, for example:
https://community.nxp.com/docs/DOC-329664
Regarding how to define a pin function with many options, I would recommend trying the Pins Tool for i.MX, as it allows to have a GUI to see the different options or each pin and it also generates the necessary register settings to be used. You can download it and its documentation from the link below:
I hope this helps!
Regards,
Hello Hiro,
There are a couple of good documents that cover the Device Tree topic, for example:
https://community.nxp.com/docs/DOC-329664
Regarding how to define a pin function with many options, I would recommend trying the Pins Tool for i.MX, as it allows to have a GUI to see the different options or each pin and it also generates the necessary register settings to be used. You can download it and its documentation from the link below:
I hope this helps!
Regards,