3. Introduction
• R-Pi offers lower-level interfaces intended to
connect more directly with chips and subsystem
modules
• Signals on the 2x13 header pins include SPI,
I2C, serial UART, 3V3 and 5V power
• Not "plug and play" and require care to avoid
miswiring
• The pins use a 3.3V logic level and are not
tolerant of 5V levels, such as you might find on a
5V powered Arduino
3
5. • Not yet software-enabled are the
flex cable connectors with CSI
(camera serial interface) and DSI
(display serial interface), and a
serial link inside the HDMI
connector called CEC
• They provide 8 GPIO pins plus
access to I²C, SPI, UART), as well
as +3.3 V, +5 V and GND supply
lines
5
6. RPi Serial Connection
• The following parameters are needed to connect to the Pi console, and
apply on both Linux and Windows.
– Speed (baud rate): 115200
– Bits: 8
– Parity: None
– Stop Bits: 1
– Flow Control: None
6
http://elinux.org/RPi_Serial_Connection
7. Connection to a microcontroller
or other peripheral
• The TxD and RxD signals can also be connected directly
to similar signals on a microcontroller board like the
Arduino provided the signals are all at 3V3 levels.
• It's still a good idea to put 2K2 series resistors in the
lines to prevent damage when two outputs are
connected together, which could also happen if a GPIO
input pin is accidentally programmed as output.
• If your microcontroller uses 5V logic levels, level
conversion is usually necessary - see 'Connecting to a
PC' for details.
7
35. Raspberry Pi - Installing a
RS232 Serial Port
http://www.savagehomeautomatio
n.com/projects/raspberry-pi-
installing-a-rs232-serial-port.html
35
36. Raspberry Pi - RS232 Serial
Interface Options (Revisit)
SOFTWARE USE OF THE
SERIAL PORT
36
37. make of backup of the two files
that we intend to modify
• sudo cp /boot/cmdline.txt
/boot/cmdline.bak
• sudo cp /etc/inittab /etc/inittab.bak
37
38. Next
• we need to remove the "console=ttyAMA0,115200" and
"kgdboc=ttyAMA0,115200" configuration parameters from the
"/boot/cmdline.txt" configuration file.
• To edit the file use this command:
$ sudo nano /boot/cmdline.txt
• The file probably contains this default configuration line:
– dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200
console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
• After removing the two configuration parameters, it will look similar
to this:
– dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4
elevator=deadline rootwait
38
39. Last
• edit the "/etc/inittab" file and comment out
the use of the "ttyAMA0" serial port.
• To edit the file use this command:
$ sudo nano /etc/inittab
39
40. Now towards the bottom of the file, look for a
configuration line that includes the "ttyAMA0" port
address
40
41. Place a pound sign ("#") in front of the line to comment it
out. With a pound sign ("#") at the beginning of the line,
Linux will ignore this configuration line.
• Save the "/etc/inittab" file and then issue
this command to reboot the Raspberry Pi:
$ sudo reboot
41
42. • Now you are ready to use the serial port
with a software application and the
operating system won't interfere with the
port.
• Use the device address "ttyAMA0" in your
application to access this serial port.
42
43. Project:Create an internet
controlled robot using
Livebots
http://www.instructables.com/id/Cr
eate-an-internet-controlled-robot-
using-Livebots/step1/Have-Fun/
43
44. Advanced GPIO for the
Raspberry Pi
https://pypi.python.org/pypi/RPIO
Extends RPi.GPIO with PWM,
GPIO interrups, TCP socket
interrupts, command line tools and
more
44
45. RPIO is an advanced GPIO module
for the Raspberry Pi
• PWM via DMA (up to 1µs resolution)
• GPIO input and output (drop-in replacement
for RPi.GPIO)
• GPIO interrupts (callbacks when events occur on
input gpios)
• TCP socket interrupts (callbacks when tcp socket
clients send data)
• Command-line tools rpio and rpio-curses
• Well documented, fast source code with minimal
CPU usage
• Open source (LGPLv3+)
45