Hardware Reference
In-Depth Information
Remember that the GPIO pins are behind the power protection circuits on the Pi: given this, it would be very easy
to let the magic smoke out of the Pi. A power protection circuit would stop any unsafe voltage from entering into the
Raspberry Pi. It would also prevent any reverse polarity issues that may come up if you attempt to plug in the power
the wrong way.
So what is this about primary function, alternate function, and alternate 1 function? The primary function is what
the pin will be when the Pi boots by default with the sole exception of GPIO 14(P1-08) and GPIO 15(P1-10). These two
pins are automatically switched to the alternate function of providing the universal asynchronous receive/transmitter
function (UART). Also note that this UART runs at 115,200 bits per second by default. This is done so that you can
watch the Pi boot over a serial console that is completely headless. Without this happening automatically, you would
need to wait until the operating system boots to activate the serial console. That would be pretty inconvenient if you
had a low-level boot issue.
The alternate and alternate 1 functions can be set at the operating-system level. P1-03 and P1-05 can also be
used for the I 2 C bus: they have had an additional 1.8K pull-up resistor added. The addition of the pull-up resistor
for the I 2 C bus is a nice touch because now we can set the bus high or low without adding any external pull-up
resistors. By setting the bus high, we can place the voltage level to 3.3 V; to set the bus low, we could set the voltage
of the pin back to 0.
Each GPIO pin can supply a set maximum amount of current; if you go over this you may damage the GPIO pin
or, worse yet, destroy the 3.3 V supply on the Pi itself and that would be a very bad thing. Exactly what is the current
limit then? Well, that's easy: it's a maximum of 16 mA. I want to talk a bit more about this limit as it can be a little
confusing at first. Each pin can sustain a maximum of a 16-mA draw but you can't have every pin drawing that much
current or you will fry your 3.3 V supply. The 16 mA is a total for one or all the combined GPIO pins so take care to
design your projects so that you don't go over this limit.
Analog Video Output
Up next is the Pi's only analog video output. It's in the form of a composite RCA output. There is not a lot to say about
this as there is not a whole lot to it. The foundation has tried its best to make this composite interface usable on a wide
range of devices and it seems to have done a good job. You cannot use the composite and the HDMI interfaces at the
same time: you must pick an output and use it. If you have both outputs plugged in, the HDMI interface will be the
active output, rather than the composite.
For fun you can also set the composite output to be black and white via the sdtv_disable_colourburst=1 setting
in the config.txt file. The config.txt file has all the values you will need for basic operation; by default it will be set
to sdtv_mode=0 and sdtv_aspect=1 . If you need to edit this file, take a look at Chapter 2 when you install Linux. I've
created Table 1-2 to help you set the modes if you need to.
Table 1-2. Video Modes Supported by the Composite Video Out
Setting in config.txt
Description of Setting
sdtv_mode=0standard
NTSC
sdtv_mode=1
NTSC-J
sdtv_mode=2
standard PAL
sdtv_mode=3
PAL-M
sdtv_aspect=1
aspect ratio of 4:3
sdtv_aspect=2
aspect ratio of 14:9
 
Search WWH ::




Custom Search