Framebuffer support for Pirate Audio

Hello,
I have a Pirate Audio working on a RPi 0W. I was also able to run Mopidy succesfully with up to date Raspberry OS Buster. So the connector soldering on the Pi is good.

For my purposes, I need to use it as framebuffer device. Therefore I installed the adafruit software for this device, as described in this Tutorial,

Unfortunately after installation, the system hangs during the reboot and I can’t get it working as expected. So my question is, how it is possible to get it working? I mean the ST7789 display implemented on your pirate audio is the same as the one on the adafruit webpage. Can Iconfigure something different on the adafruit software to cooperate with your device?

At a wild guess, this may be because the Adafruit and Pimoroni screens use different pins, so the framebuffer tutorial might not be setting up the screen properly.

Adafruit’s guide says:

GPIO22 - Used to turn the backlight on and off. If you never want to turn the backlight off, cut the small jumper on the bottom of the PiTFT to free up GPIO22
SCK, MOSI, CE0 & GPIO25 - These are the display control pins. Note that MISO is not connected even though it is a SPI pin because you cannot read back from the display.

The Pinout.xyz page for Pirate Audio boards says that it uses GPIO13 for the backlight pin, SCK, MOSI, GPIO7 as the chip select, and GPIO9 as the command pin. You’d need to hoke through the files Adafruit gets you to install, see where it defines the pins, and change those.

Thanks, I will check this.

Yeah, SPI0 has two chip selects, CE0 and CE1, and the backlight can be just about any GPIO pin you want to use.

SPI0
GPIO 7, Pin 26, CE1
GPIO 8, Pin 24, CE0
GPIO 9, Pin 21, MISO
GPIO 10, Pin 19, MOSI
GPIO 11, Pin 23, SCLK

SPI1
GPIO 16, Pin 36, CE2
GPIO 17, Pin 11, CE1
GPIO 18, Pin 12, CE0
GPIO 19, Pin 35, MISO
GPIO 20, Pin 38, MOSI
GPIO 21, Pin 40, SCLK

/boot/config.txt

dtparam=spi=on

dtoverlay=spi1-1cs #1 chip select
dtoverlay=spi1-2cs #2 chip select
dtoverlay=spi1-3cs #3 chip select

SCLK - Serial CLocK
CE - Chip Enable (often called Chip Select)
MOSI - Master Out Slave In
MISO - Master In Slave Out
MOMI - Master Out Master In

Sorry alphanumeric, I don’t understand what that means. I’m a newbie at this. Is the problem just a question of different GPIO pins used or are there other things to change in the code for the framebuffer software?

The Pi has several SPI buses that can be used. For the most part SPI0 is the one used, and some times SPI1. SPI0 can have two devices connected, one using CE0 and the other using CE1. Or “one” device using “either” one of those two chip selects.
If your code is looking for something on CE0 for example, but your display is using CE1, it won’t work.
The Pimoroni python examples will have a screen setup section like this. That is as near as I can tell what the Pirate Audio Screen uses.

disp = ST7789.ST7789(
    port=0,  # 0 is SPI0 and 1 is SPI1
    cs=1,    # 0 is CE0 and 1 is CE1
    dc=9,    # 9 for SPI0 and 19 for SPI1
    backlight=13, # can be any controllable GPIO pin
    rotation=90,
    spi_speed_hz=10000000
)

The Pimoroni screens for the most part use SPI0 but don’t always use CE0. Sometimes they use CE0 sometimes CE1. Likely because of circuit layout and track routing etc.

Anyway, long story made short. You need to edit the Adafruit code so it can access the Pimoroni screen. That is assuming its not already a match. It needs to be setup for SPI0, CE1. Don’t worry about the backlight unless its not on. It should default to on even with no signal of connection to it. You only need it to turn the backlight off, as near as i can tell anyway.

Thanks for your explanation. May I can ask directly.
Do you know where in the code I have to do the changes to get the ST7789_240x240 as frambuffer running? If not, you may can give me some hints, where I could search for it?

That I don’t know, my Linux skills are Noob level at best. Somebody on the Adafruit forum may be able to tell you though?

Hi alphanumeric,
I think it’s more a Python thing than a Linux one, but anyway I will ask there for it.
Thanks for your kindly support.

That’s the thing whch file and where is it? Find the right file and i may be able to edit it to work.

I like to run squeezelite + Cava at the LCD so I also need frambuffer ^^
I did not edit the scripts pins so my display is dark atm
Currently I run the adafruit script and try to fin what it changes
At boot.txt this was added:

hdmi_force_hotplug=0
dtparam=spi=on
dtparam=i2c1=on
dtparam=i2c_arm=on
dtoverlay=drm-minipitft13,rotation=0

It is the first time I try something like this but if I have success I will inform you

Pimoroni should really include framebuffer at there guide…

Yeah, hopefully you let us know, if you succeed.
Independent from this. Did you install the framebuffer software from Adafruit, which I referred to in my first post?

Yeah I bet a lot of stuff happens if you run the
sudo python3 adafruit-pitft.py --display=st7789_240x240 --rotation=0 --install-type=console

Is there an overlays folder with drm-minipitft13 in it?
EDIT: Looking at the installer under
“type”: “st7789_240x240”,
it has
“overlay_src”: “overlays/minipitft13-overlay.dts”,
“overlay_dest”: “/boot/overlays/drm-minipitft13.dtbo”,
“overlay”: “dtoverlay=drm-minipitft13,rotation={pitftrot}”,
I’d have a look at the dts and or dtbo files.

Raspberry-Pi-Installer-Scripts/adafruit-pitft.py at master · adafruit/Raspberry-Pi-Installer-Scripts (github.com)

@alphanumeric There is the file

I have asked at the pimoroni disord if someone tried to setup framebuffer…
The problem is that pimoroni did not wire the a specific pin (I think the RST) to the GPIO.
So you need a hardware mod to use framebuffer… that sucks…
Then it should be possible to set it up like here:

EDIT: I have sent them the link to the adafruit one and maybe there is hope he said

That would be really nice if this could be get working. Thanks again for your help.

I can’t make any sense out of that dts file. =(

Sorry, I was not able to care about this project. Unfortunately I have still no idea how to get the pirate audio as framebuffer working. I have still no idea if the problem can be solved with changed entries in the /boot/config.txt, do I need to change the code or is it a question of incompatible wiring?

That I don’t know? I have a Pirate Audio Speaker and had thought of trying this. I just never found my round 2it.

Seems there is no support from pimoroni for this. Or is there anybody out there?