pimoroni / hyperpixel4

Driver for the Pimoroni HyperPixel 4.0" Touchscreen Display
https://shop.pimoroni.com/products/hyperpixel-4?variant=12569485443155
329 stars 46 forks source link

Hyperpixel4 and 64-bit Ubuntu #95

Open alexanderbsd opened 4 years ago

alexanderbsd commented 4 years ago

Hi all,

I understand that 64-bit Ubuntu Server is not supported, but just wanted to understand if it is possible to fix the issue below. I installed hyperpixel4 -b 64bit-beta drivers and managed to get to a point where the driver seems to be loading, the touch is working and there is video output, but there seems to be some issues with timings? Or maybe something more advanced? Thanks

4bdbd0c4c941c58ed90add81a69f1f70d44394a1_2_375x500

config.txt

arm_64bit=1 device_tree_address=0x03000000

dtoverlay=vc4-kms-v3d

dtoverlay=hyperpixel4

gpio=0-25=a2

gpio=19=op,dh

overscan_left=0

overscan_right=0

overscan_top=0

overscan_bottom=0

framebuffer_width=800

framebuffer_height=480

enable_dpi_lcd=1 display_default_lcd=1 dpi_group=2 dpi_mode=87 dpi_output_format=0x7f216 dpi_timings=480 0 10 16 59 800 0 15 113 15 0 0 0 60 0 32000000 6

Gadgetoid commented 4 years ago

I'm afraid I'm totally at a loss here. I've never seen a display so completely whacky. I recognise some Ubuntu-ish colours in there... but that's about it.

Do you have a link to the OS image you used? I could at least try to duplicate this.

alexanderbsd commented 4 years ago

I used the latest image from Raspberry Pi Imager - 64-bit Server 20.04.1 LTS with 5.4 kernel. I did a fresh installation, added RPi.GPIO and turned off I2C, SPI and UART in syscfg.txt. I had to manually add config lines from install.sh (-b pi4-64bit-beta) to config.txt and everything seems to be working pretty much out of the box - the screen and touch are responding, but the actual video output is messy. I tried using the hyperpixel4-init code from other branches, but it had no impact.

Gadgetoid commented 4 years ago

Did you install a desktop environment?

alexanderbsd commented 4 years ago

Yes, I tried ubuntu-desktop and ubuntu-unity-desktop on different installations with lightdm. Same result.

Gadgetoid commented 4 years ago

Oh boy I'm not getting very far very quickly with this. The installer is so broken on Ubuntu that I'm surprised you're getting anywhere.

I'm just passed the hyperpixel-init-being-broken stage 😆 and built the libgpio init instead. The libgpiod version should work, though it's missing the latest init tweaks.

Installing ubuntu-desktop because I'm presently seeing nothing on the display.

Gadgetoid commented 4 years ago

Okay genius me didn't disable i2c, spi and UART- really off to a good start!

Now I am seeing a desktop login prompt!

image

Here's my config:

cat /boot/firmware/config.txt

# Please DO NOT modify this file; if you need to modify the boot config, the
# "usercfg.txt" file is the place to include user changes. Please refer to
# the README file for a description of the various configuration files on
# the boot partition.

# The unusual ordering below is deliberate; older firmwares (in particular the
# version initially shipped with bionic) don't understand the conditional
# [sections] below and simply ignore them. The Pi4 doesn't boot at all with
# firmwares this old so it's safe to place at the top. Of the Pi2 and Pi3, the
# Pi3 uboot happens to work happily on the Pi2, so it needs to go at the bottom
# to support old firmwares.

[pi4]
kernel=uboot_rpi_4.bin
max_framebuffers=2

[pi2]
kernel=uboot_rpi_2.bin

[pi3]
kernel=uboot_rpi_3.bin

[all]
arm_64bit=1
device_tree_address=0x03000000

# The following settings are "defaults" expected to be overridden by the
# included configuration. The only reason they are included is, again, to
# support old firmwares which don't understand the "include" command.

enable_uart=1
cmdline=cmdline.txt

include syscfg.txt
include usercfg.txt

dtoverlay=hyperpixel4
enable_dpi_lcd=1
dpi_group=2
dpi_mode=87
dpi_output_format=0x7f216
dpi_timings=480 0 10 16 59 800 0 15 113 15 0 0 0 60 0 32000000 6

cat /boot/firmware/syscfg.txt

# This file is intended to be modified by the pibootctl utility. User
# configuration changes should be placed in "usercfg.txt". Please refer to the
# README file for a description of the various configuration files on the boot
# partition.

enable_uart=0
dtparam=audio=on
dtparam=i2c_arm=off
dtparam=spi=off
cmdline=cmdline.txt

I'm using the init from the pi4-libgpiod branch. You'll need libgpiod2 and libgpiod-dev to compile it.

Touch presently not working- so might have to use the touch fix branch.

alexanderbsd commented 4 years ago

Thanks a lot for checking. Turns out it was a hardware issue. I got a replacement today and tried the 64bit-beta branch again. Everything works well - display, rotation and touch. Install.sh is broken, but it is easy to fix -> manually add lines to config.txt and install RPio and python-is-python3 packages. Just in case, decided to use hyperpixel4-init from the pi4 branch.

eaceto commented 4 years ago

Hello @Gadgetoid It's great to see your Ubuntu booting screen. I would like to know if you can share with us which Image you used and steps you take in order to reach to that config. Thanks very much!

Arudinne commented 4 years ago

Hello,

I managed to get the installer script to work on a fresh install of Ubuntu Mate 64-bit 20.04.1. my changes can be found here: https://github.com/Arudinne/hyperpixel4/tree/pi4-ubuntu-mate

The following packages needed to be installed via apt-get first:

rpi.gpio python-is-python3 arandr

The only thing that doesn't seem to work as it should is restoring the LCD's rotation after a reboot (touch screen config seems fine). I thought I managed to resolve that by adding the following line to /etc/lightdm/lightdm.conf:

display-setup-script=/usr/share/dispsetup.sh

but upon testing with a clean install the pi seems stuck in a boot loop after I added that line. Everything else worked before that.


Apologies if any of this isn't exactly best practice, I'm not really a Linux expert, I know just enough to break stuff.

Edit; I did another clean install and the edit to /etc/lightdm/lightdm.conf seems to be working as it should. I must have messed something else up elsewhere.

20200902_020141.jpg

alexanderbsd commented 4 years ago

I had the same issue when I compiled a 32bit driver (pi4 branch) for 64-bit Ubuntu Server. I used the 64bit-beta branch and replaced the content of hyperpixel4-init from the pi4 branch. Also, I made same changes as @Gadgetoid in config files (config.txt and usercfg.txt). There are still some issues (see screenshots below), but not sure whether they are software or hardware related.

Here is my setup. I only tested the 64-bit server image.

  1. Ubuntu 20.04.1 LTS 64-bit installed through Raspberry Imager
  2. Sudo apt-get update & upgrade to 5.4-raspi-1016 kernel
  3. Install rpi.io and python-is-python3
  4. Desktopify —en ubuntu
  5. Hyperpixel4 -b 64bit-beta branch
  6. Edit manually configs and copy the compiled driver in firmware/overlays
  7. Replace the content of hyperpixel4-init from the pi4 branch (original also works, but output is a bit noisy)
  8. All seems to work ok in the portrait mode, but couldn’t get the touch work correctly in other orientations. I think Ubuntu uses another default driver for Goodix. I think it can be fixed easily, but not sure what to do about the issues below:

7EA1969E-C5D9-45F5-BD00-09BA9E43D4A2

E7EC0057-9471-4315-B6E7-9374FA695A20 7D71BE52-5845-4DF5-ABB7-6B0AD73829D3

Arudinne commented 4 years ago

I started with the pi4-i2c-fix branch and had zero issues with the touchscreen that I could see.

I do seem to have that corona around the LCD even after shutting it down (While power is still applied). I just installed the 32-bit version of Raspberry Pi OS using the imager and ran the installer (pi4-i2c-fix) and it seems fine now so it doesn't seem like a hardware issue.

eaceto commented 4 years ago

I tried following the steps some of you did, but could see either the ubuntu login screen or anything else...

El mié., 2 sept. 2020 a las 9:57, Arudinne (notifications@github.com) escribió:

I started with the pi4-i2c-fix branch and had zero issues with the touchscreen.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/pimoroni/hyperpixel4/issues/95#issuecomment-685717681, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGURAAXEISNUW2FI4LHIQLSDY6MLANCNFSM4QGEQDEQ .

-- Ezequiel L. Aceto https://eaceto.dev Skype: ezequiel.aceto - Twitter: @eaceto_dev

mogenson commented 3 years ago

Just wanted to mention that I've had a good experience with this display + Pi 400 + Ubuntu 20.10 + Phosh + Wayland.

The orientation and scale can be set through the UI or from the command line via: wlr-randr --output DSI-1 --scale 1 --transform 90. Touch follows the rotation correctly.

phosh

eaceto commented 3 years ago

Great! Which branch are you using? Is Ubuntu 64bits?

On Sun, 29 Nov 2020 at 17:07 Michael Mogenson notifications@github.com wrote:

Just wanted to mention that I've had a good experience with this display + Pi 400 + Ubuntu 20.10 + Phosh + Wayland.

The orientation and scale can be set through the UI or from the command line via: wlr-randr --output DSI-1 --scale 1 --transform 90. Touch follows the rotation correctly.

[image: phosh] https://user-images.githubusercontent.com/900731/100552243-f5a77980-3253-11eb-80b8-dbe79b2dda33.jpg

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/pimoroni/hyperpixel4/issues/95#issuecomment-735446448, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGURAAVMH3GIF2X5766LQ3SSKSWJANCNFSM4QGEQDEQ .

-- Ezequiel L. Aceto https://eaceto.dev Skype: ezequiel.aceto - Twitter: @eaceto_dev

mogenson commented 3 years ago

Yep.

eaceto commented 3 years ago

That's bloody brilliant! Would you mind share the full how-to with us?

On Sun, 29 Nov 2020, 17:20 Michael Mogenson, notifications@github.com wrote:

Yep.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/pimoroni/hyperpixel4/issues/95#issuecomment-735448085, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGURAEH42M56XE6TPIEJPTSSKUJHANCNFSM4QGEQDEQ .

tristansokol commented 2 years ago

I just got this up and running after quite a bit of time and wanted to share my steps in case it could help others.

Goal: Cyberdeck with Raspi400 & hyperpixel4 touch with Ubuntu Desktop (21.10) I started with a fresh ubuntu install from the raspi imager, and below are all the steps that I think you would need to do to get a successful install.

Some prerequisites:

sudo apt-get update
sudo apt-get upgrade #this was important to get the i2c to work correctly
sudo apt get install rpi.gpio python-is-python3

/boot/firmware/config.txt

[pi4]
max_framebuffers=2

[all]
kernel=vmlinuz
cmdline=cmdline.txt
initramfs initrd.img followkernel

# Enable the audio output, I2C and SPI interfaces on the GPIO header
dtparam=audio=on
dtparam=i2c_arm=on
dtparam=spi=on

# Enable the KMS ("full" KMS) graphics overlay, and allocate 128Mb to the GPU
# memory. The full KMS overlay is required for X11 application support under
# wayland
dtoverlay=vc4-fkms-v3d
gpu_mem=128

# Uncomment the following to enable the Raspberry Pi camera module firmware.
# Be warned that there *may* be incompatibilities with the "full" KMS overlay
#start_x=1

# Comment out the following line if the edges of the desktop appear outside
# the edges of your display
disable_overscan=1

# If you have issues with audio, you may try uncommenting the following line
# which forces the HDMI output into HDMI mode instead of DVI (which doesn't
# support audio output)
#hdmi_drive=2

# If you have a CM4, uncomment the following line to enable the USB2 outputs
# on the IO board (assuming your CM4 is plugged into such a board)
#dtoverlay=dwc2,dr_mode=host

# Config settings specific to arm64
arm_64bit=1
dtoverlay=dwc2

#https://github.com/pimoroni/hyperpixel4/issues/95
enable_uart=0
dtparam=audio=on
dtparam=i2c_arm=off
dtparam=spi=off

dtoverlay=hyperpixel4
enable_dpi_lcd=1
dpi_group=2
dpi_mode=87
dpi_output_format=0x7f216
dpi_timings=480 0 10 16 59 800 0 15 113 15 0 0 0 60 0 32000000 6

This got me to a screen that worked, but was the incorrect cyber deck rotation. I tried arandr and wlr-randr as both are mentioned above but arandr just didn't seem to work, or apply changes and the other complained about wlr-output-management-unstable-v1 not being implemented. I ended up just rotating under settings in ubuntu GUI.

Also it wasn't obvious to me reading some of the debugging tips but when you run ls /dev/i2c-* you should see a device like /dev/i2c-22

Other issues that helped me #167 #111,

eaceto commented 2 years ago

Wow! Congrats!!! hope this can get into the official doc!

KjeldJensen commented 2 years ago

For what it is worth I got it to work on Ubuntu 22.04.1 64bit (including rotation) with help from Tristan above (thanks a lot) and another forum thread focusing on Raspberry Pi OS. Here is what worked for me:

It is important to update-upgrade before updating config.txt, otherwise it will be overwritten (which I learned the hard way):

sudo apt update
sudo apt upgrade
sudo adduser pi dialout 
sudo apt install rpi.gpio-common python-is-python3

sudo nano /boot/firmware/config.txt

Change these lines:

dtparam=i2c_arm=off
dtparam=spi=off

Add these lines at the end of the file:

# Hyperpixel4
dtoverlay=vc4-kms-dpi-hyperpixel4
dtparam=rotate=270,touchscreen-swapped-x-y,touchscreen-inverted-x

Save, reboot and it works...

d3k4-k3rb3r0s commented 5 months ago

For what it is worth I got it to work on Ubuntu 22.04.1 64bit (including rotation) with help from Tristan above (thanks a lot) and another forum thread focusing on Raspberry Pi OS. Here is what worked for me:

It is important to update-upgrade before updating config.txt, otherwise it will be overwritten (which I learned the hard way):

sudo apt update
sudo apt upgrade
sudo adduser pi dialout 
sudo apt install rpi.gpio-common python-is-python3

sudo nano /boot/firmware/config.txt

Change these lines:

dtparam=i2c_arm=off
dtparam=spi=off

Add these lines at the end of the file:

# Hyperpixel4
dtoverlay=vc4-kms-dpi-hyperpixel4
dtparam=rotate=270,touchscreen-swapped-x-y,touchscreen-inverted-x

Save, reboot and it works...

did you get the login screen to rotate?