Weird interaction between the TS050 touchscreen and the IO pins of the Edge2 IO module

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

Ubuntu

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

Edge2 Ubuntu 22.04 Linux 5.10 V1.6.2-240110 Release

Please describe your issue below:

I encountered a weird interaction between the TS050 touchscreen and the IO pins of the Edge2 IO module: whenever I touch the screen, this also triggers a signal on the pins connected to a rotary encoder (eg. PIN_A=113, PIN_B=24, PIN_SWITCH=23). Is it expected or is it a bug??? Thanks!

Hello @Whabilly

Could you please provide more details about the steps you performed ? It is helpful for us to reproduce this issue on our side.

The problem occurs either when running Ubuntu Desktop or Server mode (sudo systemctl isolate multi-user.target) with a simple switch connected to pin 23 on the Edge2 IO module. I am running the following bash file to monitor the switch status:

#!/bin/bash
GPIO_PIN=23
echo "$GPIO_PIN" > /sys/class/gpio/export
echo "in" > "/sys/class/gpio/gpio$GPIO_PIN/direction"
PREV_VALUE=0
while true; do
    CURRENT_VALUE=$(cat "/sys/class/gpio/gpio$GPIO_PIN/value")
    if [ "$CURRENT_VALUE" -ne "$PREV_VALUE" ]; then
        if [ "$CURRENT_VALUE" -eq 1 ]; then
            echo "Pin value changed from 0 to 1"
        else
            echo "Pin value changed from 1 to 0"
        fi
        PREV_VALUE="$CURRENT_VALUE"
    fi
    sleep 0.01
done

The pin output changes its value each time the TS050 display is touched as shown by the output below:

sudo ./test_button.sh 
Pin value changed from 0 to 1
Pin value changed from 1 to 0
Pin value changed from 0 to 1
Pin value changed from 1 to 0
Pin value changed from 0 to 1
Pin value changed from 1 to 0
Pin value changed from 0 to 1
Pin value changed from 1 to 0
Pin value changed from 0 to 1
Pin value changed from 1 to 0
Pin value changed from 0 to 1

Here is the info about the system installed on my Edge2:

cat /etc/fenix-release
    BOARD=Edge2
     VENDOR=Rockchip
     VERSION=1.6.2
     ARCH=arm64
     INITRD_ARCH=arm64
     IMAGE_VERSION=1.6.2-240110
     UBOOT_GIT_VERSION=khadas-edges-u-boot-2017.09-v1.6.2-release
     LINUX_GIT_VERSION=khadas-edges-linux-5.10-v1.6.2-release
     FENIX_GIT_VERSION=v1.6.2

Thanks for investigating!

Hello @Whabilly

@Jacobe will help you then.

1 Like

Hello @Whabilly,

From Edge2 schematic, you can find the DSI i2c pins, and it is multiplexed by GPIO0_C7


In fenix/build/linux/drivers/pinctl/pinctrl-rockchip.h :44

#define RK_GPIO0_C7	23

I only check gpio23, I think others are likewise.

So you had better change the pins which connect your rotary encoder :wink:

1 Like

Thanks @Jacobe, you are right I just needed to use some other pins. So in short, GPIO Num 23 & 24 are already used by the display i2c if a TS050 is connected.