User avatar
droptix
Posts: 16
Joined: Mon May 11, 2015 7:01 pm

Use GPIO pins *AND* HAT parallel?

Wed Nov 08, 2017 8:35 pm

I have a Speaker pHAT:

https://thepihut.com/collections/raspbe ... eaker-phat

It's taking all GPIO pins and I'm wondering if I can still use the unused GPIO pins while it's connected?

First problem: which pins are unused? (Does it matter at all?)

Also: How can I connect to the other pins while the pHAT is mounted? I've seen this "triplicator":

https://thepihut.com/products/triborg-p ... tor-40-pin

Will this work? Is it possible to split-up GPIO pins just like parallel connections (junctions)?

User avatar
davidcoton
Posts: 2430
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Use GPIO pins *AND* HAT parallel?

Wed Nov 08, 2017 9:02 pm

See pinout.xyz for the pinouts of many Hats and pHats, including yours.
So none of the general purpose GPIOs (if that isn't too tautological) are used. i2c is a bus, so that can be shared. I'm not sure about i2s.

In general anything used as an output could be shared, as long as two peripherals want the same signals. Inputs cannot be shared unless they are designed that way.
If one pHat leaves all the connections for another unused, it should be possible to share the Pi just by paralleling the connections. BUT all Hats that meet the full specification use one non-sharable connection for the configuration EEPROM. So the Hat spec limits each Pi to one Hat (if you've ever tried juggling multiple human hats, yopu'll understand why that is a Good Thing). If only one of your Hats is a full implementation of the Hat spec, they might work together.
"If it ain't broke, fix it until it is."
“Raspberry Pi is a trademark of the Raspberry Pi Foundation”
The Pink Unicorn is a symbol of commitment to sensible discussion of future versions of the Raspberry Pi ™

User avatar
droptix
Posts: 16
Joined: Mon May 11, 2015 7:01 pm

Re: Use GPIO pins *AND* HAT parallel?

Sun Nov 12, 2017 7:56 pm

If I understand right the Speaker pHAT is using GPIO pins 2, 3, 18, 19, 21 (BCM numbers). It's easy to conclude that I still can use all other pins than these 5 ones...

In my eyes it makes no sense to share the pins used by the pHAT except I want to read the incoming data.

I2S is a serial bus so it seems that it can be shared as well:

https://volumio.org/raspberry-pi-i2s-da ... s-so-good/

alphanumeric
Posts: 1273
Joined: Tue Jan 19, 2016 2:17 pm
Location: Sydney, Nova Scotia, Canada

Re: Use GPIO pins *AND* HAT parallel?

Wed Nov 15, 2017 12:39 pm

i2c can be shared, I'm doing it on several of my Pi's. On one Pi I have a Sense Hat, DS3231, SI1145, and BMP180 all connected to the same i2c pins. They all work no problem. I just mounted a Proto Hat with stacking header between my Pi and Sense Hat. All the other bits are wired via the Proto Hat. It also gives me easy access to any unused GPIO Pins to do with as I please.
https://www.adafruit.com/product/2310 On my Pi Zero's I use the Proto Bonnet, https://www.adafruit.com/product/3203
There are other ways to do it, Black hat mini Hack3r, https://shop.pimoroni.com/products/mini ... at-hack3r
pHat Stack, https://shop.pimoroni.com/products/phat-stack
And what you posted above. I avoid sharing a GPIO PINS with multiple devices where possible. Single functions, pins programed as an input or output. You start sharing those with two devices and weird things can happen. Just my opinion. It can be done, but that doesn't mean you should do it, IMHO. i2c is fine, that's what its for.

Return to “Advanced users”

Who is online

Users browsing this forum: JorgeP and 18 guests