Raspberry Pi Standard RS232 Serial Port Configure

  
The console serial settings are:
Baud Rate = 115200, Data Bits = 8,  Parity = NONE,  Stop Bits = 1, Flow Control = NONE
The serial terminal software you use on your other computer must be set up to match the above settings. See the section below: Serial Terminal (Communications) Software

 
Reconfigure the Raspberry Pi console port to to be used as a standard Serial port.
 
In order to use the serial port on the Raspberry Pi as a general purpose serial port, the port must be reconfigured by editing 2 configuration files as shown below.  You may want to save backups of these files before editing.
One way to backup is to load the files in the editor then SAVE AS a different file name such as innitab_backup. 
 

 
1. Modify the inittab File:
 
At a terminal command prompt issue this command:
 
sudo nano /etc/inittab
 

Look near the end of the file and find the lines that look like this:

 
#Spawn a getty on Raspberry Pi serial line
T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
 
 


'Comment out' the last line by putting a # character in front of the line.
Leave the other items in the file as they are.
The text should now look like this:

 

#Spawn a getty on Raspberry Pi serial line
#T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
 

Save and exit
 
2.  Modify the cmdline.txt File:
 

The following file edit is optional. If you don't do this edit then the boot time text messages will still be sent  to the port. After boot is complete the port will function as a generic serial port.

At a terminal command prompt issue this command:

 
sudo nano /boot/cmdline.txt
 

The entire contents of the file look like this:

 
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
 
 

 

Note that this is a single line of text at the very beginning of the file.  If text has wrapped then try to grab the edges of the edit box with your mouse and stretch it until the text is displayed as one line.

Take out this text:


     console=ttyAMA0,115200 kgdboc=ttyAMA0,115200

The resulting text should look like this:
(All on one line beginning on first line and note that the comment character # does not seem to work in this file).

 

dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
 

 


Save and exit
Restart the Raspberry Pi for settings to take effect.

To restore the configuration simply reverse the edits shown or restore the files from your backups.
 

 
 
    

 Standard RS232 Setting

  Flag Counter

Copyright ©2021
www.pridopia.co.uk
All rights reserved

Home           About us           Support           Shopping           Contacts           FAQ