Processing250kBaud

Aus Hackerspace Ffm
Version vom 14. Januar 2014, 20:01 Uhr von Tut (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „== 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…“)

(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Wechseln zu: Navigation, Suche

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):

  1. !/usr/bin/python

import serial

  1. grab serial port data from FTDI chip

ser = serial.Serial(port='/dev/ttyUSB0', baudrate=250000, rtscts=True) ser.open()

  1. c=ser.read(5)
  2. 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);