AnsweredAssumed Answered

How to define a pin function which has many alternatives?

Question asked by Hirotoshi Sato on Sep 6, 2017
Latest reply on Sep 20, 2017 by Hirotoshi Sato

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

Outcomes