Getting a Pirate audio pHAT and Adafruit TFT Bonnet to work together?

Moderators: adafruit_support_bill, adafruit

Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Locked
User avatar
DanielMGessel
 
Posts: 13
Joined: Fri Dec 01, 2017 1:41 am

Getting a Pirate audio pHAT and Adafruit TFT Bonnet to work together?

Post by DanielMGessel »

I'd like to combine an Audio pHAT and a TFT Bonnet into one Hat-sized dual-screen Raspberry Pi Powered gadget.

My experience is in C coding, and I should be able to work through rewriting the Python code in C on Raspberry Pi OS Lite, using generic Linux I/O calls for SPI and GPIO.

There are a few conflicts for GPIOs, though, and I'm not so good with electronics. I'm thinking the simplest thing, without modifying the boards, is to use a long-pin riser header on the audio pHAT, but clip some pins and jumpering from the I2C lines passed through on the TFT Bonnet.

I've never done anything like this before: is this a reasonable thing to try? Most importantly, even if it doesn't come together, I don't want the magic blue smoke to leak out of the "headgear". As long as I don't connect to the 5V power lines by accident, am I mostly covered?

Any better ideas?

Thanks.

Adafruit TFT + Joystick Bonnet: https://www.adafruit.com/product/4506
Pirate Audio pHAT w/Headphone Amp: https://www.adafruit.com/product/4454
Pimoroni Hat Hacker: https://www.adafruit.com/product/4673
The Pirate Audio board pinout: https://pinout.xyz/pinout/pirate_audio_headphone_amp
The Adafruit TFT pinout is here: https://learn.adafruit.com/adafruit-1-3 ... pi/pinouts

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Getting a Pirate audio pHAT and Adafruit TFT Bonnet to work together?

Post by adafruit_support_mike »

I don't think it's fundamentally impossible, but you'll need to keep track of the interfaces.

Both TFTs will want to use the RasPi's main SPI pins (MOSI, MISO, and SCK), which is okay because SPI is designed to share those signals. Each display will also need its own Chip Enable pin to tell them when to use the shared pins. That's okay because Raspbian assumes there will only be two SPI devices connected at any time, so it provides the pins CE0 and CE1.

The audio pHAT's DAC uses I2S, which is separate from the SPI pins, so you shouldn't see any conflicts there.

User avatar
DanielMGessel
 
Posts: 13
Joined: Fri Dec 01, 2017 1:41 am

Re: Getting a Pirate audio pHAT and Adafruit TFT Bonnet to work together?

Post by DanielMGessel »

adafruit_support_mike wrote: Sun Mar 19, 2023 5:44 am I don't think it's fundamentally impossible, but you'll need to keep track of the interfaces.
Thanks! I noticed the Adafruit Bonnet uses CE0 and the Pimoroni pHAT uses CE1 - so that's cool. I think the challenge is the Data/Command signal the LCD controller has: the Bonnet wires that to GPIO 25 and the pHAT seems to repurpose the MISO pin (GPIO 9). That would be fine except for two things: the pHAT uses GPIO 25 to enable the amp, so I'm going to try to jumper a wire from the passthrough of one of the I2C pins on the Bonnet to the pHAT's connector for GPIO 25. The second is I'm a little worried that repurposing GPIO 9 might not play well with recent kernel drivers, but my tests show opening /dev/spidev0.0 leaves both GPIO 9 and GPIO 10 available (MISO and MOSI, respectively), so I don't think I need to learn kernel coding for the time being.

Mostly, I'm worried about getting good connections jumpering (or ones that are too long, but I don't think the distances vs speeds are a problem).

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Getting a Pirate audio pHAT and Adafruit TFT Bonnet to work together?

Post by adafruit_support_mike »

If you're using the CircuitPython code to control the TFT Bonnet, you can simply move the D/C signal to another, unused pin and tell the code what pin to use:

Code: Select all

# Create the display
cs_pin = DigitalInOut(board.CE0)
dc_pin = DigitalInOut(board.D25)
reset_pin = DigitalInOut(board.D24)
You can do the same with the kernel module, but that would force you to compile your own version to match the pin you choose.

User avatar
DanielMGessel
 
Posts: 13
Joined: Fri Dec 01, 2017 1:41 am

Re: Getting a Pirate audio pHAT and Adafruit TFT Bonnet to work together?

Post by DanielMGessel »

Thanks! There’s been a bit of a shipping snafu on my latest order from Adafruit, but I’ll start playing with SW while I’m waiting.

Locked
Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/

Return to “Adafruit Raspberry Pi® accessories”