-
Notifications
You must be signed in to change notification settings - Fork 271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ST7789V2: Add Pimoroni Display HAT Mini 2.0" 320x240 LCD #242
base: master
Are you sure you want to change the base?
Conversation
* Add general support for the ST7789V2. * Add the ST7789V2-based 320x240 Display HAT Mini. Configure: cmake .. -DPIMORONI_DISPLAY_HAT_MINI=true -DSPI_BUS_CLOCK_DIVISOR=40 -DDISPLAY_BREAK_ASPECT_RATIO_WHEN_SCALING=ON
I've compiled this, but I'm only getting a black screen when running with a Raspberry Pi Zero 2 - are there any changes needed to the startup Pi config, or any additional flags that need to be passed to enable the backlight to turn on? |
Not insofar as I'm aware. I haven't tested on a Pi Zero 2 though. Or- in fact- tested on any Pi but the one I made these changes on, so I'll have to look into that tomorrow time permitting. |
yes, same for me. a black screen on Zero 2. |
Same here, just rebuilt on a fresh SD card on the same Pi that I originally tested with and... black screen of doom. 😬 That'll teach me not to do a clean test. I suspect it's either some missing configuration, or some init that happened on my screen once during testing and isn't getting set in the final build. Edit: Oh it's even sillier, it really does seem to just be the backlight not actuating! |
I should probably force it to on, but for the time being you should be able to fix this by blowing away your build dir and configuring with:
|
Hmm, that seems to make the backlight come on, but I still get a black screen with a fresh Pi Zero 2.. I'm wondering if I have a bad connection?.. When I first plugged in the HAT Mini it showed a full green LED... Now I can make out the red, green and blue components of the LED, not as bright 😕 |
I’ll admit I still haven’t tested on the Zero 2 W (my office is a fridge right now so soldering is going to be painful) so there’s a chance that a fundamental incompatibility is the problem here- I’ve only scratched the surface of this codebase. It could also easily be a connection issue, or an SPI divider issue, or something else. I’ll try on actual hardware tomorrow just to eliminate your setup being the problem. |
// 320x240 2.0" ST7789V2 HAT | ||
// https://shop.pimoroni.com/products/display-hat-mini | ||
|
||
#ifdef PIMORONI_DISPLAY_HAT_MINI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might there ever be mini display hats from Pimoroni based on other controller technology? If there's a possibility, then maybe this might better be #ifdef PIMORONI_ST7789V2_DISPLAY_HAT_MINI
?
If not, then the name lgtm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a possibility. Good point!
The mention of
at https://pinout.xyz/pinout/display_hat_mini# caught my eye. In original documentation at https://github.com/juj/fbcp-ili9341#about-tearing I wrote these musings
It reads like this kind of tear effect pin could be a way to receive the vsync clock. In that case, it would be possible to implement vsync tearing free updates by timing the uploads to avoid straddling the hsync line, if someone wants to give a go at a research project. I have not seen a SPI based display actually allow receiving vsync, such features have been restricted to the direct RGB displays - though maybe they've done something different on the wiring/controller of display.. |
Tested on my Zero 2. The latest cmake options line works well. Now I am thinking about connecting the Hat buttons and with a mouse driver, which is a totally different request. |
It's the opposite, in fact, the "TE" pin sends a clock pulse from the display controller to the host when the display reaches a given row- a bit like a scanline interrupt. It's then highly dependend on you being able to respond quickly enough to burst the display data to the screen before it starts the next field. It can be configured in both V-Blank and V/H-Blank modes, though in practise it's only really useful to consider a vertical "interrupt" (I'm going to call it an interrupt because that's basically what it is) to signal when it's ready for the next frame. This display is, indeed, the exception to prove the rule: genuine, bonafide, 320x240 pixels, landscape! @juj If you want one to play with, drop me an email! |
Oooh buttons to... a very crude mouse input could work. Though with only four buttons for directions and no button for "push" we're coming up a little short. One of our mini trackballs would also work. Here's a crude Python example that uses uinput to inject mouse events - https://github.com/pimoroni/trackball-python/blob/master/examples/evdev-mouse.py |
That sounds perfect. It should then be possible to implement flicker free display updates by synchronizing fbcp-ili9341 pixel updates to that signal.
Thanks for the offer! I could get one, but I must say I unfortunately don't have much time to tinker on this front at the moment, so probably doesn't make sense. I'll check again what the situation is after I clear up some of the current projects. |
I was not successful with fbcp-ili9341 on a RPi400 + Pimoroni Flat Hat Hacker board + Pimoroni Display Hat Mini 2.0inch 320x240px (DHM2) with OS bullseye. Next installed OS version buster on a new RPiZero2W with same hw accessories. fbcp-ili9341 built ok (I added the mods by @Gadgetoid. Only raspi-config > 6 Advanced Options > A2 GL Driver > G3 GL (Fake KMS) worked. Full KMS did not work. Put the command to start in /etc/rc.local. The output of fbcp-ili9341 when started 'by hand' ends with: ''All initialized, now running main loop''. It makes the DHM2 to switch on but it shows a frozen image of the last demo app I ran before this evening (see the image). Question: Btw. the LCD switches off after ca. 30 seconds. When I hit a key on the keyboard the LCD comes up again. |
Just followed the instructions on a Z2W and it's up and running. I had to comment out fbcp does the display blanking if it has control of the backlight - need to omit |
Hi Philip, Thank you! I now also have bullseye running on the RPiZero2W. Running the pong script is OK. However pygame-demo.py and pygame-basic.py have no video output to the Display Hat Mini 2 that is. Below three screenshots: 1st of boot/config.txt part (btw SPI was ON); the 2nd of pong.py showing the DHM2 with the pong video and in the back filtered output of htop; 3rd the pygame-demo.py without video output and in the back also filtered output of htop. Interesting (for me) is that both scripts appear to open four PID's, so four processes running simultaneously. Or is it a kind of 'artifact' of htop. I didn't see it in top. fbcp-ili9341 was not running |
I don't know if I did it in a correct way: to add a detection to the RPiZero2W, in CMakeLists.txt I added at the end of the MATCHES string: (line 33 ). and the messag(... text (line 34) Then modified also lines 58 and 60. dmesg reports the RPiZero2W as "ARMv7", not "ARMv7A" as in CMakeLists.txt. That is why I have some doubt. Situation after boot: |
Still having a black screen issue even after using -DBACKLIGHT_CONTROL=ON, the display seems to go blank about a minute or two after initializing. Using a Pi Zero W with the latest version of Raspberry Pi OS. |
Does the display work at all? If you're using the Pi Zero W over SSH then I suspect it's turning off because there's no keyboard/mouse input to wake it up. You might want to disable backlight control and just use a dtoverlay or simple script to turn the right pin on. |
I do have a keyboard and mouse connected to the Pi, and I can type and move the cursor, I've also tried the work around to modify the config.txt file to keep the backlight on with pin 13, even after rebooting the display still shuts off. UPDATE: I have also noticed that instead of going black, the screen will sometimes freeze, and I will need to run the "sudo /home/pi/fbcp-ili9341/build/fbcp-ili9341" command to get it working again. Meanwhile, any mouse movements or typing I do while the display is frozen will appear when the display restarts. |
I have patched the code and installed this on a Pi Zero W. I am getting the backlight turning on, and /dev/fb0 coming into existence, but nothing on screen. Has something broken it? |
Worked for me adding |
Update 2023-07-31. After updating the RPi2W O.S. and after cloning the latest version of Pimoroni's repo displayhatmini, and following the steps recomended in README.md the examples (also upgrading pygame): pong.py and pygame.py ran OK 2023-07-31.12.21.02_short.mp4 |
Yes, thank you, that seems to have done the trick. For reference the cmake line for a Pi Zero W I'm using is: cmake .. -DPIMORONI_DISPLAY_HAT_MINI=ON -DSPI_BUS_CLOCK_DIVISOR=30 -DDISPLAY_BREAK_ASPECT_RATIO_WHEN_SCALING=ON -DBACKLIGHT_CONTROL=ON -DUSE_DMA_TRANSFERS=OFF -DSTATISTICS=0 -DDISPLAY_ROTATE_180_DEGREES=ON Backlight control needs to be on for the screen to be illuminated, but screen blanking is unhelpful for my use case, so I also comment out TURN_DISPLAY_OFF_AFTER_USECS_OF_INACTIVITY in config.h |
Hi, I tried this and I still got a black screen. Trying to get this working on a Pi Zero W too. Are you running Bullseye or something else? Also, would you mind pasting your Thanks |
Hi,
I don't know if I can answer this e-mail notification.
My RPi2W is running Raspbian GNU/Linux 10 (buster) (according to the contents of the file /etc/os-version.
I am not using my RPi2W at the moment however I hooked it up. It has WiFi connection but unfortunately it is not in the same subnet so I cannot SSH into the device in this moment.
Regards
De: hopg ***@***.***>
Enviada: 20 de agosto de 2023 21:00
Para: juj/fbcp-ili9341 ***@***.***>
Cc: Paulus H.J. Schulinck ***@***.***>; Comment ***@***.***>
Assunto: Re: [juj/fbcp-ili9341] ST7789V2: Add Pimoroni Display HAT Mini 2.0" 320x240 LCD (PR #242)
cmake .. -DPIMORONI_DISPLAY_HAT_MINI=ON -DSPI_BUS_CLOCK_DIVISOR=30 -DDISPLAY_BREAK_ASPECT_RATIO_WHEN_SCALING=ON -DBACKLIGHT_CONTROL=ON -DUSE_DMA_TRANSFERS=OFF -DSTATISTICS=0 -DDISPLAY_ROTATE_180_DEGREES=ON
Backlight control needs to be on for the screen to be illuminated, but screen blanking is unhelpful for my use case, so I also comment out
TURN_DISPLAY_OFF_AFTER_USECS_OF_INACTIVITY
in config.h
Hi, I tried this and I still got a black screen. Trying to get this working on a Pi Zero W too.
Are you running Bullseye or something else? Also, would you mind pasting your /boot/config.txt as well please?
Thanks
-
Reply to this email directly, view it on GitHub<#242 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ACFPT3SFGIOTSEQ74BBCHNTXWJUDFANCNFSM5GYJI2AQ>.
You are receiving this because you commented.Message ID: ***@***.******@***.***>>
|
Hi,
I just managed to SSH into my RPI2W. Attached a copy of the config.txt file
Regards,
De: hopg ***@***.***>
Enviada: 20 de agosto de 2023 21:00
Para: juj/fbcp-ili9341 ***@***.***>
Cc: Paulus H.J. Schulinck ***@***.***>; Comment ***@***.***>
Assunto: Re: [juj/fbcp-ili9341] ST7789V2: Add Pimoroni Display HAT Mini 2.0" 320x240 LCD (PR #242)
cmake .. -DPIMORONI_DISPLAY_HAT_MINI=ON -DSPI_BUS_CLOCK_DIVISOR=30 -DDISPLAY_BREAK_ASPECT_RATIO_WHEN_SCALING=ON -DBACKLIGHT_CONTROL=ON -DUSE_DMA_TRANSFERS=OFF -DSTATISTICS=0 -DDISPLAY_ROTATE_180_DEGREES=ON
Backlight control needs to be on for the screen to be illuminated, but screen blanking is unhelpful for my use case, so I also comment out
TURN_DISPLAY_OFF_AFTER_USECS_OF_INACTIVITY
in config.h
Hi, I tried this and I still got a black screen. Trying to get this working on a Pi Zero W too.
Are you running Bullseye or something else? Also, would you mind pasting your /boot/config.txt as well please?
Thanks
-
Reply to this email directly, view it on GitHub<#242 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ACFPT3SFGIOTSEQ74BBCHNTXWJUDFANCNFSM5GYJI2AQ>.
You are receiving this because you commented.Message ID: ***@***.******@***.***>>
# 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
#---------------------------------------------------------
# for text of /Pimoroni/fbcp-ili9341/build/fbcp-ili9341
#hdmi_group=2
#hdmi_mode=87
#hdmi_cvt=320 240 60 1 0 0 0
hdmi_force_hotplug=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
# To use the PL011 UART we need the next line
#core_freq=250
# 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
[all]
#dtoverlay=vc4-fkms-v3d
#dtoverlay=rpi-display
#dtoverlay=displayhatmini
max_framebuffers=2
#fbcon=map:10 fbcon=fontVGA8x8 logo.nologo
#gpio=13=op,dh
enable_uart=1
# See article www.abelectronics.co.uk/kb/article/1035/raspberry-pi-3-serial-port-
# File also in i/Raspberry_Pi/UART_serial_port
dtoverlay=disable-bt
|
Hi, bit of a noob with all this if someone is able to help? Running into a bit of an issue running the "make -j" command, it starts to build a bunch of CXX objects and then starts showing this error a bunch of times: "c++: error: _DST7789V2: No such file or directory" |
Hard to say, but did you run the cmake with the leading .. as explained in the build instructions (https://github.com/juj/fbcp-ili9341)? That error looks as though there are missing files, the two most likely causes of which would be not cloning the repository correctly or not running cmake correctly. |
It's running on a more or less stock Raspberry Pi OS, fully patched.
The driver unusually runs as a separate process. Here. for what it's worth is the config.txt on which the system is running.
|
Thanks for the reply. Yeah definitely did the .. , I redid the cmake command a couple times, trying the dots before and after the build options, as thought their placement could have been the issue but got the same errors each time. I did check through the lines that had to be added and the only place I can see where DST7789V2 appears is on line 212 in CMakeLists.txt, is that right? |
I successfully got this working today; The display does come to life and show mirrored HDMI output ONLY IF I also have a monitor hooked up at the time I run I do have all of the requisite lines commented out in the Now, ideally I would like the display to show the desktop on startup which I don't think will be that hard adding the executable to the rc.local file. However, I can't quite nail down why it only wants to output to the DHM when the HDMI port is occupied and outputting data. Any guidance is appreciated! Also, if anyone else might be struggling along the way I'm more than happy to help share my setup/configs so we can get this published to the main branch! |
This is ST7789V2 based which is otherwise pretty 1:1 to the other ST7789 boards except the controller has a 320x240 18-bit RAM region and doesn't need this hack (which confused me until I dived in and added ST7789V2 support):
fbcp-ili9341/st7735r.cpp
Lines 89 to 96 in 486a32e
Supports landscape/portrait orientation. And 0/180 degree rotation.
Configure:
-DBACKLIGHT_CONTROL=ON
to avoid a black screen (see below)