jSerialComm toggles DTR when opening COM port

Every time I open a serial port, it appears jSerialComm is toggling the DTR pin. This is causing my serial device to reboot. Is there a way to open a COM port without toggling the DTR pin?

	from com.fazecast.jSerialComm import SerialPort

	ports = list(SerialPort.getCommPorts())
		
	for x in ports:
	  	x.clearDTR()

	output = 'Hello World' + '\n'

	system.serial.configureSerialPort(
		port="COM4",
		bitRate = system.serial.BIT_RATE_115200,
		dataBits = system.serial.DATA_BITS_8,
		hardwareFlowControl = False,
		handshake = system.serial.HANDSHAKE_NONE,
		parity = system.serial.PARITY_NONE,
		stopBits=system.serial.STOP_BITS_1)
	
	# Open serial port
	system.serial.openSerialPort( "COM4" )

	#serial device reboots here!

	system.serial.write( "COM4" ,  output)

May be of interest:

2 Likes

It looks like the only chance you have of getting this working is to program against the jSerialComm API directly instead of using the Ignition scripting functions.

This:

	ports = list(SerialPort.getCommPorts())
		
	for x in ports:
	  	x.clearDTR()

is operating on a different list of SerialPort objects than the one that gets created when you call system.serial.openSerialPort, so it's not going to work.

You'll have to try programming directly against jSerialComm API + using the suggested code from issue linked by Jordan.

1 Like

Thanks for the feedback. At this point, the simples fix I found was hardware based. ...similar to what was mentioned in the link @JordanCClark shared.