简体   繁体   English

无法从Beaglebone的uart端口读取数据

[英]Unable to read data from the uart port of Beaglebone

I'm facing a problem of getting values from my uart1 port of the Beaglebone Black, it is not displaying anything. 我面临着从我的Beaglebone Black uart1端口获取值的问题,它没有显示任何内容。 The python code is attached as below, is there any error in my python code? python代码如下所示,我的python代码是否有错误?

   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. 在使用UART之前,您必须在引导期间激活它。

In order to achieve it edit /dev/uEnv.txt and make sure a line like this one is there: 为了实现它,请编辑/dev/uEnv.txt并确保有这样的一行:

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. 另外,检查连接另一端的波特率是否配置为相同的值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM