quanliew28 / gamepi20_drivers

MIT License
5 stars 1 forks source link

Differences for Kenrel 5.10? #1

Open 4920441 opened 3 years ago

4920441 commented 3 years ago

Hi,

I just downloaded the latest nightly retropie image and followed each step accordingly. but Nevertheless, I get a /dev/fb1 device, everything (remote via ssh) seems to be working fine, but when booted up, the display disables its background light and shows nothing.

Did I mentioned I use the new Raspberry pi Zero 2 ?

Any Ideas? since I have no errors and everthing seems to be okay, I don't know wherte to start....

[    7.662118] fbtft: module is from the staging directory, the quality is unknown, you have been warned.
[    7.670112] fb_st7789v: module is from the staging directory, the quality is unknown, you have been warned.
[    7.671034] fb_st7789v spi0.0: fbtft_property_value: width = 240
[    7.671056] fb_st7789v spi0.0: fbtft_property_value: height = 320
[    7.671078] fb_st7789v spi0.0: fbtft_property_value: buswidth = 8
[    7.671102] fb_st7789v spi0.0: fbtft_property_value: debug = 0
[    7.671121] fb_st7789v spi0.0: fbtft_property_value: rotate = 90
[    7.671142] fb_st7789v spi0.0: fbtft_property_value: fps = 60
[    8.121814] graphics fb1: fb_st7789v frame buffer, 320x240, 150 KiB video memory, 4 KiB buffer memory, fps=100, spi0.0 at 96 MHz
[    9.442850] uart-pl011 3f201000.serial: no DMA platform data
JanDubcak commented 3 years ago

Hi, I am having same issue with Zero 2 and GamePi. When I edit /boot/config.txt to use this dtoverlay, tft display goes dark on reboot after after few seconds.

Image I used: https://files.retropie.org.uk/images/weekly/retropie-buster-4.7.19-rpi2_3.img.gz Linux 5.10.63-v7+ armv7l GNU/Linux

4920441 commented 3 years ago

Hmm... still the same here, compiling seems to work though:

root@gpizero2:~#  dtc -@ -I dts -O dtb -o /boot/overlays/gamepi20.dtbo gamepi20.dts
/boot/overlays/gamepi20.dtbo: Warning (unit_address_vs_reg): /fragment@0/__overlay__/spidev@0: node has a unit name, but no reg property
/boot/overlays/gamepi20.dtbo: Warning (unit_address_vs_reg): /fragment@0/__overlay__/spidev@1: node has a unit name, but no reg property
root@gpizero2:~# ls

md5sum of my gamepi20.dts

5b272e378f93ed519dcd8d6fbdf785cf gamepi20.dts

but everything else looks promising, thoug backligt switches off and nothing to see on the display... Even with an external light source it seems not only the backlight is switched of, also the lcd is rendered totally black. (a least it looks like it)


root@gpizero2:~# dmesg | grep st7789
[    7.649477] fb_st7789v: module is from the staging directory, the quality is unknown, you have been warned.
[    7.650378] fb_st7789v spi0.0: fbtft_property_value: width = 320
[    7.650400] fb_st7789v spi0.0: fbtft_property_value: height = 240
[    7.650423] fb_st7789v spi0.0: fbtft_property_value: buswidth = 8
[    7.650447] fb_st7789v spi0.0: fbtft_property_value: debug = 0
[    7.650465] fb_st7789v spi0.0: fbtft_property_value: rotate = 0
[    7.650486] fb_st7789v spi0.0: fbtft_property_value: fps = 60
[    8.120193] graphics fb1: fb_st7789v frame buffer, 320x240, 150 KiB video memory, 4 KiB buffer memory, fps=100, spi0.0 at 96 MHz
root@gpizero2:~# 

running fbcp makes no difference....

4920441 commented 3 years ago

After a:

gpio -g write 24 1

the backlight is on again, but now with the distorted image, as shown in

"https://forums.raspberrypi.com/viewtopic.php?p=1826410#p1826410"

BUT: After recompiling the dts from this repository it works fine now!

(Sound isn't working yet, but thats a different story....)

JanDubcak commented 3 years ago

Hi, I have been digging a little on my own. Display works, image is nice(imho), but I have also troubles with getting the sound out of that speaker. Please check this thread for details.

XaFFaX commented 3 years ago

Hello, how did you manage to make this work if I may ask? I installed retropie using imager, then I followed instructions on the project page. All seems to be ok, no errors (other than the warnings), but I get no output on the device LCD (HDMI works fine). The backlight is getting enabled only for a short period during boot, later it is all black. Could you offer any advice?

JanDubcak commented 2 years ago

Hello @XaFFaX,

Sorry for late response :). You need to follow this git repo README, but once you clone it and before you build it comment out line 60. And then use sudo dtc ... command to compile this overlay.

That's basically what worked for me.

Now I am investigating that sound. I found out that if I use dtoverlay=pwm or straight in terminal `dtoverlay pwm pin=18 func=, I get error when applying this overlay. I am complete noob when it comes to this stuff so I will just try to increase logging and googling error messages when I have more time to get the time wokring. If I figure something out I will write in higher mentioned thread on raspberry forum.

XaFFaX commented 2 years ago

Hi, thanks for the response, it was not late at all :). Indeed prior to your response I already read your post on Raspberry forum and in fact after commenting out the line it does work! What brought me to the forum was another problem I had, which is that I had "mismatched" rotation on the displays. What I mean by that is when LCD was ok, then HDMI was upside down and when I changed rotation via config.txt, then LCD was upside down and HDMI was ok. It drove me crazy. This brought me to this driver repo and it did work fine (without changes) with old kernel that came with original gamepi20 images by waveshare (kernel 4.7 if I remember correctly). By fine I mean I had image, but rotation problem was still there. I fiddled with driver code (rotation) and it did change it but I could not get it to work (constantly I had mismatched rotation between LCD and HDMI, rotation of 270 should be correct, however it did not work, only 0, 90 and 180 worked). I wanted to give up, but finally I returned rotation back to what it was and it (magically) fixed itself so now it is not mismatched. Anyway the reason why I am describing this is that after I fixed it I decided to update retropie and this is when I got the "black screen" issue. Seems to be related to kernel (after update it is 5.10). The change you suggested helped, however I have the same issue with the sound (or lack thereof). However I did manage to fix it :) (let me just mention that I am using Pi Zero W and not 2, however this seems to me like a software and not hardware related issue, so it may work for you). This is my /boot/config.txt:

# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
dtparam=i2c_arm=on
#dtparam=i2s=on
dtparam=spi=on

# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2

[all]
#dtoverlay=vc4-fkms-v3d
gpu_mem_256=128
gpu_mem_512=256
gpu_mem_1024=256
overscan_scale=1
hdmi_force_hotplug=1
hdmi_cvt=640 480 60 1 0 0 0
hdmi_group=2
hdmi_mode=1
hdmi_mode=87
#display_rotate=0
#dtoverlay=pwm
dtoverlay=gamepi20
audio_pwm_mode=2
dtoverlay=audremap,pins_18_19

This is probably similar to what you have. After those changes and reboot what I did was to go to raspi-config->system options->audio and change to "headphones" (without changes in config.txt this was not available, only HDMI was present). After that I went to retropie settings and under sound I selected "sysdefault" audio card and "speaker" as audio device and voila I have sound (just crank the volume up, I had the same problem with PCM that it did not work and dropped volume to 0%). I also got the warnings you mentioned but it did work fine, so I am not bothered by this.

Currently I cannot validate that, because I am compiling Vulkan driver on this Pi Zero and it takes AGES (been compiling for several hours already and it is probably still going to for a few, I think it was a bad idea), however for sure I had sound yesterday, so maybe try it out. If I have time, maybe I will post a video on youtube with this working.

Also I do have Pi Zero 2, however I need to solder in GPIO pins, when I do that I will swap the Pis (Pies?) and check if PI Zero 2 works as well, that would be nice.

Hope this helps.

JanDubcak commented 2 years ago

@XaFFaX Thank you very very much. This trick worked. When I tried before I did not know about that raspi-config enabling analogue and have been randomly selecting sound devices in retropie setup(out of pure despair) and I have definitely missed the correct combination.

I have tried this dtoverlay=audremap,pins_18_19 had it there commented out, but also with typo. I had a space after comma and before pins_18_19 and I wondered why PWM pins are still mapped to 12 and 13 (default option). And also didn't know about raspi-config audio setup.

There is still a bug where my sound level in retropie setup drops to 0 every time I visit that sound options window. But it works and that is the most important :).

Now when I have finished tinkering with GamePi upgrade. My kids can play games, But I have to wait till Christmas for RPi 4 to upgrade my nextcloud from 3B to have something new to play with :).

Note: I have overclocked Zero 2 to 1200 MHz. With that small heatsink it was with stable temperature between 50-60 while playing. It didn't feel uncomfortable in hands. However I never played for longer time than 10 minutes.

XaFFaX commented 2 years ago

Hi, great it worked. Pi Zero 2 is practically the same as Zero 1 aside of CPU and wifi if I am not mistaken, so it made sense that it should work on Pi 2 as well.

As for heatsinks - I have bought some as well, not sure if those will fit into gamepi20 though, given it is so sandwiched, but will try. In such case I will OC the CPU as well, given every little bit helps for Zero 1. It is kinda slow for N64/PS1 emulation unfortunately. However maybe some fiddling with emulator settings will help out with performance. Vulkan for that would be great, I saw a video of Quake 3 running on Pi Zero on Vulkan with like several dozen fps :O, so it is awesome...

JanDubcak commented 2 years ago

Hi, I have tried Quake on pi zero 2 and it handled it without single issue. OC to 1200. CPU utilization showed 16% (I guess 1 core, but not sure about what that monitor showed) with temperature maxed at 52 degrees. So that soldering would pay off. As to PS1 emulation I tried only crash bandicoot which runs flawlessly. N64 I tried only Mario Kart 64 and it was barely playable, but kids loved it because we played in 3 player mode on TV. I have tried some PSP racing games and none of them was playable.

Now I am trying to get KODI running on that small screen but there is an issue with fbcp freezing on loading of kodi. There is a workaround but I have not yet suceeded in applying it in correct way. I want it to play audio fairy tales in mp3. And I just really enjoy tinkering with it.

CPU heatsink cannot fit properly around 3.5mm female jack. but if you saw off few fins of it it fits there.

XaFFaX commented 2 years ago

Hello again, have you tried vkQuake or just standard Quake port? I have Quake port on this and it does not work too well. Getting like max 10fps? Do not have keyboard to plug in so could not do timedemo to check ;). If it was vkQuake, how did you install Vulkan drivers? As mentioned I did try to compile them, but tests fail, probably because those require X env to run and Retropie does not have it by default.

In regards to N64 - I ran Mario 64, initially it ran with like 0.5fps, but then I did some changes in settings (when game is starting you can press any key and configure emulator settings) and I managed to make it run with like ~10-20fps. Not great (not terrible ;) ), but maybe it can be optimized further (did not put too much time in that). I am talking about Pi Zero 1 to be clear.

PSP and KODI have not tried, but this makes me wonder if this would be capable to play YouTube or some video files. If PSP worked it would be nice, need to check if this can be optimized to run with acceptable fps. Maybe I will try to install Rasbian and then Retropie on top of that, that would be the best solution I think. Just wondering if X env would work on the LCD.

A lot of tinkering to do :DD, too bad my SD card reader broke and I am waiting for another one to arrive :/.