To approach to Raspberry Pi UART, you need to disable any other process that use it in Linux.
Depending on the distribution in use (for example raspbian), you have to do some file editing.

Disable kernel messages

When the Raspberry Pi boots up, all the bootup information is sent to the serial port.
If you have Carberry connected at bootup, it will receive this information over the serial port, and it's not right.
You can disable kernel messages by editing the file “cmdline.txt”:

sudo nano /boot/cmdline.txt

The 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

Remove all references to ttyAMA0 (which is the name of the serial port).
After editing, the file will now look like this:

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

Disable login on UART port - Raspbian Wheezy

To enable the serial port for your own use you need to disable login on the port.

sudo nano /etc/inittab

Search the line and disable it by adding a “#” character to the beginning of the line:

#T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

Save the file.

Disable login on UART port - Raspbian Jessie

To enable the serial port for your own use you need to disable login on the port.

sudo raspi-config

Select:

9 Advanced Options

Select:

A8 Serial

Select:

No

Remove ttyAMA0.conf

Remove the file “ttyAMA0.conf” that use the UART port

sudo rm /etc/init/ttyAMA0.conf

System reboot

Reboot to apply changes.

sudo reboot