Page 1 of 1

Why are some GPIO giving 3.3V at startup?

Posted: Thu Sep 24, 2015 1:21 pm
by hayt
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?

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

Posted: Thu Sep 24, 2015 1:53 pm
by joan
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.

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

Posted: Thu Sep 24, 2015 2:23 pm
by RogerW
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.

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

Posted: Thu Sep 24, 2015 2:49 pm
by texy
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

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

Posted: Thu Sep 24, 2015 3:05 pm
by RogerW
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.

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

Posted: Thu Sep 24, 2015 3:13 pm
by jojopi
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.)

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

Posted: Thu Sep 24, 2015 3:16 pm
by RogerW
> 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.

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

Posted: Fri Sep 25, 2015 9:07 am
by RogerW
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.

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

Posted: Tue Sep 29, 2015 11:01 am
by kdamav7949
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)