Last time i checked raspbian images were configured by default to use the ttyPort to output a terminal console so it is not available for applications
Depending on the version of the Raspian image you might need to edit the /etc/inittab ( SysVinit) or disable the systemd service with
sudo systemctl disable serial-getty@ttyAMA0.service