Search code examples
pythonmacospyserialftdi

Reading from serial port with pyserial only works if terminal app is open in background


I am using pyserial to communicate with my Multimeter (Keithley2000) over an FTDI based usb-to-rs232 adapter (Using the Mac OS X built-in driver).

Before I started with Pyserial I verified that the Hardware & Driver works by using a terminal app (Serial.app) to communicate with the Multimeter. This works just fine.

But if I try the same thing with the simple program below, it doesn't work. Writing works fine (I can for example reset the instrument), but I can't read anything back.

import serial
import io

port = serial.Serial("/dev/cu.usbserial-FT8VXG35", 9600, timeout=1)
port.write("*idn?\r")
print(port.readline())

Now here comes the weird part. If i leave Serial.app open in den background, the program actually works.

Does anyone know the reason for this behaviour?

Here are my settings in Serial.app

Settings Settings


Solution

  • Some peripherals need the flow control lines (RTC/CTS, DSR/DTR) set to specific levels - maybe having serial.app running the background sets these lines the way your multimeter needs?