Close

Serial Over USB on BBB

jlbrian7jlbrian7 wrote 05/15/2020 at 02:06 • 1 min read • Like

http://m-embedded.blogspot.com/2015/03/embedded-serial-over-usb-on-beaglebone.html  (this is old, but simpler now)

sudo modprobe g_serial

stty -F /dev/ttyGS0 raw
stty -F /dev/ttyGS0 -echo

cat /dev/ttyGS0

Then connect to available com port:

Not perfect, but it will do.

BBB:

import serial
comm = serial.Serial("/dev/ttyGS0", 9600)
while True:
    data = comm.read_until(b'\r\n')
    print(data)
    comm.write(data)

PC:

import serial
comm = serial.Serial("COM21", 9600)
while True:
    comm.write(b"This is a test.\r\n")
    data = comm.read_until(b'\r\n')
    print(data)
Like

Discussions