jw1234
Posts: 19
Joined: Sun Mar 28, 2021 7:01 pm

SOLVED: Howto wire some GPIO >=32 on RPi4?

Tue Apr 20, 2021 10:31 am

Maybe I am overlooking something but it seems as if the 40-pin header exclusively exposes GPIOs <=31 but not a single one from the >31 range - which seems to be rather silly.

I would like to use one of the upper range GPIOs to control my CPU fan *independently* of what is done with the lower GPIO pins. (I already have some timing critical stuff going on with the lower pins via GPCLR0/GPSET0 and the last thing I need would be to have some fan control script poke into those same registers causing conflicts. Using one of the upper range GPIOs however would allow to use the separate GPCLR1/GPSET1 registers thus eliminating the potential for conflicts.)

Is there some point on the RaspberryPi4B board where any of the upper range GPIOs is exposed such that one could easily attach a respective additional wire?
Last edited by jw1234 on Wed Apr 21, 2021 1:23 pm, edited 1 time in total.

LTolledo
Posts: 5109
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: Howto wire some GPIO >=32 on RPi4?

Tue Apr 20, 2021 10:43 am

use a magnifying glass....
if there are any paths that exposes the "upper GPIO" then use those
if none, there is no way to do it on the present board...

one may be able to access those... on a custom built board, if one is willing to pay a premium price for a minimum production lot.
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11010
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Howto wire some GPIO >=32 on RPi4?

Tue Apr 20, 2021 11:23 am

GPIOs >=32 are not exposed on a Pi4 or any other "normal" Pi variant as they are used for internal functions, eg camera, DSI display control, SD controller, Wifi, Bluetooth, ethernet, etc.
They are exposed on CM1 and CM3, but largely not on CM4 as there are more internal functions (eg ethernet, Wifi, and Bluetooth) available as options over CM1/3.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

jw1234
Posts: 19
Joined: Sun Mar 28, 2021 7:01 pm

Re: Howto wire some GPIO >=32 on RPi4?

Tue Apr 20, 2021 11:49 am

It is fascinating how quickly ppl jump forward to explain that something is strictly impossible.. :-)

From what I see here: \linux\arch\arm\boot\dts\bcm2711-rpi-4-b.dts

The useless camera connector seems to expose GPIO44 and GPIO45 as SDA0 and SCL0 (so that might be a point that can be easily soldered to). The CAM_GPIO might also be a candidate though I don't unterstand which (firmware) GPIO that one is actually mapped to. Other candidates might be PWM0_MISO (GPIO40) and PWM1_MOSI (GPIO41) which might be used for the audio jack (which I am not interested in either).

I am not interested in BT either so I'd rather salvage those pins for something useful as well (I'd suspect that those traces might be more difficult to solder to.. though I've not looked at the board yet).

Anyone that has experience with one of these impossible solutions to my problem?


PS: I have already blacklisted the respective camera driver bcm2835-v412.
Last edited by jw1234 on Tue Apr 20, 2021 1:04 pm, edited 2 times in total.

LTolledo
Posts: 5109
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: Howto wire some GPIO >=32 on RPi4?

Tue Apr 20, 2021 12:58 pm

good luck on finding a solution to your problem
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

jw1234
Posts: 19
Joined: Sun Mar 28, 2021 7:01 pm

Re: Howto wire some GPIO >=32 on RPi4?

Tue Apr 20, 2021 3:25 pm

Does anyone know which devices are connected to the I2C-0 (on the RPi4)? is it only the potential camera and DSI display controller or is there more stuff?

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

Re: Howto wire some GPIO >=32 on RPi4?

Tue Apr 20, 2021 4:31 pm

jw1234 wrote:
Tue Apr 20, 2021 3:25 pm
Does anyone know which devices are connected to the I2C-0 (on the RPi4)? is it only the potential camera and DSI display controller or is there more stuff?
HAT eeprom
PMIC?
Possibly other things, IDK.
Location: 345th cell on the right of the 210th row of L2 cache

User avatar
joan
Posts: 15541
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Howto wire some GPIO >=32 on RPi4?

Tue Apr 20, 2021 5:16 pm

What conflict do you expect from poking into the set/clr registers? The way they are designed means you would need a rogue setting for a conflict to appear.

jw1234
Posts: 19
Joined: Sun Mar 28, 2021 7:01 pm

Re: Howto wire some GPIO >=32 on RPi4?

Tue Apr 20, 2021 5:46 pm

I am a bit confused about the 3 different I2C-0 mappings that might be used at different points in time (GPIO0/GPIO1 vs GPIO28/GPIO29 vs GPIO44/GPIO45). And I don't understand why the official schematics (https://static5.arrow.com/pdfs2/2019/11 ... educed.pdf) use the logical SDA0/SCL0 labels rather than the actual GPIO pins that the respective connectors are wired to.. it just doesn't make any sense.

Is there any documentation that sheds some light on how that I2C stuff is actually used by the default components of the RPi4? e.g. which of the eight BSC masters inside BCM2711 is actually used for which built-in I2C device? are all internal devices using the same I2C-0 bus?

As for the GPIOs: according to "gpioinfo" there is the "gpiochip0" which handles all the 58 pins that can be found in the usual documentations. but then there apparantly is a second "gpiochip1" with 8 more GPIOs (with lines like "CAM_GPIO") - except that there doesn't seem to by any documentation on that one.. at least I did not find anything in "BCM2711 ARM Peripherals". Is there any documentation that I just missed?
Last edited by jw1234 on Tue Apr 20, 2021 6:32 pm, edited 1 time in total.

jw1234
Posts: 19
Joined: Sun Mar 28, 2021 7:01 pm

Re: Howto wire some GPIO >=32 on RPi4?

Tue Apr 20, 2021 5:58 pm

joan wrote:
Tue Apr 20, 2021 5:16 pm
What conflict do you expect from poking into the set/clr registers? The way they are designed means you would need a rogue setting for a conflict to appear.
I am directly poking into the respective memory mapped registers from a timing critical loop that runs on a dedicated CPU core. I cannot afford to use any "higher level" GPIO API since I already verified that those cannot keep up with the 1 micro update precision that I need. Consequently I suspect that concurrent updates to those registers, when initiated by different CPU cores, might well mess with my existing timing or worse lead to updates getting lost. Therefore I'd rather use some unused GPIO from the high-range to remove any risk of undesirable side-effects.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11010
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Howto wire some GPIO >=32 on RPi4?

Tue Apr 20, 2021 6:24 pm

Have you never encountered the fact that hardware designers tend to design the hardware without discussing it with the software team? It's just a schematic node name.
Would SDA10/SCL10 have made any more sense to you as that's what Linux configures it as? And from a connector perspective it's more useful to know what the signal is being used for rather than where it connects to.

Can your use of GPIOs 44&45 handle the firmware firing off I2C comms during boot? If not then treat them as internal signals and leave them alone.

For I2C routing, look at how device tree configures i2c0mux for the various devices (eg Pi4), generally through a line

Code: Select all

#include "bcm283x-rpi-i2c0mux_0_44.dtsi"
https://github.com/raspberrypi/linux/bl ... _0_44.dtsi
or

Code: Select all

#include "bcm283x-rpi-i2c0mux_0_28.dtsi"
https://github.com/raspberrypi/linux/bl ... _0_28.dtsi

For the expander, you could try following the configuration to get some answers
- https://github.com/raspberrypi/linux/bl ... -b.dts#L88
- https://github.com/raspberrypi/linux/bl ... rypi-exp.c
The expander itself is only accessible via the firmware, hence firmware mailbox calls.

You can try picking up GPIOs 40&41 prior to the audio output buffer and filter if you feel like some very fine soldering. After the filter isn't going to be much use as there are DC blocking capacitors.

(PS If you want assistance, try to avoid rubbing people up the wrong way. Some of your responses could be taken to be rather brusk).
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

jw1234
Posts: 19
Joined: Sun Mar 28, 2021 7:01 pm

Re: Howto wire some GPIO >=32 on RPi4?

Tue Apr 20, 2021 7:11 pm

6by9 wrote:
Tue Apr 20, 2021 6:24 pm
You can try picking up GPIOs 40&41 prior to the audio output buffer and filter if you feel like some very fine soldering. After the filter isn't going to be much use as there are DC blocking capacitors.
I think I'll keep that as plan B.

Since there are already nice large pads to solder to on the camera connector (and I'll never be using a camera anyway), I guess I'll go for the CAM_GPIO pin. From what I see that one can be easily set using "gpioset 1 5=1" (so my C code should have no trouble doing the same). I guess that if this is on some kind of "expander" then there should not be any side effects to the regular lower-range GPIOs that I want to isolate, i.e. problem solved. With the camera driver on the blacklist, I hope there is nothing else left in the system that might care about this CAM_GPIO and in any case it should be less risky than messing with some I2C bus which might still be in use for other stuff..

Thanks for the feedback :-)

jw1234
Posts: 19
Joined: Sun Mar 28, 2021 7:01 pm

Re: Howto wire some GPIO >=32 on RPi4?

Wed Apr 21, 2021 1:22 pm

problem solved: the CAM_GPIO pin seems to work nicely to control my cpu fan and the respective camera connector could be easily soldered to..

User avatar
neilgl
Posts: 3034
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near The National Museum of Computing

Re: SOLVED: Howto wire some GPIO >=32 on RPi4?

Wed Apr 21, 2021 2:46 pm

Good one but why do you need a fan?

jw1234
Posts: 19
Joined: Sun Mar 28, 2021 7:01 pm

Re: SOLVED: Howto wire some GPIO >=32 on RPi4?

Wed Apr 21, 2021 7:06 pm

neilgl wrote:
Wed Apr 21, 2021 2:46 pm
Good one but why do you need a fan?
that is indeed a valid point :-) since there was a cpu fan that came with my RPi4 (they seem to have put that in *instead* of any passive cooling elements) I assumed that there might be a reason to use it.. well now that I've installed my fan / temp control, I am not that sure anymore.. and some decent passive cooling element might well have accomplished the same. I have yet to find some computationally expensive task that might cause the fan to rev up..

User avatar
neilgl
Posts: 3034
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near The National Museum of Computing

Re: SOLVED: Howto wire some GPIO >=32 on RPi4?

Wed Apr 21, 2021 7:15 pm

Yes I don’t use any fans on any pi of mine (pi4, pi3plus, pi3, pi2 etc.) All run fine 24/7 as needed.

Return to “Advanced users”