|Prototyping the serial port interface.|
I need to use this serial port to interface to my X10 system via a CM11A computer interface module. That can be a topic for several future posts.
First lets cover some important facts about RS-232 and voltage levels. The Pi uses levels that are 0V to represent a zero and 3.3V to represent a one. RS-232 uses -3V to -15V to represent a zero and 3V to 15V to represent a one. Thus, a level converter is required to create this interface. The MAX232 series of chips was designed for this exact purpose.
External capacitors are needed to drive the charge pumps inside the chip. Note: There are several variations of the MAX232 chip which have different requirements. The one shown in the circuit here uses 0.1uF capacitors. The ones I have use 1.0uF and some versions even have the capacitors built in. When in doubt, check the datasheet for the chart that shows the requirements for each variation.
Data Sheet for MAX232 family
If, like me, you want to take complete control of the serial port for your own uses, there are two configuration changes to make:
First, disable the boot up and diagnostic output to the serial port.
sudo vi /boot/cmdline.txt
and remove the two options referring to the serial port.
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
Second, disable the login prompt
sudo vi /etc/inittab
find the line near the end
T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
and delete it or comment it out by putting a # at the start of the line.
Reboot and the serial port will now be free for your exclusive use.