Automation Hat Mini Display RPi 5

I have bought a Automation Hat Mini and attached it on a RPi 5.
Analog in works!
But, when I try to connect to the display using
disp = st7735.ST7735(port=0,cs=st7735.BG_SPI_CS_FRONT,dc=9,backlight=25,rotation=270,spi_speed_hz=4000000)
I get an
ValueError: (22, ‘Invalid argument’)

If I choose something else for dc (eg. 24) I do not get an error, but obviously it does not work.

I guess GPIO 9 is reserved for MISO!

Have anybody had success using the Automation Hat Mini on RPi 5?

Thanks
Torben

This might help.

# Create ST7735 LCD display class.
disp = st7735.ST7735(
    port=0,
    cs=st7735.BG_SPI_CS_FRONT,
    dc=9,
    backlight=25,
    rotation=270,
    spi_speed_hz=4000000
)

# Initialize display.
disp.begin()

from here,

EDIT: ops, maybe not? That looks like what your using? Assuming you have it entered correctly in your code. If you use the preformated text option, the </> button, it will retian your code formatting when you post it. It makes it easier to read. ;)

Thanks

I started by just running the analog.py example, so it is not a simple typo.

I can add that I get this in dmesg

[   50.803510] pinctrl-rp1 1f000d0000.gpio: pin gpio9 already requested by 1f00050000.spi; cannot claim for pinctrl-rp1:578
[   50.803522] pinctrl-rp1 1f000d0000.gpio: error -EINVAL: pin-9 (pinctrl-rp1:578)

1f00050000.spi seems to be the EEPROM.
I have updated all installed packages.
I have tried to uninstall “rpi-eeprom”

Thanks

This sounds very familiar. I have a faint memory that in one of the posts here somebody described how to free the GPIO9 pin but I can’t find it now. It has to do with an overlay that claims the pin for SPI. Maybe check your config.txt.

This site can come in handy.

You can select spi etc and see what pins are used.

And even get pinouts for hats etc.

I think I read that thread Bernhard mentioned. I can’t find it either. I don’t have that bit of hardware on hand to tinker with so I’ll tag along for now. I do have that display as a breakout and a breakout garden though, so I may yet try a few things. Probabaly tomorrow though.

EDIT Here is some info that I just remembered I had, might help.

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

I think this might be the thread with the answer?

Yes, this is it. Quoting it here in case somebody else is searching for it:

For anyone else hitting this later: the combo that worked was dtoverlay=spi0-2cs,no_miso in /boot/firmware/config.txt — frees GPIO9 from the SPI0 MISO alt-function (which gpiod/st7735 needs to claim as a DC pin) while keeping both chip-selects available (since the Enviro+ LCD is wired to CS1).