Hyperpixel 4.0 Touchscreen Rotate with Display

I’m resting my Pi with the Hyperpixel 4.0 on it’s side so that the PSU and HDMI ports face upwards. The original installation instructions end up with the display upside down, so to fix this I changed display_rotate=3 in /boot/config.txt to display_rotate=1.

Unfortunately the touchscreen sensor hasn’t rotated with the display, so the mouse appears in the opposite corner to where I touch. How do I fix this please?

1 Like

Try lcd_rotate instead, and let me know if that works.

This is something I forgot to add into the HyperPixel4 dtoverlay- the only way to rotate the touchscreen I’m aware of is to do it at the driver level. I’ve fixed the software to do this:

  1. Replace your /boot/overlays/hyperpixel4.dtbo with https://github.com/pimoroni/hyperpixel4/blob/master/dist/hyperpixel4.dtbo
  2. Change your /boot/config.txt so that dtoverlay=hyperpixel4 reads dtoverlay=hyperpixel4:rotate
  3. Keep the display_rotate=1 command you already have in place

For anyone who installs this new software (as of today) you just need to make these two changes in /boot/config.txt:

  1. Change display_rotate=3 to display_rotate=1
  2. Change dtoverlay=hyperpixel4 to dtoverlay=hyperpixel4:rotate

Thanks! I’ll try that this evening. :)

Unfortunately the touchscreen isn’t working at all now. I initially obtained the .dtbo file with wget and replaced it with the one in boot as suggested, along with the config changes, but upon a reboot the screen no longer worked. I then decided to rebuild the SD card with a clean 2018-06-27-raspbian-stretch.img and install using the curl one-liner. As expected the screen was upside down, so I changed the two config options, rebooted, and then tried to use the touch screen, but there was no response.

I tried removing :rotate with no luck, then changed display_rotate back to 1 with no luck on the touchscreen.

I shall now attempt to rebuild the SD again and try the touchscreen straight away before changing any options, and report back here.

Drat! I tested it locally first and the software change wouldn’t affect the touchscreen hardware. Worth checking the output of “dmesg” to see if it has any entries for “goodix” and any clues as to what might be going wrong.

Keep me posted!

Rebuilt using a fresh image but this time tried git clone and touchscreen still didn’t work, so I changed back to the previous commit using git checkout -b new_branch d612075460eb8072e9ea8f526c8b11fc9a836da1, rebooted and now touchscreen works again.

Went back to latest commit and touchscreen doesn’t work.

Not sure if the following is relevant in dmesg (no mention of goodix):

[    2.981445] OF: /i2c@0: could not find phandle
[    2.987579] OF: /rpi_backlight: could not find phandle
[    2.987599] gpio-backlight rpi_backlight: Error: The gpios parameter is missing or invalid.
[    2.987625] gpio-backlight: probe of rpi_backlight failed with error -22
1 Like

What happens if you;

  1. grab the latest source from GitHub,
  2. go into the “src” directory and type “Make” to build your own dtbo file
  3. Copy that hyperpixel4.dtbo into /boot/overlays
  4. Reboot

There’s nothing in the new overlay source that should cause the touchscreen to not work, but I wonder if I’ve somehow built a dodgy dtbo. Even then, I’d expect nothing to work. Odd!

Edit: I have a suspicion that the older system I compiled the dtoverlay on might be sufficiently different to the latest Raspbian that the resulting dtbo is incompatible. It’s a theory, since I’m not a device-tree expert at this point, but seems like a reasonable explanation for what’s going on here.

It looks like your suggestion works as someone else has had chance to do this already - Hyperpixel 4.0 - touch not working

1 Like

Aha! Brilliant. Yeah it looks like I missed some crucial quirk of the compile process. I’ve reverted to the older .dtbo in GitHub now and updated the instructions for people who want to rotate. I believe building the dtbo should be part of the install process.

This will hopefully all be academic when I upstream the file for inclusion in Raspbian!

1 Like

My screen has rotated but the touch axis are still inverted. I’ve done the 2 steps you mention, updating the display_rotate=1 and dtoverlay=hyperpixel4:rotate and rebooted, but the touch axis are still inverted.

I’ve also downloaded the latest .dtbo file from Github and installed that over the old one, and rebooted.

Is there anything else I should try? I’ve not tried makeing my own dtbo file yet, but that will be next on my list of things to try. From what I understand about your latest post though @gadgetoid, this should not be necessary?

The latest dtbo on GitHub has been reverted to the version that doesn’t break, so you’ll need to compile the dtbo from the dts source in the src folder and use that. See the steps above, it should be pretty straight forward.

I need to update the installer to do the compilation step automagically!

That worked! Thanks a lot! Really love Pimoroni and am very impressed with the fast feedback, especially at this hour!

1 Like

Not all is as well as it seems unfortunately…

So, I would like to use my Hyperpixel 4.0 in portrait mode as this view looks great with Home Assistant in Kiosk mode. I made the following changes in /boot/config.txt and the display rotates to portrait really well. However, the touchscreen doesn’t rotate at the same time and is still in landscape mode. @gadgetoid, would you mind having a look at this please?

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

However, that’s not all - I reverted back to display_rotate=3 and noticed that this too had the touchscreen in reverse. To fix this I had to remove rotate, going back to dtoverlay=hyperpixel4.

I guess the question then is should something other than rotate be used for portrait mode (specifically with display mode 2)?

Thanks.

P.S. I’m using the latest GitHub build and I’ve built the latest dtoverlay from src.

Ah, just seen this related issue: HyperPixel 4 - Touch screen dimensions are swapped - please ignore my post above, I’ll reply to that thread.

Hi, I am having trouble with this, I am able to rotate the display with display_rotate=3 to display_rotate=1 and dtoverlay=hyperpixel4 to dtoverlay=hyperpixel4:rotate, but the touch controls are inverted.

When I replace /boot/overlays/hyperpixel4.dtbo with https://github.com/pimoroni/hyperpixel4/blob/master/dist/hyperpixel4.dtbo after changing the above values, the screen no longer turns on. Have there been any updates that change how rotating the screen is done?

The upstream touch driver only works well with landscape rotation unfortunately.

We’ve got an optional side-loaded driver available that should work in both portrait orientations too, which you can find steps to install here:

The side-loaded driver isn’t the default since it’s a lot more involved to set up and install and it’s usually the more technically inclined users who want to explore portrait orientations anyway.

Spent some time on this like many others, so hopefully this is not necro’ing. I have a raspberry pi 4b, and these two settings worked for me to get display working with USB on right and power on bottom.

dtoverlay=hyperpixel4,touchscreen-inverted-3,touchscreen-inverted-3
display_lcd_rotate=3

First post but hopefully helps someone else.

Unfortunately I have the same problem.
I rotated my HyperPixel 4.0 Square Touch Hi-Res Display (in config.txt)

dtoverlay=hyperpixel4:rotate
display_rotate=1

BUT the touchscreen sensor is not following respectively it is inverted. I tried every hind above, without success.
Any help is highly welcome.

Hi,

I have a Pi 3 and a HyperPixel 4.0 Square with Touch, which I’d like to rotate so that the USB and HDMI ports are on the bottom or top (i.e. 90 degrees to default orientation). I’ve managed to rotate the screen display but not the touch input which is still at 90 degs to the screen. This is with dtoverlay=hyperpixel4:rotate and display_lcd_rotate=3 in /boot/config.txt.

I’ve tried building and replacing my own hyperpixel4.dtbo file as suggested above (from the square branch of the repo) but it doesn’t seem to have any effect.

Any suggestions, @gadgetoid or others? Thanks!

Richard