0% found this document useful (0 votes)
3 views2 pages

Raspberry Pi RS232 Serial Port Setup

The document discusses configuring a Raspberry Pi to use the serial port for software instead of the console by editing files to remove console parameters and comment out serial port configuration. It also mentions using a USB TTL adapter to connect to the serial port and provides a Java programming example.

Uploaded by

Károly Makk
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Raspberry Pi RS232 Serial Port Setup

The document discusses configuring a Raspberry Pi to use the serial port for software instead of the console by editing files to remove console parameters and comment out serial port configuration. It also mentions using a USB TTL adapter to connect to the serial port and provides a Java programming example.

Uploaded by

Károly Makk
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

7/3/2020 SHA - - - Raspberry Pi - RS232 Serial Interface Options (Revisit)

SOFTWARE USE OF THE SERIAL PORT

If you intend to use the serial port for a software application running on the Raspberry Pi, there is a bit of configuration
required to disable the console from using this port. By default, the serial port is configured as a console port for
interacting with the Linux OS shell. The following steps will guide you through disabling the port from console access.

First, lets make of backup of the two files that we intend to modify.

sudo cp /boot/[Link] /boot/[Link]


sudo cp /etc/inittab /etc/[Link]

Next, we need to remove the "console=ttyAMA0,115200" and "kgdboc=ttyAMA0,115200" configuration parameters from
the "/boot/[Link]" configuration file.

To edit the file use this command:

sudo nano /boot/[Link]

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

The last step is to 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

Now towards the bottom of the file, look for a configuration line that includes the "ttyAMA0" port address.

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.

[Link]/projects/[Link] 1/2
7/3/2020 SHA - - - Raspberry Pi - RS232 Serial Interface Options (Revisit)

Save the "/etc/inittab" file and then issue this command to reboot the Raspberry Pi:

sudo reboot

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.

If are interested in using the serial port with Java programming, please see this
page: [Link]

Update on Wednesday, October 8, 2014 at 8:55AM


byRobert Savage

I have updated the wiring diagram and photos for the USB
TTL adapter approach to remove the 5VDC RED pin
connection. It was technically working, but I felt it was safer
to eliminate this connection to prevent current from being
sourced from the USB connection/adapter back into the
Raspberry Pi.

[Link]/projects/[Link] 2/2

You might also like