Serial Communication

40 views
Skip to first unread message

nagarj...@gmail.com

unread,
Dec 19, 2017, 7:12:41 AM12/19/17
to BeagleBoard
Good afternoon!!!!

Hi currently iam working on beagleboneblack. Our problem is not communication happen using serial port.  That one is a RS232 that one is connected to our system.
here whatever message sending from beaglebone that will be received on my system here iam using (Docklight or Hercules). But i did not get any results.

Program :// on beaglebone side

import time
import Adafruit_BBIO.UART as UART
import serial
UART.setup("UART2")
print "Starting program"

ser = serial.Serial('/dev/ttyO2', baudrate=9600,
                    parity=serial.PARITY_NONE,
                    stopbits=serial.STOPBITS_ONE,
                    bytesize=serial.EIGHTBITS
                    )



time.sleep(1)

try:
        ser.write('Hello World')
        ser.write('Serial Communication')
        ser.write('By: Embedded Laboratoryn')
        print 'Data Echo Mode Enabled'
        while True:
                if ser.inWaiting() > 0.50:
                        data = ser.read()
                        print data
                        print('hello')
                        print('good morning')
except KeyboardInterrupt:
        print "Exiting Program"

except:
        print "Error Occurs, Exiting Program"

finally:
        ser.close()
        pass


Here iam not getting any results can you please solve my problem.

Dennis Lee Bieber

unread,
Dec 19, 2017, 9:44:43 AM12/19/17
to beagl...@googlegroups.com
On Mon, 18 Dec 2017 23:48:27 -0800 (PST),
nagarj...@gmail.com declaimed the
following:


>
>*except:*
>* print "Error Occurs, Exiting Program"*
>

The first suggestion is: DON'T DO THAT!

You have masked any informative error message -- take out that entire
except block and let the run-time dump the real error message if there is
one.

>*finally:*
>* ser.close()*
>* pass*
>

"pass" is meaningless here

--
Wulfraed Dennis Lee Bieber AF6VN
wlf...@ix.netcom.com HTTP://wlfraed.home.netcom.com/

Reply all
Reply to author
Forward
0 new messages