Hardware Reference
In-Depth Information
You can see with the who command that I have logged in as root on ttyAMA0 and a virtual tty called pts/0 .
Now log out of your console session and you will see a message from init that getty has respawned. If you check
your process listing you will see a getty process and no active shell as there is no user logged in and getty is waiting
for you. Take a look at Figure 9-13 to see this in action.
Figure 9-13. Getty respawning correctly
Congratulations! You now have a fully functional serial console, which is one of my personal favorite things to
have. You can now watch your boot messages scroll across your console or maybe you don't want to have Ethernet
connected to your Raspberry Pi.
Serial No Console
What if you want to use the serial port for another function such as a GPS or a modem, for example? The hardware you
have just built can support this as well. In fact you don't even need to change anything on the hardware side. You need
to make changes to two files. The first file is /etc/init/pitty.conf . You need to use the following two lines:
# start on startup
# start on stopped rc or RUNLEVEL=[2345]
As you can see I have placed a # in front of them to comment them out. Next you need to edit the
/boot/cmdline.txt file. You want to remove the references to ttyAMA0 as the boot console. My cmdline.txt now
looks like this:
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait elevator=noop
That the console is now on tty1 and there are no references to ttyAMA0 . Now reboot your Raspberry Pi. You
still may see boot messages but as soon as Fedora takes over you will be free to do whatever you want with the serial
port. Now give your Raspberry Pi another reboot. If you check the following command, you will see that the pitty
process is stopped/waiting :
# initctl list
This means the system will not start the process on boot but you could still start it manually. This is why I also left
the shutdown line in the pitty.conf file. If you were to check the process listing you would also no longer see a getty
process running on ttyAMA0 .
Next up I am going to show you one of my favorite software applications for having many serial ports.
Ser2net
For this section, make sure you have no getty process running on ttyAMA0 as it will interfere with the application.
You can quickly check for a getty with the following command:
# ps aux | grep getty
 
Search WWH ::




Custom Search