Hyperpixel 4.0 Touchscreen Rotate with Display


#1

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?


#2

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


#3

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

#4

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


#5

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.


#6

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!


#7

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

#8

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.


Hyperpixel 4.0 - touch not working
#9

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


#10

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!


#11

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?


#12

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!


#13

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


#14

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.


#15

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