Non-standard baud rates under Linux / Processing
Several USB-to-serial converter chips are capable of using non-standard baud rates. The chips from FTDI are just one example. However, using those baud rates especially under Linux is often cumbersome. Fortunately, most modern Linux distributions have already kernel support for those chips and baud rates. But accessing those rates from other applications especially Processing (here 1.5.1) doesn't gave the correct results. We found that the modern language Python makes things more easy - here custom baud rates worked out of the box. But this is not the end of the story: Once set a custom baud rate using a small Python script, this baud rate could also used afterwards under Processing. To work with 250kBaud under Processing, we first executed the following script once (called it set250k.py):
- !/usr/bin/python
import serial
- grab serial port data from FTDI chip
ser = serial.Serial(port='/dev/ttyUSB0', baudrate=250000, rtscts=True) ser.open()
- c=ser.read(5)
- print c
ser.close() # close port
Then we could use it also under Processing using code like this:
import processing.serial.*;
Serial SerialPort;
SerialPort = new Serial(parent, "/dev/ttyUSB0", 250000);