Getting SPI Interface to work - Pimoroni Pirate Audio

Hi All,

I’ve recently been working on getting Pimoroni Pirate Audio Dual Mic hat working on my Rock5a. Currently I’m focussed on getting the SPI based TFT screen to work.

I’m running an up-to-date version of Ubuntu Server by Joshua Reik (Spooky).

As I’m currently focussed on getting the display working, I’ve only connected the following wires:

  • 5v Power
  • GND
  • LCD SPI Mosi to pin 19
  • LCD Data / Command to pin 21
  • LCD SPI SCLK to pin 23
  • LCD SPI CS to pin 26
  • LCD Backlight to pin 33

I’ve enabled the rk3588-spi4-m1-cs0-cs1-spidev overlay, which has added /dev/spidev4.0 and .1 as well as added the dtparam=spi=on parameters in /boot/firmware/ubuntuEnv.txt file.

Unfortunately, I’ve been unable to get the display to display anything. My test code turns the backlight off and then on, then attempts to color the screen, but fails on this step silently.

The code I’m using can be found here: https://gist.github.com/dblencowe/3952a694ad94e7d2b78cd8578497eec6
I’ve successfully used this code to color the screen on a RaspberryPi 4, so I’m reasonably confident it is working as intended.

Are there any ideas on what could be different here? Am I missing some parameters or something like that?

Any help is appreciated!

Pin 26 seems to be strange. I would expect pin 24 for SPI4_CS0_M2, as the other pins you connect also use SPI4_*_M2.

Hi!
First off, dtparam=spi=on probably does exactly nothing.
Indeed, your pins mostly correspond to SPI4_M2, not M1 — yes, except pin 26. And pin 33 doesn’t have any PWM on it, so your backlight won’t work.
I’m afraid it’s just the way it is with 5A, its pinout is awkward at best (unlike 5B!), and is pretty much not compatible with any HATs out there. If you can somehow use alternative pins, do try that, though you’ll probably discover other quirks of 5A in the process… Its GPIO header is a disaster at best.

1 Like

Thanks both!

I’m using jumper cables between the hat and board to make debugging easier, so switching pins isn’t an issue at the moment.

I’d noticed the pin labelling for the 5a mentioned SPI4 so I’ve tried with that too, but with no success.

I’m using the pinout diagram here: https://pinout.xyz/pinout/pirate_audio_dual_mic. I’ll test now with the backlight moved to Pin 5 (PWM14_M2), if I understand the pinout for the 5a properly.

In addition to the above, I’ve switched out the previous overlay for rk3588-spi4-m2-cs0-spidev, which corresponds to the m2 labelling on the pins & mentioned above.