User avatar
TerryC65
Posts: 178
Joined: Sat May 09, 2015 7:50 am
Location: Wimborne, Dorset, UK

GPIO Output Characteristics

Mon Sep 17, 2018 4:00 pm

Hi,

We want to drive a 12 V Actuator Motor Clutch using a Pi and an P-Channel MOSFET; eg something like the circuit shown in this page https://www.electronics-tutorials.ws/ar ... rcuit.html (scroll down to near the bottom).

Before we do that though we would like to be comfortable that the RPi GPIO Pin that we use isn't going to be fried when the 12 V is turned on. We know that the Logic Levels (I/P and O/P) are 3.3 V and the pin drive current is limited to 16 mA, but the success of this design depends on the nature of the GPIO Pin Drive electronics.

I'm sure I've read somewhere that GPIO pins are open collector. If so, we should be OK but we'd like to be sure.

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

Re: GPIO Output Characteristics

Mon Sep 17, 2018 4:32 pm

TerryC65 wrote:
Mon Sep 17, 2018 4:00 pm
I'm sure I've read somewhere that GPIO pins are open collector. If so, we should be OK but we'd like to be sure.
I don't know where you think you've read that, but they're almost certainly not open collector.
There is no requirement for pull-ups to be enabled when in output mode which there would be if they were open collector. It would limit the low to high transition time with any form of capacitive load, as it would be charging via those pullups (around 50k if the same as the input ones).
I believe they are driven both high and low.

The only exception is when specific GPIOs are in their I2C mode, in which case they are open drain, and pull ups are required.
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.

User avatar
mooblie
Posts: 197
Joined: Fri Oct 14, 2016 2:07 pm
Location: The Scottish Highlands

Re: GPIO Output Characteristics

Mon Sep 17, 2018 5:41 pm

Maybe Terry was thinking of this situation:

I understand that GPIO pins, when acting as outputs, are "fully-driven" both high and low, and NOT open-collector, but I also think I have heard somewhere that SOME GPIO pins have external puii-up resistors fitted on the Pi PCB.

Is that true? If so, where can we find out which pins, what pull-up value (and, I suppose, WHY?)

TIA.

User avatar
Burngate
Posts: 6306
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: GPIO Output Characteristics

Mon Sep 17, 2018 5:55 pm

GPIO2 & GPIO3, header pins 3 & 5, 1k8 to 3v3
GPIO-B+.png
GPIO-B+.png (21.85 KiB) Viewed 1786 times
grabbed from the schematic, coloured by me; and if you look carefully there's marking to indicate those that have internal pull-ups on boot-up (the rest are pull-down)

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

Re: GPIO Output Characteristics

Mon Sep 17, 2018 6:01 pm

Gpios 2&3, which have alt functions of i2c, hence the designation of sda1 and scl1 against them.
When in i2c mode, and I believe only when in i2c mode, they are open drain.
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.

User avatar
Burngate
Posts: 6306
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: GPIO Output Characteristics

Mon Sep 17, 2018 6:11 pm

Somewhere is a PDF - BCM2835 ARM Peripherals - and also in-depth discussion about the GPIO characteristics, by Gert and others.

Nowhere does it mention open-drain or similar - unless I missed it - and I made the assumption that the I2C system drives it low for 0 and puts it into input for a 1.

Yey one more instance where I'm wrong?

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

Re: GPIO Output Characteristics

Mon Sep 17, 2018 6:21 pm

I may be wrong that it is open drain, but that would be my expectation.
Whichever way, the input readback circuitry is still connected to the gpio pin, and that won't be tolerant of voltages greater than 3.3V, so even then it is not safe to connect 12V to it. Add external protection/level conversion circuitry.
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.

User avatar
mooblie
Posts: 197
Joined: Fri Oct 14, 2016 2:07 pm
Location: The Scottish Highlands

Re: GPIO Output Characteristics

Mon Sep 17, 2018 7:15 pm

Thanks for the information, everybody!

User avatar
TerryC65
Posts: 178
Joined: Sat May 09, 2015 7:50 am
Location: Wimborne, Dorset, UK

Re: GPIO Output Characteristics

Tue Sep 25, 2018 10:20 am

Sorry about the tardy response. Something came up and I got diverted onto a different aspect of the project.

Thanks for all the responses. I've now worked out how to drive our device. If anyone needs to do the same thing, here is what we did.
Untitled 1.png
Untitled 1.png (24.67 KiB) Viewed 1633 times

Return to “Interfacing (DSI, CSI, I2C, etc.)”