So I'm doing a project today with the Raspberry Pi 2 Model B and I realized that some (not all) of the GPIO pins output 3.3V at startup (I mean the data pins, not the power output pins). I cannot have it output 3.3V since I'm using the RPI to control a quadcopter and that would cause a mess if the motors ran at full speed at bootup. So do you guys know which pins are 0V (off) at startup and I can control using WiringPi?
-
We would know if we read the datasheet. You too.– Eugene Sh.Commented Nov 10, 2015 at 22:16
-
I never worked with RPI, but, in general, MCU GPIOs start in high impedance mode. You can try a pull down resistor (10k-100k) for each motor control GPIOs.– Gabriel Rezende GermanovixCommented Nov 10, 2015 at 22:18
-
@EugeneSh. I cant seem to find any datasheets for the RPI. If you find it can you please link me to it?– Peter ZhuCommented Nov 10, 2015 at 22:20
-
everything is here. Start with the board schematic as it may contain pull ups/downs and other stuff on the GPIOs, and then look at the processor docs GPIO section– Eugene Sh.Commented Nov 10, 2015 at 22:23
-
They may start in High-Z, but may go high or low somewhere in the Linux boot sequence. Many pins have multiple functions, and some may not even be gpio, just gpo– cdeCommented Nov 10, 2015 at 22:56
2 Answers
All the GPIO pins start as inputs (except the 2 used for serial console), so they may appear "high" if read with a voltmeter, but you could easily override this.
gpio readall
will show state.
I believe you can change the startup state (you could search just as easily as I). In the brief period before the config is read they must be indeterminate. You need some other method if you wish to manage state.
-
If the pins are input (High-Z), the processor may have weak pull-ups automatically enabled to avoid problems with floating inputs. You can probably make them look low on startup by putting a 4.7K (or even 10K) ohm pull-down resistor to ground on each. This should easily overcome the internal weak pull-up but not interfere with using the pin as an output. Commented Nov 10, 2015 at 23:10
-
-
@DoxyLover the GPIO does not work like this. It is years since I read the data sheets, so this may not be exactly correct, but the GPIO has an internal state e.g. if it has been used as an output, and set low, when switched to input it still reports a low value.
gpio readall
will show many pins as 0, even with nothing connected. Commented Nov 10, 2015 at 23:18 -
-
@Milliways So I got that working, I understand all the columns except the "V" column. What is the supposed to mean? Commented Nov 10, 2015 at 23:25
I just got I2C and WiringPi installed a few hours ago. To expand on what @Milliways said, I rebooted and checked the output of gpio readall. See the attached image. It appears most all the pins start as inputs.