nyholku/purejavacomm — pull request #5 by pepijndevos (2012-03-31 09:19:34+00:00)
Title: Make 500000 baud work

Well, it should work…

user=> (def p (.open (purejavacomm.CommPortIdentifier/getPortIdentifier "/dev/tty.usbserial-FTE0ZZ3K") "foobar" 2000))
#'user/p
user=> (.getBaudRate p)
9600
user=> (.setSerialPortParams p 500000 8 1 0)
nil
user=> (.getBaudRate p)
500000
user=> (def is (.getInputStream p))
#'user/is
user=> (def os (.getOutputStream p))
#'user/os
user=> (.write os 4)
nil
user=> (.read is)
; hangs

I also tried my improvised loopback device, which did work, but looping works at any rate of course. You would almost think it secretly communicates at 9600.

FYI, this is the Python code:

>>> import serial
>>> s = serial.Serial("/dev/tty.usbserial-FTE0ZZ3K", 500000)
>>> s.write(chr(4))
1
>>> s.read(7)
'DPSCOPE'