HyperPixel 4 - Touch screen dimensions are swapped


#21

Hi @AndyCap, thanks for fixing the portrait touchscreen issue - just what I needed!

How do I go about installing your fix please? I see from the GitHub page (https://github.com/AndrewCapon/HyperPixel4TouchScreen/tree/master/driver) that I need to install hyperpixel4-goodix-dkms_1.0_all.deb, but where do I find this?


#22

That is a good question, Pimoroni have packaged this up so I am not sure.

I’m sure @gadgetoid will post today about where it is.


#23

The deb file is available here: https://github.com/pimoroni/HyperPixel4TouchScreen/releases

You will still need to:

sudo apt install raspberrypi-kernel-headers dkms


#24

Thanks @gadgetoid and @AndyCap, it works a treat in portrait mode now!


#25

Actually, just realised that when in portrait mode (screen mode 2), the left/right orientation is opposite to what it should be. Up/down works ok (this is all I tested before…).

I use these settings:

	dtoverlay=hyperpixel4:rotate_2
	framebuffer_width=480
	framebuffer_height=800
	display_rotate=2

Thanks.


#26

Not sure how pimoroni have this setup but the way I did it was to use the dts settings as detailed here: https://github.com/AndrewCapon/HyperPixel4TouchScreen/tree/master/driver

So touchscreen-inverted-y would be set which doesn’t make much sense for your problem as you are having problems with the other axis.

@gadgetoid will be along with better info…


#27

Thanks Andy, double checked the dts settings against yours and all looks the same. I would be interested to know if you experience the same issue in portrait mode (display mode 2 with USB ports at the bottom) please?

Further testing reveals the following issues:

Portrait, USB ports on top
X axis ok, but Y is inverted

dtoverlay=hyperpixel4:rotate_0
framebuffer_width=480
framebuffer_height=800
display_rotate=0

Landscape, USB ports on left
X and Y on the wrong axis - down = left and right = up

dtoverlay=hyperpixel4:rotate_1
framebuffer_width=800
framebuffer_height=480
display_rotate=1

Portrait, USB ports underneath
Y axis ok, X axis inverted

dtoverlay=hyperpixel4:rotate_2
framebuffer_width=480
framebuffer_height=800
display_rotate=2

Landscape, USB ports on right
X and Y on the wrong axis

dtoverlay=hyperpixel4:rotate_3
framebuffer_width=800
framebuffer_height=480
display_rotate=3

Just to confirm steps, this is a fresh install of 2018-06-27-raspbian-stretch.img, with the following commands to set up Hyperpixel:

sudo apt update
sudo apt upgrade
git clone https://github.com/pimoroni/hyperpixel4
cd hyperpixel4
sudo ./install.sh
cd src
make
sudo cp hyperpixel4.dtbo /boot/overlays/
wget https://github.com/pimoroni/HyperPixel4TouchScreen/releases/download/v1.0/hyperpixel4-goodix-dkms_1.0_all.deb
sudo apt install raspberrypi-kernel-headers dkms
sudo dpkg -i hyperpixel4-goodix-dkms_1.0_all.deb
sudo nano /boot/config.txt

I tried going back to the original settings:

Landscape, USB ports on left
X and Y on the wrong axis - this time down = right and right = down

dtoverlay=hyperpixel4:rotate
framebuffer_width=800
framebuffer_height=480
display_rotate=1

Landscape, USB ports on right
X and Y on the wrong axis

dtoverlay=hyperpixel4
framebuffer_width=800
framebuffer_height=480
display_rotate=3

So in conclusion, installing hyperpixel4-goodix-dkms_1.0_all.deb doesn’t appear to work in any orientation. I will flash a new Stretch image and await further instructions from @gadgetoid.


#28

Everything works fine here but I didn’t use the deb file, I built the .ko file and tested all the config/dts settings to get the right settings which I put in the readme.md file.

I’m not really sure what pimoroni have done since then, sorry.


#29

P.S. With my original solution you need to build and copy the DTS file, for portrait mode with ports at bottom I have:

/dts-v1/;
/plugin/;
/ {
    compatible = "brcm,bcm2708";
    fragment@0 {
        target = <0xdeadbeef>;
        __overlay__ {
            pinctrl-names = "default";
            pinctrl-0 = <0x1>;
        };
    };
    fragment@1 {
        target = <0xdeadbeef>;
        __overlay__ {
            dpi18_pins {
//              brcm,pins = <0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9    0xa 0xb 0xc 0xd 0xe 0xf 0x10 0x11 0x12 0x13       0x14 0x15>;
                brcm,pins = <0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9    0xc 0xd 0xe 0xf 0x10 0x11     0x14 0x15 0x16 0x17 0x18 0x19>;
                brcm,function = <0x6>;
                brcm,pull = <0x0>;
                phandle = <0x1>;
            };
        };
    };
    fragment@2 {
        target-path = "/";
        __overlay__ {
            i2c_gpio: i2c@0 {
                compatible = "i2c-gpio";
                gpios = <&gpio 10 0 /* sda */
                     &gpio 11 0 /* scl */
                    >;
                i2c-gpio,delay-us = <2>;        /* ~100 kHz */
                #address-cells = <1>;
                #size-cells = <0>;
            };
        };
    };
    fragment@3 {
        target = <&i2c_gpio>;
        __overlay__ {
            /* needed to avoid dtc warning */
            #address-cells = <1>;
            #size-cells = <0>;
            ft6236: ft6236@5d {
                compatible = "goodix,gt911";
                reg = <0x5d>;
                interrupt-parent = <&gpio>;
                interrupts = <27 2>;
                touchscreen-inverted-y;
                touchscreen-size-x = <480>;
                touchscreen-size-y = <800>;
	    };
        };
    };
    fragment@4 {
        target-path = "/";
        __overlay__ {
            rpi_backlight: rpi_backlight {
                compatible = "gpio-backlight";
                gpios = <&gpio 19 0>;
                default-on;
            };
        };
    };
    __symbols__ {
        dpi18_pins = "/fragment@1/__overlay__/dpi18_pins";
    };
    __local_fixups__ {
        fragment@0 {
            __overlay__ {
                pinctrl-0 = <0x0>;
            };
        };
    };
    __fixups__ {
        leds = "/fragment@0:target:0";
        gpio = "/fragment@1:target:0";
    };
    __overrides__ {
        rotate = <0>,"-5";
    };
};

From the src folder to build and copy:

make
sudo cp hyperpixel4.dtbo /boot/overlays/
sync

Then reboot and see if that helps?

my boot.config:

dtoverlay=hyperpixel4:rotate
framebuffer_width=480
framebuffer_height=800
display_rotate=2

#30

Superb! Thank you very much Andy, I can confirm touchscreen now works with both axis in that portrait mode. :)

I’ve not had chance to test other orientations as got to dash, but this is all I need for now so thanks!


#31

This is bizarre- I tested all of the orientations before making the PR and packing it up. I was quite proud of my little match-the-touch-orientation-to-the-screen setup. D’oh. Now I’m confused. I’ll have to add this to my TODO list for when I have some time to spare.


#32

just got the Hyperpixel touch 4. but no luck with the touch to work correctly on RPi Jersy. I have done rebuild on dts file based on https://github.com/pimoroni/hyperpixel4. but no luck.
can anyone suggest the correct step to make it work?