Display HAT Mini as Linux Console?

I’ve been using a number of the Adafruit Mini Pi TFT displays as a Linux console display. This would seem to be possible with the Display HAT Mini since I believe it’s using the same underlying ST7789 library. Given that, I’d assumed (apparently mistakenly) that it would be possible to use the Display HAT Mini in this same capacity, but seeing no example, my subsequent attempt at using the Adafruit installer for the 320x240 ST7789 failed.

Is there a way to use the Display HAT Mini as a Linux console?

See if this helps, I haven’t tried it myself.
juj/fbcp-ili9341: A blazing fast display driver for SPI-based LCD displays for Raspberry Pi A, B, 2, 3, 4 and Zero (github.com)

Thanks for that, I’ll give it a try. The investment is the time it takes to flash an SD card, do the install and see what happens… but that looks more promising than using the stock Adafruit installer.

Well, I tried the juj library and realised it didn’t seem to support the Pimoroni HAT, but found the Pimoroni forked (PR) at https://github.com/pimoroni/fbcp-ili9341/tree/feature/pimoroni-display-hat-mini and built that using the following command line:

cmake .. -DPIMORONI_DISPLAY_HAT_MINI=ON -DSPI_BUS_CLOCK_DIVISOR=40 -DDISPLAY_BREAK_ASPECT_RATIO_WHEN_SCALING=ON -DBACKLIGHT_CONTROL=ON -DST7789=ON -DGPIO_TFT_DATA_CONTROL=-1

I wasn’t sure about the last directive so I set it to -1. I was able to build it but when executing fbcp-ili9341 I ended up with a failure:

bcm_host_get_peripheral_address: 0x3f000000, bcm_host_get_peripheral_size: 16777216, bcm_host_get_sdram_address: 0xc0000000
BCM core speed: current: 400000000hz, max turbo: 400000000hz. SPI CDIV: 40, SPI max frequency: 10000000hz
Allocated DMA channel 7
Allocated DMA channel 1
Enabling DMA channels Tx:7 and Rx:1
DMA hardware register file is at ptr: 0x75c67000, using DMA TX channel: 7 and DMA RX channel: 1
DMA hardware TX channel register file is at ptr: 0x75c67700, DMA RX channel register file is at ptr: 0x75c67100
Resetting DMA channels for use
DMA all set up
Initializing display
Creating SPI task thread
InitSPI done
vc_dispmanx_display_open failed! Make sure to have hdmi_force_hotplug=1 setting in /boot/config.txt

And to note, I have set hdmi_force_hotplug=1 in /boot/config.txt and rebooted. So I’m now at a bit of a loss, maybe just wait until someone at Pimoroni has this working and the PR has been merged. I’m nowhere near the C programmer necessary to debug what’s actually going wrong here.

Way above my skill level, that’s for sure. Bummer.

I’ve got this sort of working with a raspberry pi 4 (buster).
Far from being an professional I did the following steps:

  1. git clone https://github.com/pimoroni/fbcp-ili9341.git
  2. Edited the changes for the 5 files by hand with copy and paste wich are shown here (didn’t manage to download this)
    https://github.com/juj/fbcp-ili9341/pull/242/files
  3. cmake .. -DPIMORONI_DISPLAY_HAT_MINI=ON -DSPI_BUS_CLOCK_DIVISOR=40 -DDISPLAY_BREAK_ASPECT_RATIO_WHEN_SCALING=ON -DBACKLIGHT_CONTROL=ON
    (in the build directory)
  4. make -j
    sudo ./fbcp-ili9341
  5. If your raspi is configured to start with the desktop your display should be cloned to the display hat mini.

IMG_8755

1 Like

This got me pretty far, however step #4 brings me a ‘command not found’ error when attempting to do:
sudo ./fbcp-ili9341 part. Does this make sense?

Hey,

I’m trying to get the same working up.
Did you add any overlays by any chance?
My screen comes out blank after doing the same as your steps. I’m using a Raspberry Pi Zero W.

You have to be in the directory where the binary was compiled to.
Take a look with „ls“ and/or cd up or down till you found it.

Hi,
I know this thread is a bit older but I wanted to say thank you as it helped me immensely.
My goal was to run pihole on a Zero2W and have the PADD output on the Display Mini hat.

I can definitely say that I have a few more gray hairs now :) I had to go back and forth so do not have a proper documentation but here are some things to consider if you want to go down the same route (it works, but probably isn’t the most elegant solution).

  • follow thymjan’s suggestion
  • when compiling there is also a switch to turn off the information overlay -DSTATISTICS=0
  • in the config.h you can configure the screen to be left on (otherwise it goes into sleep soon) - my plan is to write another python script that turns the back light on and off via one of the buttons.
  • for some reason the screen originally only turned on when another hdmi monitor was plugged in even when hdmi_force_hotplug=1 was set but eventually it worked without 2nd screen. The issue then was that the screen thought it was wider than it is. I played with fbset a bit and eventually it worked.

2 Likes

Well, after much banging around I finally hit upon something that worked, and it didn’t involve compiling any code. I’ve been using one of those tiny Adafruit miniPiTFT 1.14" displays as a console on one of my robots, so I fired it up to see if I could see any clues on how I did it. I found a directory “Raspberry-Pi-Installer-Scripts”, so I cloned the latest repository onto a brand new 32-bit Bullseye OS, this for a Raspberry Pi 3 B+.

I followed the instructions for installing the necessary dependencies, then executed the adafruit-pitft.py script. It asks you for the specific TFT display you have (I chose “[6] ST7789 2.0”) and a rotation angle of “[1] 90 degrees”, then goes off forever to do its magic. After the installation finished it asked to reboot. The initial result was a black screen. I began fiddling with the configuration that was installed at the bottom of /boot/config.txt and managed to get it to work. It’s a bit counterintuitive as the rotation, width and height seem reversed, but for a 320x240 landscape display the following is what’s working for me:

# --- added by adafruit-pitft-helper Sat Apr 13 00:57:51 2024 ---
[all]
hdmi_force_hotplug=0
dtparam=spi=on
dtparam=i2c1=on
dtparam=i2c_arm=on
dtoverlay=fbtft,spi0-1,st7789v,dc_pin=9,width=240,height=320,led_pin=13,rotate=90,speed=40000000
dtparam=width=240,height=320
dtparam=dc-gpio=25,backlight-gpio=22
# --- end adafruit-pitft-helper Sat Apr 13 00:57:51 2024 ---

There’s a vibrating yellow line at the bottom of the display (I think it’s called a “tear line”), and I’ve not been able to get rid of that, but the display otherwise works fine as a console.

1 Like

Best guess is the width=240,height=320 is because of the rotate=90?
Regardless, thanks for posting what worked.

hi im pretty new to this kinda stuff and im trying to make a night vision device with the display hat mini and the zero 2 w. ive tried many different tutorials and such but when i saw this thread i was hopeful, but now ive run into something. when using @thymjan method, when using the 3rd step, it said “CMake Error: The source directory “/home/pi” does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.” and i dont know what to do. it would do wonders if someone could help me with this :)

I’m probably not the person to help you, but the first thing to come to mind is this: what’s the name of the user on your Raspberry Pi? Is it “pi” or something else? IOW, what’s the path of your home directory? If the username is not “pi” you have to add an argument that provides the actual home directory path.

1 Like

Oh. Yes the username is pi. So what you’re saying is if I have a fresh copy of raspberry pi os with a different username then it would recognize the directory?

No, I was suggesting that newer versions of the Pi OS want you to stop using “pi” as the username, which is a security issue. Not using “pi” caused some installation scripts to fail (as “pi” had been the default since the beginning, and developers were generally making the mistaken assumption that it was the username).

So what this means is that my suggestion for a possible solution was wrong.

My other suggestion is that the file “CMakeLists.txt” would not normally be in your home directory, it would be in the directory where the code is located. Your home directory should not be the source directory for the project. You need to build the project from the directory where the make file is located.

ok thanks i’ll try it.

thx in advance

Given you say you are a beginner, building a library isn’t necessarily a trivial exercise. I was able to get the Display HAT Mini running without doing any manual compilation of any kind, just performing the standard installation followed by some mucking about with values in /boot/config.txt. You might try that first unless you actually want to learn how to build your own library. Which is of course an entirely viable thing to do… (part of all this is learning new things)

I mean it would be really cool to build/learn how to build my own library, but i kinda have a deadline for this on the 24th of april cuz im going on a school camping trip and i wanna be a flashlight tag god cuz no one can notice me :). also cuz im in 8th grade and its a big transition to high school and stuff :) :)

Also, i tried your suggestion that CMakeLists.txt wouldn’t normally be in the home directory. it is fact, not. it thinks im building it in the home directory. i am building it in fbcp-ili9341. here’s what im doing:
cd fbcp-ili9341
cmake … -DPIMORONI_DISPLAY_HAT_MINI=ON -DSPI_BUS_CLOCK_DIVISOR=40 -DDISPLAY_BREAK_ASPECT_RATIO_WHEN_SCALING=ON -DBACKLIGHT_CONTROL=ON