Fu-. 0 Posted June 16, 2021 Hi, I want to use wiringPi on Tinker2S. I'm trying to use GPIO Pin#15 (wiring Pi Pin#3) as a pull-down input, but after a bit of research, it seems to be acting like it's latching. Once the Input goes High, the input does not drop to Low after that. Is there a good solution? Share this post Link to post Share on other sites
Fu-. 0 Posted June 16, 2021 I wrote and test this dts; ----- /dts-v1/; /plugin/; / { compatible = "rockchip,rk3399"; /* disable spi5 */ fragment@0 { target = <&spi5>; __overlay__ { status = "okay"; spi5 { status = "disabled"; }; }; }; fragment@1 { target-path = "/"; __overlay__ { gpio15 { compatible = "gpio2"; pinctrl-names = "default"; pinctrl-0 = <&gpio_pins>; gpios = <&gpio2 20 0>; status = "okay"; }; }; }; fragment@2 { target = <&gpio2>; __overlay__ { gpio_pins: gpio_pins { rockchip,pins = <2 20 0 &pcfg_pull_down>; }; }; }; }; ----- However, this did not work. It still behaves as if it is latching. Share this post Link to post Share on other sites
Joe 3 Posted June 17, 2021 On 6/16/2021 at 12:54 PM, Fu-. said: Hi, I want to use wiringPi on Tinker2S. I'm trying to use GPIO Pin#15 (wiring Pi Pin#3) as a pull-down input, but after a bit of research, it seems to be acting like it's latching. Once the Input goes High, the input does not drop to Low after that. Is there a good solution? Hi Fu, Please refer the following examples [Image Version] Tinker_Board_2-Android10-V1.0.0-20210318.img [Example] /usr/local/share/gpio_lib_c_rk3399/examples/isr.c /usr/local/share/gpio_lib_c_rk3399/examples/isr-osc.c [Step] 1. cd /usr/local/share/gpio_lib_c_rk3399/examples 2. sudo make isr 3. sudo ./isr 4. GPIO #15 (wiring Pi #3) pulled down <-> up switch 4. Output: Waiting ... Int on pin 3: Counter: 1 Waiting ... Int on pin 3: Counter: 2 Waiting ... Int on pin 3: Counter: 3 ……. Share this post Link to post Share on other sites
Joe 3 Posted June 17, 2021 On 6/16/2021 at 4:16 PM, Fu-. said: I wrote and test this dts; ----- /dts-v1/; /plugin/; / { compatible = "rockchip,rk3399"; /* disable spi5 */ fragment@0 { target = <&spi5>; __overlay__ { status = "okay"; spi5 { status = "disabled"; }; }; }; fragment@1 { target-path = "/"; __overlay__ { gpio15 { compatible = "gpio2"; pinctrl-names = "default"; pinctrl-0 = <&gpio_pins>; gpios = <&gpio2 20 0>; status = "okay"; }; }; }; fragment@2 { target = <&gpio2>; __overlay__ { gpio_pins: gpio_pins { rockchip,pins = <2 20 0 &pcfg_pull_down>; }; }; }; }; ----- However, this did not work. It still behaves as if it is latching. You can try to modify Pin define from /boot/config.txt And run "gpio readall" to get list Share this post Link to post Share on other sites
Fu-. 0 Posted June 17, 2021 Thanks Joe, I tried your sample, but I still have problems. A High is input to GPIO#15 once, and the original value is maintained even when the input is released. I want GPIO#15 to go Low when the input is released. Any solution? Share this post Link to post Share on other sites
Fu-. 0 Posted June 17, 2021 Thanks Joe, Result is this: --- linaro@linaro-alip:~$ gpio readall +-----+-----+---------+------+---+--Tinker--+---+------+---------+-----+-----+ | CPU | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | CPU | +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+ | | | 3.3v | | | 1 || 2 | | | 5v | | | | 73 | 8 | GPIO2B1 | IN | 1 | 3 || 4 | | | 5v | | | | 74 | 9 | GPIO2B2 | IN | 1 | 5 || 6 | | | 0v | | | | 8 | 7 | GPIO0B0 | IN | 0 | 7 || 8 | 1 | IN | GPIO2C1 | 15 | 81 | | | | 0v | | | 9 || 10 | 1 | IN | GPIO2C0 | 16 | 80 | | 83 | 0 | GPIO2C3 | IN | 1 | 11 || 12 | 0 | IN | GPIO3D0 | 1 | 120 | | 85 | 2 | GPIO2C5 | IN | 0 | 13 || 14 | | | 0v | | | | 84 | 3 | GPIO2C4 | IN | 1 | 15 || 16 | 0 | IN | GPIO2C6 | 4 | 86 | | | | 3.3v | | | 17 || 18 | 0 | IN | GPIO2C7 | 5 | 87 | | 40 | 12 | GPIO1B0 | IN | 1 | 19 || 20 | | | 0v | | | | 39 | 13 | GPIO1A7 | IN | 1 | 21 || 22 | 0 | IN | GPIO3D4 | 6 | 124 | | 41 | 14 | GPIO1B1 | IN | 1 | 23 || 24 | 1 | IN | GPIO1B2 | 10 | 42 | | | | 0v | | | 25 || 26 | 0 | IN | GPIO0A6 | 11 | 6 | | 71 | 30 | GPIO2A7 | IN | 1 | 27 || 28 | 1 | IN | GPIO2B0 | 31 | 72 | | 126 | 21 | GPIO3D6 | IN | 0 | 29 || 30 | | | 0v | | | | 125 | 22 | GPIO3D5 | IN | 0 | 31 || 32 | 0 | IN | GPIO4C2 | 26 | 146 | | 150 | 23 | GPIO4C6 | OUT | 1 | 33 || 34 | | | 0v | | | | 121 | 24 | GPIO3D1 | IN | 0 | 35 || 36 | 1 | IN | GPIO2C2 | 27 | 82 | | 149 | 25 | GPIO4C5 | IN | 0 | 37 || 38 | 0 | IN | GPIO3D3 | 28 | 123 | | | | 0v | | | 39 || 40 | 0 | IN | GPIO3D7 | 29 | 127 | +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+ | CPU | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | CPU | +-----+-----+---------+------+---+--Tinker--+---+------+---------+-----+-----+ Even though there is no input to GPIO#15, it is high. Share this post Link to post Share on other sites
Fu-. 0 Posted June 17, 2021 (edited) 3 hours ago, Joe said: You can try to modify Pin define from /boot/config.txt And run "gpio readall" to get list I found and wrote into /boot/config.txt; gpio=84=ip,pd but this doesn't make any sense. I did notice one odd thing. Looking directly at GPIO#15 (pin No.84), the value seems to be changing correctly with no input (but I had to change active_low to 1 as follows). # echo 84 > /sys/class/gpio/export # cd /sys/class/gpio/export/gpio84 # cat active_low 0 # echo 1 > active_low # cat value 0 Also, # cat/sys/kernel/debug/pinctrl/pinctrl/pinmux-pins : pin 84 (gpio2-20): (MUX UNCLAIMED) gpio2:84 : It doesn't look like the multiplexer is selecting a GPIO. Does wiringPi correctly select Func_1(gpio2_c[4])? Edited June 17, 2021 by Fu-. Share this post Link to post Share on other sites
Fu-. 0 Posted June 18, 2021 11 hours ago, Fu-. said: I found and wrote into /boot/config.txt; gpio=84=ip,pd but this doesn't make any sense. I did notice one odd thing. Looking directly at GPIO#15 (pin No.84), the value seems to be changing correctly with no input (but I had to change active_low to 1 as follows). # echo 84 > /sys/class/gpio/export # cd /sys/class/gpio/export/gpio84 # cat active_low 0 # echo 1 > active_low # cat value 0 Also, # cat/sys/kernel/debug/pinctrl/pinctrl/pinmux-pins : pin 84 (gpio2-20): (MUX UNCLAIMED) gpio2:84 : It doesn't look like the multiplexer is selecting a GPIO. Does wiringPi correctly select Func_1(gpio2_c[4])? Hmm... The value remains latched even when the input of GPIO#84 is manipulated directly (once Low->High and then High input is turned off, the value remains High). Share this post Link to post Share on other sites
Fu-. 0 Posted June 24, 2021 On 6/17/2021 at 5:16 PM, Joe said: Hi Fu, Please refer the following examples [Image Version] Tinker_Board_2-Android10-V1.0.0-20210318.img [Example] /usr/local/share/gpio_lib_c_rk3399/examples/isr.c /usr/local/share/gpio_lib_c_rk3399/examples/isr-osc.c [Step] 1. cd /usr/local/share/gpio_lib_c_rk3399/examples 2. sudo make isr 3. sudo ./isr 4. GPIO #15 (wiring Pi #3) pulled down <-> up switch 4. Output: Waiting ... Int on pin 3: Counter: 1 Waiting ... Int on pin 3: Counter: 2 Waiting ... Int on pin 3: Counter: 3 ……. > 4. GPIO #15 (wiring Pi #3) pulled down <-> up switch How to do this? Share this post Link to post Share on other sites
Fu-. 0 Posted June 24, 2021 (edited) After further investigation, it seems that GPIO#15 (gpio2c_4) is correctly set to pull-down GPIO mode. read GRF_GPIO2C_IOMUX: io -4 -r 0xff77e008 ff77e008: 00000000 bits 9:8 is 2'b00 = GPIO read GRF_GPIO2C_P: io -4 -r 0xff77e048 ff77e048: 0000fd3f bits 9:8 is 2'b01 = weak 0(pull down) Nevertheless, once the input changes from Low->High and the High input is nothing, GPIO#15 continues to stay High. Is there something else I should be setting? From these conditions, it does not seem to be a problem with wiringPi. Is this not a problem with RK3399, but a specification of Tinker2S? Edited June 24, 2021 by Fu-. Share this post Link to post Share on other sites
JulianR 0 Posted May 12, 2022 I have the same problem, did you find a solution for this? Share this post Link to post Share on other sites