# Display HAT Mini as Linux Console?

**URL:** <https://forums.pimoroni.com/t/display-hat-mini-as-linux-console/18296>\
**Category:** Raspberry Pi\
**Created:** [November 26, 2021, 6:26am UTC](https://forums.pimoroni.com/t/display-hat-mini-as-linux-console/18296 "2021-11-26T06:26:11Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![maltheim](https://avatars.discourse-cdn.com/v4/letter/m/d2c977/32.png) [@maltheim](https://forums.pimoroni.com/u/maltheim)\
**Post date:** [November 26, 2021, 6:26am UTC](https://forums.pimoroni.com/t/display-hat-mini-as-linux-console/18296/1 "2021-11-26T06:26:12Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [November 26, 2021, 9:42am UTC](https://forums.pimoroni.com/t/display-hat-mini-as-linux-console/18296/2 "2021-11-26T09:42:17Z")

</div>

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)](https://github.com/juj/fbcp-ili9341)

---

<div class="post-metadata">

**Author:** ![maltheim](https://avatars.discourse-cdn.com/v4/letter/m/d2c977/32.png) [@maltheim](https://forums.pimoroni.com/u/maltheim)\
**Post date:** [November 26, 2021, 9:57am UTC](https://forums.pimoroni.com/t/display-hat-mini-as-linux-console/18296/3 "2021-11-26T09:57:46Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![maltheim](https://avatars.discourse-cdn.com/v4/letter/m/d2c977/32.png) [@maltheim](https://forums.pimoroni.com/u/maltheim)\
**Post date:** [November 26, 2021, 11:49am UTC](https://forums.pimoroni.com/t/display-hat-mini-as-linux-console/18296/4 "2021-11-26T11:49:50Z")

</div>

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](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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [November 26, 2021, 12:22pm UTC](https://forums.pimoroni.com/t/display-hat-mini-as-linux-console/18296/5 "2021-11-26T12:22:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![thymjan](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/thymjan/32/3944_2.png) [@thymjan](https://forums.pimoroni.com/u/thymjan)\
**Post date:** [December 6, 2021, 8:02pm UTC](https://forums.pimoroni.com/t/display-hat-mini-as-linux-console/18296/6 "2021-12-06T20:02:31Z")

</div>

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](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](https://us1.discourse-cdn.com/flex016/uploads/pimoroni/original/2X/8/8e2cafe2656950ed8d4cf368cc04534ce20e219e.jpeg)

---

<div class="post-metadata">

**Author:** ![madrigaldeath](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@madrigaldeath](https://forums.pimoroni.com/u/madrigaldeath)\
**Post date:** [January 12, 2022, 12:48am UTC](https://forums.pimoroni.com/t/display-hat-mini-as-linux-console/18296/7 "2022-01-12T00:48:16Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![malekithe\_1](https://avatars.discourse-cdn.com/v4/letter/m/f07891/32.png) [@malekithe\_1](https://forums.pimoroni.com/u/malekithe_1)\
**Post date:** [January 17, 2022, 10:08pm UTC](https://forums.pimoroni.com/t/display-hat-mini-as-linux-console/18296/8 "2022-01-17T22:08:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![thymjan](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/thymjan/32/3944_2.png) [@thymjan](https://forums.pimoroni.com/u/thymjan)\
**Post date:** [January 19, 2022, 4:56pm UTC](https://forums.pimoroni.com/t/display-hat-mini-as-linux-console/18296/9 "2022-01-19T16:56:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Maexchen](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@Maexchen](https://forums.pimoroni.com/u/Maexchen)\
**Post date:** [January 6, 2024, 9:30am UTC](https://forums.pimoroni.com/t/display-hat-mini-as-linux-console/18296/10 "2024-01-06T09:30:47Z")

</div>

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.

 ![IMG_0599](https://us1.discourse-cdn.com/flex016/uploads/pimoroni/original/2X/5/536264c2fe74905ecd68a62600f218e812342962.jpeg)

---

<div class="post-metadata">

**Author:** ![maltheim](https://avatars.discourse-cdn.com/v4/letter/m/d2c977/32.png) [@maltheim](https://forums.pimoroni.com/u/maltheim)\
**Post date:** [April 12, 2024, 2:06pm UTC](https://forums.pimoroni.com/t/display-hat-mini-as-linux-console/18296/11 "2024-04-12T14:06:20Z")

</div>

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+.

> **[GitHub - adafruit/Raspberry-Pi-Installer-Scripts](https://github.com/adafruit/Raspberry-Pi-Installer-Scripts)**
>
> Contribute to adafruit/Raspberry-Pi-Installer-Scripts development by creating an account on GitHub.

I followed the instructions for installing the necessary dependencies, then executed the [adafruit-pitft.py](https://github.com/adafruit/Raspberry-Pi-Installer-Scripts/blob/main/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:

```auto
# --- 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.

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [April 12, 2024, 6:45pm UTC](https://forums.pimoroni.com/t/display-hat-mini-as-linux-console/18296/12 "2024-04-12T18:45:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rogueroggie](https://avatars.discourse-cdn.com/v4/letter/r/90db22/32.png) [@rogueroggie](https://forums.pimoroni.com/u/rogueroggie)\
**Post date:** [April 18, 2024, 1:54am UTC](https://forums.pimoroni.com/t/display-hat-mini-as-linux-console/18296/13 "2024-04-18T01:54:54Z")

</div>

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 :)

---

<div class="post-metadata">

**Author:** ![maltheim](https://avatars.discourse-cdn.com/v4/letter/m/d2c977/32.png) [@maltheim](https://forums.pimoroni.com/u/maltheim)\
**Post date:** [April 18, 2024, 8:56am UTC](https://forums.pimoroni.com/t/display-hat-mini-as-linux-console/18296/14 "2024-04-18T08:56:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rogueroggie](https://avatars.discourse-cdn.com/v4/letter/r/90db22/32.png) [@rogueroggie](https://forums.pimoroni.com/u/rogueroggie)\
**Post date:** [April 18, 2024, 2:52pm UTC](https://forums.pimoroni.com/t/display-hat-mini-as-linux-console/18296/15 "2024-04-18T14:52:22Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![maltheim](https://avatars.discourse-cdn.com/v4/letter/m/d2c977/32.png) [@maltheim](https://forums.pimoroni.com/u/maltheim)\
**Post date:** [April 18, 2024, 8:49pm UTC](https://forums.pimoroni.com/t/display-hat-mini-as-linux-console/18296/16 "2024-04-18T20:49:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rogueroggie](https://avatars.discourse-cdn.com/v4/letter/r/90db22/32.png) [@rogueroggie](https://forums.pimoroni.com/u/rogueroggie)\
**Post date:** [April 19, 2024, 12:58am UTC](https://forums.pimoroni.com/t/display-hat-mini-as-linux-console/18296/17 "2024-04-19T00:58:32Z")

</div>

ok thanks i’ll try it.

thx in advance

---

<div class="post-metadata">

**Author:** ![maltheim](https://avatars.discourse-cdn.com/v4/letter/m/d2c977/32.png) [@maltheim](https://forums.pimoroni.com/u/maltheim)\
**Post date:** [April 19, 2024, 1:18am UTC](https://forums.pimoroni.com/t/display-hat-mini-as-linux-console/18296/18 "2024-04-19T01:18:48Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![rogueroggie](https://avatars.discourse-cdn.com/v4/letter/r/90db22/32.png) [@rogueroggie](https://forums.pimoroni.com/u/rogueroggie)\
**Post date:** [April 19, 2024, 2:11am UTC](https://forums.pimoroni.com/t/display-hat-mini-as-linux-console/18296/19 "2024-04-19T02:11:20Z")

</div>

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 :) :)

---

<div class="post-metadata">

**Author:** ![rogueroggie](https://avatars.discourse-cdn.com/v4/letter/r/90db22/32.png) [@rogueroggie](https://forums.pimoroni.com/u/rogueroggie)\
**Post date:** [April 19, 2024, 2:20am UTC](https://forums.pimoroni.com/t/display-hat-mini-as-linux-console/18296/20 "2024-04-19T02:20:48Z")

</div>

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

[Next page](https://forums.pimoroni.com/t/display-hat-mini-as-linux-console/18296.md?page=2)
