hayt
Posts: 3
Joined: Sat Jan 31, 2015 12:42 pm

Why are some GPIO giving 3.3V at startup?

Thu Sep 24, 2015 1:21 pm

I have RPI B+ with Raspbian installed. I was trying to connect L298N for 2 days and i was not able to make it work correctly. For example. One motor was turning forward and other back, in different case one motor was turning and other not. When i changed pins they started running correctly. I was using only GPIO pins market green on schematic. I was so fed up that i took everything apart and started checking GPIO pins with voltmeter and then i discovered that some GPIO pins are giving of voltage, even after restart.

I have noticed that pin 35 (GPIO19), pin31(GPIO06) and pin29(GPIO05) are giving in between 2.5V and 3.15V.

My question is is this is normal? Did i somehow burn my PI? How can i tell them to stop giving of voltage?

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

Re: Why are some GPIO giving 3.3V at startup?

Thu Sep 24, 2015 1:53 pm

GPIOs 0-8 default to inputs with a weak pull-up to 3V3 at power-on. The other GPIOs default to inputs with a weak pull-down to ground at power-on.

Some GPIOs will be updated depending on what modules such as SPI you load during boot. I have no explanation for GPIO19.

User avatar
RogerW
Posts: 286
Joined: Sat Dec 20, 2014 12:15 pm
Location: London UK

Re: Why are some GPIO giving 3.3V at startup?

Thu Sep 24, 2015 2:23 pm

Slightly off topic but is there any way for a program to detect the state of the internal pullup/down resistors? I know I can set them.

texy
Forum Moderator
Forum Moderator
Posts: 5161
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Why are some GPIO giving 3.3V at startup?

Thu Sep 24, 2015 2:49 pm

Hi,
not quite what your asking, but in a round about way it does answer the question :
viewtopic.php?f=91&t=120984&p=817560

Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

User avatar
RogerW
Posts: 286
Joined: Sat Dec 20, 2014 12:15 pm
Location: London UK

Re: Why are some GPIO giving 3.3V at startup?

Thu Sep 24, 2015 3:05 pm

texy wrote:Hi,
not quite what your asking, but in a round about way it does answer the question :
viewtopic.php?f=91&t=120984&p=817560

Texy
I don't think that answers my question. I have a python program (using pigpio) that monitors the state of the gpios. It can show the current level (high or low). I could modify it to also show if the pin is configured for input or output. What I would like to do is also show if the internal resistor is active and whether it is pullup or pulldown.

User avatar
jojopi
Posts: 3134
Joined: Tue Oct 11, 2011 8:38 pm

Re: Why are some GPIO giving 3.3V at startup?

Thu Sep 24, 2015 3:13 pm

RogerW wrote:Slightly off topic but is there any way for a program to detect the state of the internal pullup/down resistors? I know I can set them.
No. The pull states are held in hardware latches, not registers, and the interface to them is write-only. It is your responsibility to set them correctly. In the unlikely event that you need to remember how they were set you must do that yourself too.

(If there is nothing connected to a pin, and the pin is set as an input, and it is not damaged, and a weak pull up or down is configured, then the pin will read as high or low, respectively. However, if weak pulls are disabled the pin may read either high or low, and possibly fluctuate with nearby electromagnetic noise. The only way to prove the absence of a weak pull would be by adding even weaker, switchable, pulls in hardware.)

User avatar
RogerW
Posts: 286
Joined: Sat Dec 20, 2014 12:15 pm
Location: London UK

Re: Why are some GPIO giving 3.3V at startup?

Thu Sep 24, 2015 3:16 pm

> No. The pull states are held in hardware latches, not registers, and the interface to them is write-only.

I had a feeling it might be something like that - thanks for the reply.

User avatar
RogerW
Posts: 286
Joined: Sat Dec 20, 2014 12:15 pm
Location: London UK

Re: Why are some GPIO giving 3.3V at startup?

Fri Sep 25, 2015 9:07 am

joan wrote:GPIOs 0-8 default to inputs with a weak pull-up to 3V3 at power-on. The other GPIOs default to inputs with a weak pull-down to ground at power-on.

Some GPIOs will be updated depending on what modules such as SPI you load during boot. I have no explanation for GPIO19.
Interestingly this seems to vary quite a lot. I have two pis - a B+ with rasbian inder noobs and a pi2b under straight raspian. On the pi2b GPIOs 7 & 8 are outputs, on the b+ they are inputs. There are a number of other differences.

I checked these running PyMon https://github.com/RogerWoollett/PyMon/ ... r/PyMon.py
which uses pigpio to show the state of the GPIOs on the local machine or on a networked pi.

kdamav7949
Posts: 42
Joined: Tue Sep 01, 2015 5:22 pm

Re: Why are some GPIO giving 3.3V at startup?

Tue Sep 29, 2015 11:01 am

Yeah. I have the same problem with most of my pins. I have a really cool application that I want to test but it uses leds. The leds come on at startup and the only way to turn them off is to shut down the pi. Please help! :| :| :| :geek: I think I have a model b rev 2(it might be called raspi 2)
kdamav7949
Program a game to find that your chosen name is already taken.

Code: Select all

if gameName is already being used:
    print('You are very angry!')
    self.BlowUp
Do some research before choosing a name.

Return to “General discussion”