0
votes

I am trying to create a virtual com port in python using pyserial on a raspberry pi to control a tinyg cnc microcontroller. The tinyG controller looks like it accepts plain text which can be sent through a serial connection if I can figure out how to link a usb cable to a virtual com port. "TinyG communicates over a single USB serial channel terminated by an FTDI chip (USB serial emulation)." This blurb is from the website. so I think I should be able to send serial data through the usb cable.

I have been trying setting up a com port on raspberry pi using " port = serial.Serial("/dev/ttyS0", baudrate = 115200) as well as path "/dev/ttyAMA0"

I got a few errors that said "raise Serial Exception("could not open port.....") etc. could not open port, no such file or directory: "/dev/ttyS0"

1

1 Answers

0
votes

Plug in your FTDI cable and try using port /dev/ttyUSB0 instead.

Those other ports you tried are the RPi's UARTs, accessible on the 40 pin connector but you might need to set them up if you want to use them. But I'm guessing you want to use the FTDI cable instead.

The device index should be 0 by default if you don't have any other USB serial stuff, but you can check that with ls /dev/ttyU* to list all ports or dmesg | grep tty to see more details (if you do that after disconnecting and reconnecting the device you want to find out info about you'll see the output at the very end of the text that dmesg spits).