VIM3 How to set a GPIO to the Pull-Up State?

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

Ubuntu

Which version of system do you use? Please provide the version of the system here:

5.15 kernel ubuntu

Please describe your issue below:

How to set a GPIO to the pull-up state?

Post a console log of your issue below:


**Delete this line and post your log here.**

Hello @Akina

Which GPIO you want to control and what you want to do?

I need to set up three GPIO interfaces are GPIOZ_15, GPIOH_4, and GPIOA_5, and connect these interface pins with buttons respectively, and connect the other wire to J14(GND). Set these pins to be pull-up so that their output can be captured by the system when I press. Is this scenario feasible?

Hello @Akina

GPIOZ_15 is OD pin - You need to setup extra pull-up register.
GPIOH_4 is default Pull-Down pin.
GPIOA_5 is default Pull-Down pin.



For more other pins, please check the datasheet.

If I want to set the default pull-down interface to a pull-up?How can i do?Modify the KVIM3.dts file?

Hello @Akina

You can try to config the dts pinctrl to add bias-pull-down or bias-pull-up, here is an example from arch/arm64/boot/dts/amlogic/mesong12b.dtsi for your reference:

sdio_m_clk_gate_pins:sdio_m_clk_gate_pins {
    mux {
        groups = "GPIOX_4";
        function = "gpio_periphs";
        bias-pull-down;
        drive-strength = <3>;
    };
};

你好,我刚接触开发板,不是很懂其中的知识。请问一下,我在github上下载了mesong12b.dtsi文件进行了修改并上传到我的本地Ubuntu系统中(我在本地的Ubuntu系统中没有查找到相应的路径arch/arm64/boot/dts/amlogic/mesong12b.dtsi),我要如何实施我修改后的dtsi文件让系统能执行起来啊?

@Akina please follow these steps:

  1. In a suitable Ubuntu x86 environment you need to create a clone of fenix scripts:
$ git clone https://github.com/khadas/fenix --depth 1
$ cd fenix
  1. Follow the fenix/README.md doc to install the necessary packages and build tools

  2. To build the packages for updating your dtb/dtsi you need to run make kernel-deb so that the scripts setup all the necessary sources for it.

  3. you can find this same file in your source tree, directory should be build/linux/arch/arm64/boot/dts/amlogic/mesong12b.dtsi. Make the changes necessary there.

  4. Run make kernel-deb again and it will recompile the dtb/dtsi files

  5. Under build/images/debs/<fenix version>/VIM3/ a set of .deb packages should be prepared, Copy linux-dtb-amlogic-5.15-<fenix version>_arm64.dtb file to your VIM3 and install it with dpkg -i linux-dtb-amlogic-5.15-<fenix version>_arm64.dtb

Currently as of writing, Fenix version is 1.7.2, but as time progress it will be updated.
make sure you have updated your board to the latest firmware version by following this guide

Cheers

2 Likes