Mattb1969 wrote:I am trying to programatically identify whether the UART on the Pi is to be addresses as /dev/ttyAMA0 or as /dev/serial0.
The trick, if you want your software to run on all models of Pi, is to run them all on up to date Raspbian Jessie.
Then:
Enable the Serial Port by adding:
to the end of '/boot/config.txt'
If you don't want boot messages, or a log-in on the Serial Port, remove the phrase:
from '/boot/cmdline.txt'
Reboot.
Refer to the Serial Port as "/dev/serial0" in code. (That's serialZero, not serialOh!)
This procedure should take care of the differences between the Pi 3B's Serial Port, and the Serial Port on previous models. It also allows the Pi 3B to use it's built in Bluetooth (and WiFi) normally, and fixes the baud rate fluctuations which plagued the Pi 3B at launch.
There's more on the Serial Port saga
here.
Finally don't forget that on all models, the Serial Port GPIO pins work at 3.3V,
they are not 5V tolerant.
Hope this helps,
Dave.