Zardoz
Posts: 59
Joined: Thu Jul 04, 2013 10:18 am
Location: Kingdom of Spain

GPIO state on reboot

Sat Jul 20, 2013 10:05 am

I have a buzzer installed in one of the GPIO pins and I have observed that the buzzer gets on automatically on reboot. On the other side, the leds I have in the other pins don't light on.
That leads me to think that on reboot the GPIO port has a particular configuration.

Does anybody know which pins are on or off?
Can I change that?

Thank you very much.

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

Re: GPIO state on reboot

Sat Jul 20, 2013 10:32 am


pjc123
Posts: 922
Joined: Thu Mar 29, 2012 3:37 pm
Contact: Website

Re: GPIO state on reboot

Sat Jul 20, 2013 10:47 am

See the charts here (One change to the REV 1 board chart is that I am also seeing a HIGH on GPIO8 at very first boot, otherwise both charts are consistent with what I am seeing on my Rev 1 and Rev 2 boards):

http://www.raspberrypi.org/phpBB3/viewt ... 44&t=35321

I don't know a way of changing it at very first boot. For anything that is critical that I need to have boot in a known state I use the above charts, for everything else I just have a script that is called from rc.local that sets the state of each GPIO port as part of the startup process. I also have a 10k resistor from each GPIO port to ground so I have no floating ports with an unknown state.
My Raspberry Pi Project Page:

https://www.flaminghellmet.com/launch/

Zardoz
Posts: 59
Joined: Thu Jul 04, 2013 10:18 am
Location: Kingdom of Spain

Re: GPIO state on reboot

Sat Jul 20, 2013 12:22 pm

Ohh thank you. Very useful.
However I don't understand completely this chart:

Code: Select all

    +----------+-Rev2-+------+--------+------+-------+
    | wiringPi | GPIO | Phys | Name   | Mode | Value |
    +----------+------+------+--------+------+-------+
    |      0   |  17  |  11  | GPIO 0 | IN   | Low   |
    |      1   |  18  |  12  | GPIO 1 | IN   | Low   |
    |      2   |  27  |  13  | GPIO 2 | IN   | Low   |
    |      3   |  22  |  15  | GPIO 3 | IN   | Low   |
    |      4   |  23  |  16  | GPIO 4 | IN   | Low   |
    |      5   |  24  |  18  | GPIO 5 | IN   | Low   |
    |      6   |  25  |  22  | GPIO 6 | IN   | Low   |
    |      7   |   4  |   7  | GPIO 7 | IN   | Low   |
    |      8   |   2  |   3  | SDA    | IN   | High  |
    |      9   |   3  |   5  | SCL    | IN   | High  |
    |     10   |   8  |  24  | CE0    | IN   | Low   |
    |     11   |   7  |  26  | CE1    | IN   | Low   |
    |     12   |  10  |  19  | MOSI   | IN   | Low   |
    |     13   |   9  |  21  | MISO   | IN   | Low   |
    |     14   |  11  |  23  | SCLK   | IN   | Low   |
    |     15   |  14  |   8  | TxD    | ALT0 | High  |
    |     16   |  15  |  10  | RxD    | ALT0 | High  |
    |     17   |  28  |   3  | GPIO 8 | IN   | Low   |
    |     18   |  29  |   4  | GPIO 9 | IN   | Low   |
    |     19   |  30  |   5  | GPIO10 | IN   | Low   |
    |     20   |  31  |   6  | GPIO11 | IN   | Low   |
    +----------+------+------+--------+------+-------+
From python I set (input/output) mode and (True/False) state.

What does it mean then ALT0? And High/Low?

pjc123
Posts: 922
Joined: Thu Mar 29, 2012 3:37 pm
Contact: Website

Re: GPIO state on reboot

Sat Jul 20, 2013 12:40 pm

[quote="Zardoz"]Ohh thank you. Very useful.

From python I set (input/output) mode and (True/False) state.

High/Low?

True = High = 3.3 volts.

False = Low = O volts = Gnd

(Actually it is a range of voltage, but I will not complicate the issue).

What does it mean then ALT0?

Each GPIO has its basic function (usually input/output) or can be set to its alternate function. I use a C library that has a call to set the GPIO's function. I don't anything about Python, but if you are using a library, I would think it would have that capability. See the chart here for the Alt functions:

http://elinux.org/RPi_BCM2835_GPIOs

Basic GPIO information here:

http://elinux.org/RPi_Low-level_peripherals

Not suggesting that you don't ask questions, but all this information and a lot more is easily found by googling this forum and the web; that's how I learned how to use the GPIO. For various reasons they removed the main link to the raspberry pi technical information, but I read everything on the elinux pages before I bought my pi and it saved me a ton of grief. Here is the front page:

http://elinux.org/RPi_Hub
My Raspberry Pi Project Page:

https://www.flaminghellmet.com/launch/

Zardoz
Posts: 59
Joined: Thu Jul 04, 2013 10:18 am
Location: Kingdom of Spain

Re: GPIO state on reboot

Sat Jul 20, 2013 3:20 pm

Thanks,
I will read that document carefully.

Return to “General discussion”