Jump to content

Pi ZERO W 1.54" HAT Faster Driver

Hi All

 

i Bought this 1.54" Hat for Raspberry Pi Zero W and i was disappointed in the performance with the included driver, or install the driver yourself from a fresh start. Slow FPS on the Display i think max was, 15fps on games, so i started to Compiling my own Driver and got some awesome result !!!

 

Here is a Video on the Performance Different 

 

This will be a How to install the Driver and compile it with better Setting/Less bloat ware = Faster/Smoother Result.

And how to install the GPIO Buttons Driver / Settings 

 

I use Windows personaly and two great applications for this task is Rufus for imaging https://rufus.ie/, and for SSH I use Putty https://www.putty.org/

For MAC & Linux users can you this applications UNETBOOTIN https://unetbootin.github.io/

 

1.Install Retropie on the Pi Zero W. I use a program called Rufus to install the image with.

Have a Keyboard inserted to the PI so you can go through All the settings 

Inn Raspi-Config you have to enable SSH and SPI

Set your Wifi Password so we can Use Putty to go to Terminal and Remember the ip address

Now Reboot the PI.

Now login to the pi via Putty (username and password ""if not changed"" it is pi & raspberry)

.

Now let upgrade/update the pi

.

sudo apt-get update && sudo apt-get upgrade

in a min or 2 press Y and ENTER

(This Takes a long time, if it looks like it hangs/stops dont power down it takes a long time to install trust me)

make a quick Reboot.

.

sudo reboot 

(you have to insert your username and password manually after the update and we will fix that. Username = pi Password = raspberry

Go to Raspi-config, Boot option, Desktop / CLI and choose, B2 Console Autologin. and exit out and it will ask for a reboot and yes for a reboot.

.

 

2. LCD Driver install 

Connect Putty again after reboot

You can just copy and paste into the Putty Terminal

.

git clone https://github.com/juj/fbcp-ili9341.git

.

cd fbcp-ili9341
.

mkdir driver
.

cd driver

.

cmake -DST7789VW=ON -DGPIO_TFT_DATA_CONTROL=22 -DGPIO_TFT_RESET_PIN=27 -DUSE_DMA_TRANSFERS=ON -DSPI_BUS_CLOCK_DIVISOR=20 -DDISPLAY_ROTATE_180_DEGREES=ON -DSTATISTICS=0 ..

.

make -j

.

Now the Driver has been installed. to test the Driver, type this 

.

sudo ./fbcp-ili9341

.

And the display should display a image. if a little fuzzy on the screen don't worry we have not set the Resolution yet to be 240x240 so let do that 

exit the command by pressing Ctrl and C

.

!!!SKIP THIS IF THE SCREEN IS WORKING!!!

### You can change BUS_CLOCK_DIVISOR=20 if it show fuzzy display or it is acting up, you can try to lower or increase the number. But for me 20 seems to work wonders.

But you need to Delete the Driver folder. do this "rm -r driver" and then "mkdir driver" to try to make a new driver with a different settings ###

If you are happy with the settings. Then lets change the resolution 

.

sudo nano /boot/config.txt

.

Copy these settings into the config.txt under overscan_scale=1

 

dtoverlay=DST7789VW,speed=60000000,fps=60,debug=32,bgr=1
hdmi_force_hotplug=1
max_usb_current=1
hdmi_group=2
hdmi_mode=9
hdmi_mode=87
hdmi_cvt 240 240 60 1 0 0 0
hdmi_drive=2

Make sure it look like this.

Then Ctrl and x, then press y and ENTER

.

Now lets make the driver start up every time we boot up the pi 

Copy this into the terminal 

 

cat <<EOT>> ~/1display
#! /bin/sh
### BEGIN INIT INFO
# Provides: 1display
# Required-Start:    \$local_fs
# Required-Stop:     \$local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start 1display
### END INIT INFO

PATH=/sbin:/bin:/usr/sbin:/usr/bin

sudo /home/pi/fbcp-ili9341/driver/fbcp-ili9341 &

exit 0

# vim:noet

EOT
sudo chown root:root ~/1display
sudo chmod 755 ~/1display
sudo mv ~/1display /etc/init.d/
sudo update-rc.d 1display defaults

 

 

You need to change the resolution/aspect ratio in the retro-arch and config-editor on retropie to by 1x1 aspect ratio and the resolution to 240x240

Your all Done  Now the LCD start after a reboot.

 

3. Getting the GPIO buttons to work

You need to install a program called Notepad++

Pop the sd card in to a PC and download this.

https://othermod.com/files/gpiobuttons.zip

and unzip into the Boot directory ""Boot/otherMod""

Then navigate to otherMod folder and look for a file called retrogame.cfg and Right click on it and open it with Notepad++

Replace It With This.

.
UP         05  # Up
DOWN       16  # Down
LEFT       13  # Left
RIGHT      06  # Right
A          21  # Square
Z          15  # X
S          20  # Triangle
X          12  # Circle
Q          23  # Left Trigger
W          14  # Right Trigger
ENTER      26  # Start
ESC        19  # Select
F1         03  # Retroarch
#VOLUMEDOWN 25  # Volume Down
#VOLUMEUP    5  # Volume Up
 

 

( This is how i like the Button setup )

!!!!!!!!!!!!!!! WARNING DONT CHANGE THE MIDDLE ROW OF THIS SETUP, IT CAN LEAD TO INTERNAL SHORT'S ONLY CHANGE LEFT ROW aka ENTER, ESC and so on !!!!!!!!!!!!!!!

Now pop back the sd card into the PI again and boot up

login with putty and type this in

.

sudo bash /boot/setupcontrols.bash

.

Press y and ENTER now the PI will reboot and your GPIO Button is now Active but need to got to the Gamepad configuration and setup the GPIO gamepad and after that do a reboot then all Done.

 

I did alot of reverse engineering on the LCD 1.54" hat to figure out all the GPIO pins layout, Drivers and even got the D-PAD Button to function.

 

And Special Thanks to Pætur Hentze for all the help with the Troubleshooting.

 

Enjoy!

 

 

Raspberry-Pi-Game-zero-W-2B-3B-1-54inch-mini-LCD-touchscreen.jpg_640x640.jpg

Link to comment
Share on other sites

Link to post
Share on other sites

  • 2 months later...

Your Welcome :D

In my case i think the HDMI worked while the Config was Active and the HAT was on :D

if you want to have better Resolution through HDMI, you have to go to the Boot Folder and change in the Config.txt file change this line form

 

This 

hdmi_cvt 240 240 60 1 0 0 0

to something like 

hdmi_cvt 480 480 60 1 0 0 0

480 x 480 works great on LCD and HDMI i have not tested Higher so the result may vary???

Enjoy 

Thanks

 

Link to comment
Share on other sites

Link to post
Share on other sites

  • 1 year later...

Here's the manufacturer schematic, by the way: https://www.crackedconsole.com/wp-content/uploads/wpforo/attachments/3/115-PCB-Datasheet.PNG

115-PCB-Datasheet.png

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×