SPI connection driver alternatives for ILI9341V display?
-
Pi Model: Raspberry Pi Zero W
Power Supply used: 5V 3A generic power suply
RetroPie Version: 4.8 (Linux retropie 5.10.103+)
Built From: Raspberry Pi Imager
Guides used:-
fbcp-ili9341 driver: https://bytesnbits.co.uk/retropie-raspberry-pi-0-spi-lcd/
-
panel-mipi-dbi Linux display driver: https://github.com/notro/panel-mipi-dbi/wiki
Hello everyone !
I bought two different displays same size and characteristics (320x240 TFT LCD). The red pcb is an ILI9341 and black pcb is ILI9341V. They main differences are that black pcb one (ILI9341V) is missing MISO(SDO) pin, SD card slot and resistive touch pins (red does not have resistive touch anyways).
The red pcb display is used in many tutorials. I followed the tutorial linked above in Retropie 4.8 and it worked nice.
I bought the black pcb display because I am trying to fit everything in a GBA shell so its size is more convenient. I read that ILI9341 and ILI9341V are pretty much the same and drivers should work for both so I tried just swaping displays to see if it worked.
Sadly black pcb display ILI9341V was not working with fbcp-ili9341 driver so I switch to Raspberry OS to see if it was a display fault at first.
I got the display working using panel-mipi-dbi Linux display driver and tried to replicate it in Retropie but it did not work. Is it panel-mipi-dbi Linux display driver available in Retropie 4.8?
Later I tried to modify fbcp-ili9341 source code according to the ILI9341V datasheet that I found in https://www.orientdisplay.com/pdf/ILI9341V.pdf . The display just stays white.
What are my alternatives now? I am pretty confused why both displays works with panel-mipi-dbi Linux display driver using almost the same init command sequence (just modify color inversion and orientation) but fbcp-ili9341 driver does not work at all.
Thanks for reading !
-
-
...
I got the display working using panel-mipi-dbi Linux display driver and tried to replicate it in Retropie but it did not work. Is it panel-mipi-dbi Linux display driver available in Retropie 4.8?RetroPie is not an OS in itself, just a collection of scripts installed on-top of an exisiting OS. So the question is if the
panel-mipi-dbi
is available in the OS that RetroPie is installed. The RetroPie image (4.8) is based on an older version of RaspiOS, if the display is working on the latest RaspiOS (which is based on Debian 12 bookworm), then you can install manually RetroPie on-top of that RaspiOS version. Support for that OS release is still in beta, but most things should work....
What are my alternatives now? I am pretty confused why both displays works with panel-mipi-dbi Linux display driver using almost the same init command sequence (just modify color inversion and orientation) but fbcp-ili9341 driver does not work at all.
I'n not familiar with those drivers and how/why they differ. You may try to ask in the RPI forums, since they probably have more users of the hardware which may offer an insight. As far as RetroPie is concerned - my advice is to start with a working RaspiOS Lite installation and then manually install RetroPie (see here).
-
@mitu As you mentioned, the most easy thing to do was installing Raspberry OS Lite (Debian 11 Bullseye), get the display working and then installing RetroPie packages using the setup script.
I had to modify a line in
/boot/config.txt
filedtoverlay=vc4-kms-v3d,nohdmi
because, as
it was stated in this forum post, emulationstation will not load in the SPI screen but the HDMI screen even if the HDMI is not connected. Once that modification was done, It displays an 'failed to load driver: panel-mipi-dbi' message but still loads emulationstation in the SPI display.I have found a really strange behaviour between emulationstation, GPIOnext and
panel-mipi-dbi
driver. When the display driver is active, emulationstation will display a black screen at boot if GPIOnext is using some specific pins.Tested with:
-
RaspberryPi Zero W
-
Raspberry Pi OS lite, Debian 11 Bullseye (raspberry pi imager)
-
GPIOnext commit 2f01bd1
-
RetroPie-Setup scrip commit 5412ef4
Pins used in GPIOnext that will always cause emulationstation to show a black screen on the SPI display when using
panel-mipi-dbi
driver:7,8,10,11,12,13,15,16,21,36,37,38,40
Pins that can be set in GPIOnext and sometimes do not make emulationstation going black screen:3,5,26,29,31,32,33,35
Pins that are not mentioned are being used by the display or they are not labeled as GPIOs.This "black screen" does not mean that emulationstation is not working, in fact the logs shows no errors and the raspberry pi can be rebooted via SSH, when reboot is performed the display shows system reboot logs so everything seems ok. Here it is the emulationstation log when one of the "conflictive" pins is set and display is black:
Mar 28 13:41:08 lvl2: EmulationStation - v2.11.2rp, built Jan 27 2024 - 01:17:13 Mar 28 13:41:08 lvl2: Parsing XML file "/opt/retropie/supplementary/emulationstation/resources/mamenames.xml"... Mar 28 13:41:10 lvl2: Parsing XML file "/opt/retropie/supplementary/emulationstation/resources/mamebioses.xml"... Mar 28 13:41:10 lvl2: Parsing XML file "/opt/retropie/supplementary/emulationstation/resources/mamedevices.xml"... Mar 28 13:41:10 lvl2: Creating window... Mar 28 13:41:15 lvl2: Created window successfully. Mar 28 13:41:15 lvl2: GL vendor: Broadcom Mar 28 13:41:15 lvl2: GL renderer: VC4 V3D 2.1 Mar 28 13:41:15 lvl2: GL version: 2.1 Mesa 20.3.5 Mar 28 13:41:15 lvl2: Checking available OpenGL extensions... Mar 28 13:41:15 lvl2: ARB_texture_non_power_of_two: ok Mar 28 13:41:16 lvl2: Loading system config file /etc/emulationstation/es_systems.cfg... Mar 28 13:41:17 lvl1: System "amstradcpc" has no games! Ignoring it. Mar 28 13:41:17 lvl1: System "arcade" has no games! Ignoring it. Mar 28 13:41:18 lvl1: System "atari2600" has no games! Ignoring it. Mar 28 13:41:18 lvl1: System "atari5200" has no games! Ignoring it. Mar 28 13:41:18 lvl1: System "atari7800" has no games! Ignoring it. Mar 28 13:41:19 lvl1: System "atari800" has no games! Ignoring it. Mar 28 13:41:19 lvl1: System "atarilynx" has no games! Ignoring it. Mar 28 13:41:20 lvl1: System "fba" has no games! Ignoring it. Mar 28 13:41:20 lvl1: System "fds" has no games! Ignoring it. Mar 28 13:41:20 lvl1: System "gamegear" has no games! Ignoring it. Mar 28 13:41:21 lvl1: System "gb" has no games! Ignoring it. Mar 28 13:41:21 lvl1: System "gbc" has no games! Ignoring it. Mar 28 13:41:22 lvl1: System "mame-libretro" has no games! Ignoring it. Mar 28 13:41:38 lvl1: System "mame-mame4all" has no games! Ignoring it. Mar 28 13:41:39 lvl1: System "mastersystem" has no games! Ignoring it. Mar 28 13:41:39 lvl1: System "megadrive" has no games! Ignoring it. Mar 28 13:41:39 lvl1: System "n64" has no games! Ignoring it. Mar 28 13:41:40 lvl1: System "neogeo" has no games! Ignoring it. Mar 28 13:41:40 lvl1: System "nes" has no games! Ignoring it. Mar 28 13:41:41 lvl1: System "ngp" has no games! Ignoring it. Mar 28 13:41:41 lvl1: System "ngpc" has no games! Ignoring it. Mar 28 13:41:41 lvl1: System "pcengine" has no games! Ignoring it. Mar 28 13:41:42 lvl1: System "psx" has no games! Ignoring it. Mar 28 13:41:42 lvl2: Parsing XML file "/home/pi/.emulationstation/gamelists/retropie/gamelist.xml"... Mar 28 13:41:42 lvl1: System "sega32x" has no games! Ignoring it. Mar 28 13:41:43 lvl1: System "segacd" has no games! Ignoring it. Mar 28 13:41:43 lvl1: System "sg-1000" has no games! Ignoring it. Mar 28 13:41:44 lvl1: System "snes" has no games! Ignoring it. Mar 28 13:41:44 lvl1: System "vectrex" has no games! Ignoring it. Mar 28 13:41:44 lvl1: System "zxspectrum" has no games! Ignoring it. Mar 28 13:41:47 lvl2: Added known joystick 'GPIOnext Joypad 1' (instance ID: 0, device index: 0) Mar 28 13:41:47 lvl2: Added known joystick 'GPIOnext Joypad 1' (instance ID: 0, device index: 0)
To add a bit more context, this is the content of the
/boot/config.txt
file, where I had to add some dtoverlay configuration in order to configure the display andmipi-panel-dbi
driver.dtparam=spi=on dtparam=audio=on camera_auto_detect=1 display_auto_detect=1 dtoverlay=vc4-kms-v3d,nohdmi max_framebuffers=2 disable_overscan=1 gpu_mem=128 [cm4] otg_mode=1 [all] [pi4] arm_boost=1 [all] dtoverlay=mipi-dbi-spi,speed=32000000 dtparam=compatible=ili9341v\0panel-mipi-dbi-spi dtparam=width=320,height=240,width-mm=57,height-mm=43 dtparam=reset-gpio=25,dc-gpio=24,backlight-gpio=23
GPIOnext works correctly if
,nohdmi
is removed fromdtoverlay=vc4-kms-v3d,nohdmi
and the following lines are commented (SPI display will not work, just HDMI):dtoverlay=mipi-dbi-spi,speed=32000000 dtparam=compatible=ili9341v\0panel-mipi-dbi-spi dtparam=width=320,height=240,width-mm=57,height-mm=43 dtparam=reset-gpio=25,dc-gpio=24,backlight-gpio=23
I am newbie to all of this so It would be nice if someone could help me figuring out why would emulationstation have that strange behaviour when certain pins are selected in GPIOnext just if
mipi-dbi-spi
is working. This is part of a handheld console project and is inconvenient having just 8 available GPIO pins out of the 10 I would need.Maybe this should be moved to a new topic, anyways I think it is helpful in case someone using
panel-mipi-dbi
driver find these issues. -
-
Run
kmsprint
and look at the 'Connector' status, the one for the display you're using. If it's not reported as 'connected', then SDL will not initialize the display and EmulationStation will not display anything. EmulationStation doesn't do anything special and doesn't care how your display is connected, it's using SDL to initialize and then use the video display. -
@mitu After making sure last version of
kms++-utils
was installed. when I runkmsprint
I get the following error:terminate called after throwing an instance of 'std::out_of_range' what(): map::at Aborted
I also tried with
xrandr
and got the following error:Can't open display
These errors happens both with
pgionext
service enabled (no emulationstation image) and disable (emulationstation image working). -
@josdelsan said in SPI connection driver alternatives for ILI9341V display?:
@mitu After making sure last version of kms++-utils was installed. when I run kmsprint I get the following error:
That means no KMS/DRM connector is present, so there's no GPU display support, hence no accelerated video/rendering possible.
Since Bullseye, there's no other GPU driver except the open source one, enabled with
dtoverlay=vc4-kms-v3d
inconfig.txt
. Maybemipi-dbi-spi
is not compatible with the KMS/DRM overlay ?EDIT: the post you referenced is for Pi5/Bookwor, while you're using Bullseye - the overlays may be different and work differently.
-
@mitu said in SPI connection driver alternatives for ILI9341V display?:
That means no KMS/DRM connector is present, so there's no GPU display support, hence no accelerated video/rendering possible.
Since Bullseye, there's no other GPU driver except the open source one, enabled with
dtoverlay=vc4-kms-v3d
inconfig.txt
. Maybemipi-dbi-spi
is not compatible with the KMS/DRM overlay ?To be honest, this goes far beyond my level of knowledge in this area.
I tried removing the
dtoverlay=vc4-kms-v3d
line inconfig.txt
. Now emulationstation boots withgpionext
service enabled. Display just loads emulationstation, no system logs or anything like before (during boot and reboot).I'm not sure if removing DRM VC4 V3D driver support is best way to solve the GPIOnext problem, but it works.
I have been doing some testing and I have noticed that display performance drops when emulationstation is launched. Using Raspberry OS screen is usually around 30fps. When emulationstation is launched at boot, the following error is shown before and drops to 2-3 fps. I don't know if this is normal since other drivers like
fbcp-ili9341
does not have that performance downgrade when using an ILI9341 display (which is almost identical to ILI9341V).I think this error shown before emulationstation boot might have something to do with it. It says it failed to load the driver, but if the driver was not working, display should not be working but it loads emulationstation. This error is just shown when DRM VC4 V3D driver is enabled since if it is disabled anything is displayed (just emulationstation), in the other hand gpionext does not affect this.
I wish I could give a more insightful point of view but, even with the insane amount of testing that I did, I just can share the results, I can't come up with a conclusion. I need to learn about many things before continuing.
Summing up:
- If
DRM VC4 V3D
driver is enabled,nohdmi
has to be added in order to load emulationstation in the SPI display instead the HDMI. - If
DRM VC4 V3D
driver andGPIOnext
is enabledemulationstation
will show a black screen if certains pins are set. - If
DRM VC4 V3D
driver is disabled just emulationstation works, no system logs or anything displayed. - Always fail to load
panel-mipi-dbi
driver before launchingemulationstation
but the display still works. - Display performance drops to unusable level when
emulationstation
boots.
- If
-
I'm not sure if removing DRM VC4 V3D driver support is best way to solve the GPIOnext problem, but it works.
It's definitely not. Removing it will throw away all the acceleration offered by the GPU drivers and you'll be using software (CPU) rendering which is very slow and makes the system practically unusable.
I advise you to try to make it work using the latest version of RaspiOS and to ask in the RPI forums for the necessary
config.txt
changes to make this work or to know if the configuration is supported at all (i.e. figure out any GPIO conflicts ?). -
@mitu said in SPI connection driver alternatives for ILI9341V display?:
It's definitely not. Removing it will throw away all the acceleration offered by the GPU drivers and you'll be using software (CPU) rendering which is very slow and makes the system practically unusable.
Now that you mentioned CPU, its usage goes up to 95% even if DRM VC4 V3D driver is enabled.
Before I go back to RPI forum, I would like to know where I can read more about how emulationstation GUI is loaded so I can provide some context, otherwise I will be sent back here again.
-
@josdelsan said in SPI connection driver alternatives for ILI9341V display?:
Before I go back to RPI forum, I would like to know where I can read more about how emulationstation GUI is loaded so I can provide some context, otherwise I will be sent back here again.
You can replace EmulationStation with any SDL/non-SDL app that uses a GLES/OpenGL context and you have the same result (i.e. RetroArch or Mame). There's nothing special about EmulationStation and you can achieve the same result with any of GL test applications from the
libsdl2-tests
, liketestgl2
ortestgles2
(from/usr/libexec/installed-tests/SDL2/
).
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.