Hardware Reference
In-Depth Information
2. Eliminate the kernel debugging option kgdboc=ttyAMA0,...
as outlined for the console in step 1.
3. Eliminate the login prompt caused by the /etc/inittab entry.
Look for ttyAMA0 and comment the line out. The line will look
something like T0:23:respawn:/sbin/getty -L ttyAMA0
115200 vt100 .
With these steps accomplished, reboot. The device /dev/ttyAMA0 should be
available exclusively for your application to use.
Verification
To check that /etc/inittab has not launched a getty process, use the following after
rebooting:
$ ps aux | grep ttyAMA0
No entries should appear.
To check that you have eliminated all kernel console references to the device, you
can use the following:
$ grep ttyAMA0 /proc/cmdline
Serial API
The Linux operating system provides access to serial port functions through a family of
system and library calls. Most of these require that you have an open file descriptor for
the serial device driver being used. For the Raspberry Pi, this will usually be the device
/dev/ttyAMA0 . Full information can be had from these man pages:
tcgetattr(3)
tty_ioctl(4)-ioctl(2) equivalents to tcgetattr(3)
The bulk of the developer work for serial ports is configuration of the serial driver:
Physical characteristics: baud rate, data bits, parity, and stop bits
Driver processing characteristics: raw or cooked mode, for
example
Once the driver is configured, the software developer is able to use the usual
read(2)/readv(2) , write(2)/writev(2) , select(2) , or poll(2) system calls.
For an example program using some of this API, see the “Software” section in
Chapter 6 of Experimenting with Raspberry Pi (Apress, 2014).
 
Search WWH ::




Custom Search