By default the Raspbian uses the serial UART to access the shell console. To change this we need to make a few small changes to the cmdline.txt and inittab files
Make a backup of the two files we’ll be changing.
sudo cp /boot/cmdline.txt /boot/cmdline.bak
sudo cp /etc/inittab /etc/inittab.bak
In the LXterminal shell type the command:
sudo leafpad /boot/cmdline.txt
Find and remove “console=ttyAMA0,115200” and “kgdboc=ttyAMA0,115200” parameters.
The cmdline.txt will probably contain the default configuration line:
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200
console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
Find and remove “console=ttyAMA0,115200” and “kgdboc=ttyAMA0,115200” configuration parameters so it looks something like this:
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
Make sure to save the file and quit the editor.
Finally edit the “/etc/inittab” file to disable the use of the “ttyAMA0” serial port. In LXterminal type this command:
sudo leafpad /etc/inittab
Near the bottom of the file, look for a configuration line that includes the “ttyAMA0” port address.
Type a hash (or pound) sign (“#”) in front of the line “ttyAMA0“.
Save the file and exit the editor. Once done to reboot your Pi.
Once the Pi is rebooted, you can use “ttyAMA0” to access the serial port.