How to configure GPIO names in dts?

Hi everyone

I am using VIM3 and have downloaded the code using: repo init -u GitHub - khadas/android_manifest: AOSP for Khadas VIMs & Edge -b khadas-vim3-p-64bit. The kernel version is 4.9.113, and after compiling, it can boot up normally.
I want to use VIM3 to debug an NFC chip peripheral, but I am unsure about how to configure the dts.

I am using I2C, with the hardware connected to PIN22 and PIN23.
ven-gpio is connected to PIN29,
irq-gpio is connected to PIN30,
download-gpio is connected to PIN31.
I am unsure about how to configure these in the DTS.

Below are the modifications I have attempted, please help me look at how the GPIO names should be configured, thank you!

&i2c3 {
status = “okay”;
pinctrl-names=“default”;
pinctrl-0=<&i2c3_master_pins2>;
clock-frequency = <100000>; /* default 100k */

nfc@0x0f {
	status = "okay";
	compatible = "tms,nfc";
	reg = <0x28>;

	tms,device-name   = "tms_nfc";
	tms,device-count  = <1>;
	tms,ven-gpio      = <&gpio PIN29 1>;
	tms,irq-gpio      = <&gpio PIN30 0>;
	tms,download-gpio = <&gpio PIN31 0>;
};

SPI:
MOSI is connected to PIN37,
MISO is connected to PIN35,
CS is connected to PIN15,
CLK is connected to PIN16,

&uart_C {
status = “disabled”;
};

&pcie_A {
@@ -1505,6 +1525,25 @@
status = “disable”;
};

&spicc1 {
status = “okay”;
pinctrl-names = “default”;
pinctrl-0 = <&spicc1_pins>;
cs-gpios = <&gpio GPIOH_6 0>;

   ese@0 {
          status = "okay";
          compatible = "tms,ese";
          reg = <0>;
          spi-max-frequency = <8000000>;

          tms,device-name    = "tms_ese";
          tms,device-count   = <1>;

          //independent_support;
   };

};

Which Khadas SBC do you use?

VIM3

Which system do you use? Android, Ubuntu, OOWOW or others?

Android

Which version of system do you use? Khadas official images, self built images, or others?

self built images:
I built Android 9:repo init -u GitHub - khadas/android_manifest: AOSP for Khadas VIMs & Edge -b khadas-vim3-p-64bit

Hello @znlsl

@goenjoy @xiong.zhang will help you then.

1 Like

请问能在哪里能获取到GPIO在DTS中的名字和硬件PIN的对照表?
我参考了这里:
https://docs.khadas.com/products/sbc/vim3/applications/gpio/start
比如 29 PIN.A1 461
在我上面发的DTS中如何配置使用这个PIN29呢?

非常感谢!

PIN 29 → I2SB_SCLK → GPIOA_1


这个要对应sch图来看

1 Like

嗯嗯,下午改了下I2C OK了,GPIO_ACTIVE_HIGH是激活电平吧?

nfc@0x0f {
	status = "okay";
	compatible = "tms,nfc";
	reg = <0x28>;

	tms,device-name   = "tms_nfc";
	tms,device-count  = <1>;
	tms,ven-gpio      = <&gpio GPIOA_1 GPIO_ACTIVE_HIGH>;
	tms,irq-gpio      = <&gpio GPIOA_0 IRQ_TYPE_LEVEL_LOW>;
	tms,download-gpio = <&gpio GPIOA_3 GPIO_ACTIVE_HIGH>;
};

GPIO_ACTIVE_HIGH 表示 GPIO 信号在高电平时是有效的。换句话说,在 GPIO 被设定为输出时,输出高电平表示信号有效或激活。在 GPIO 被配置为输入时,接收到高电平表示外部设备发送的有效信号

恩恩,我就是这个意思,感谢感谢!

SPI是这样配置的:
&uart_C {
status = “disabled”;
};

&pcie_A {
reset-gpio = <&gpio GPIOA_8 GPIO_ACTIVE_HIGH>;
status = “disable”;
};

&spicc1 {
status = “okay”;
pinctrl-names = “default”;
pinctrl-0 = <&spicc1_pins>;
cs-gpios = <&gpio GPIOH_6 0>;

   ese@0 {
          status = "okay";
          compatible = "tms,ese";
          reg = <0>;
          spi-max-frequency = <8000000>;

          tms,device-name    = "tms_ese";
          tms,device-count   = <1>;

          //independent_support;
   };

};

我把pwm_ef、uart_C、auge_sound、aml_tdmb: tdmb、都disabled了,应该可以使用PIN15 16 35 37了吧,请问还需要其他什么配置么?

经测试 这样配置确实这样就OK了 非常感谢!

@xiong.zhang
佬,顺便请教,VIM3 PRO可以用几个SPI呢?不会就PIN15 16 35 37的那一个吧?

可以用的应该只有这一组了,另外一组SPI_A接在了WiFi上了

@xiong.zhang
佬,我在 android 9.0 64 bit上面调试都完成了,感谢感谢!
想请教下,VIM3在谷歌官方推荐的开发板里,是不是可以理解AOSP最新的代码都是可以运行在VIM3的,也就是我拉AOSP12 13各个版本代码到本地,都可以编译运行在VIM3么?

12应该是支持的,13可能不行,不过你可以尝试下

@xiong.zhang

恩恩 我直接拉的master的就行吧,看着master应该就是最新的

repo init -u platform/manifest - Git at Google -b master

@xiong.zhang
试了下master最新的代码编译完成,刷完机安卓确实是起不来

01-01 00:05:55.318 0 0 I init : Service ‘zygote’ (pid 5961) received signal 6
01-01 00:05:55.328 0 0 I logd : logdr: UID=1000 GID=1003 PID=6003 n tail=500 logMask=1 pid=5995 start=0ns deadline=0ns
01-01 00:05:55.352 0 0 I init : Sending signal 9 to service ‘zygote’ (pid 5961) process group…
01-01 00:05:55.352 0 0 I libprocessgroup: Successfully killed process cgroup uid 0 pid 5961 in 0ms
01-01 00:05:55.313 6003 6003 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-01 00:05:55.313 6003 6003 F DEBUG : Build fingerprint: ‘generic/yukawa/sei610:VanillaIceCream/MAIN/eng.00658.20231125.214240:userdebug/test-keys’
01-01 00:05:55.313 6003 6003 F DEBUG : Revision: ‘0’
01-01 00:05:55.313 6003 6003 F DEBUG : ABI: ‘arm64’
01-01 00:05:55.313 6003 6003 F DEBUG : Timestamp: 1970-01-01 00:05:55.194291876+0000
01-01 00:05:55.313 6003 6003 F DEBUG : Process uptime: 2s
01-01 00:05:55.313 6003 6003 F DEBUG : Cmdline: /system/bin/surfaceflinger
01-01 00:05:55.313 6003 6003 F DEBUG : pid: 5995, tid: 5999, name: surfaceflinger >>> /system/bin/surfaceflinger <<<
01-01 00:05:55.313 6003 6003 F DEBUG : uid: 1000
01-01 00:05:55.313 6003 6003 F DEBUG : tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)
01-01 00:05:55.313 6003 6003 F DEBUG : signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
01-01 00:05:55.313 6003 6003 F DEBUG : Abort message: 'couldn’t find an OpenGL ES implementation, make sure one of persist.graphics.egl, ro.hardware.egl and ro.board.platform is set

我其实就是想跟着最新的谷歌安卓代码适配,看到google官方推荐的VIM3,所以买了一块来尝试下,看上去必须等VIM3官方适配安卓的大版本才行吧?

只有Android 12.0的是支持的,最新的版本我们还在商务中