I'm facing a problem of getting values from my uart1 port of the Beaglebone Black, it is not displaying anything. The python code is attached as below, is there any error in my python code?
import serial
import Adafruit_BBIO.UART as UART
from time import sleep
UART.setup("UART1")
ser=serial.Serial(port='/dev/ttyO1',baudrate=9600)
ser.open()
while(1):
while ser.inWaiting()==0:
pass
NMEA1=ser.readline()
print NMEA1
GPS.close()
Before being able to use the UART you have to activate it during boot time.
In order to achieve it edit /dev/uEnv.txt
and make sure a line like this one is there:
cape_enable=bone_capemgr.enable_partno=BB-UART1
Make sure there is no leading #
commenting the line.
Also, check the baudrate at the other side of the connection is configured to the same value.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.