Give appropriate permissions to the new serial ports: sudo chmod 666 /dev/tnt* You should see new serial ports in /dev/ ( ls /dev/tnt*) I guess it has to do with the thread-safe aspect of RXTX and I understand that it is not thread-safe.Download the tty0tty package from one of these sources:īuild the kernel module from provided source: cd tty0tty-1.2/moduleĬopy the new kernel module into the kernel modules directory: sudo cp tty0tty.ko /lib/modules/$(uname -r)/kernel/drivers/misc/ Similarly, when I use the SerialWriter tp write some bytes to Port 1, I find that some (if not all of them) are being written on the SerialWriter of Port 2. For example, a test byte-stream coming on port 1, will have some of the characters on the SerialReader of port 2 as well. The problem is that there seems to be an intermingling of the data read and written to the two ports. The SerialReader and SerialWriter are Runnable classes as defined in the example on the RXTX wiki. (“Successfully connected to Cricket mote on ports “+ port1Name +” and “+ port2Name) (new Thread(new SerialWriter(“MOTE-2”, out_p2, write_to_mote2))).start() (new Thread(new SerialReader(“MOTE-2”,in_p2))).start() (new Thread(new SerialWriter(“MOTE-1”, out_p1, write_to_mote))).start() (new Thread(new SerialReader(“MOTE-1”, in_p1))).start() OutputStream out_p2 = serialPort2.getOutputStream() InputStream in_p2 = serialPort2.getInputStream() OutputStream out_p1 = serialPort1.getOutputStream() InputStream in_p1 = serialPort1.getInputStream() ![]() tSerialPortParams(115200,SerialPort.DATABITS_8,SerialPort.STOPBITS_1,SerialPort.PARITY_NONE) SerialPort serialPort2 = (SerialPort) commPort2 SerialPort serialPort1 = (SerialPort) commPort2 If ( (commPort1 instanceof SerialPort) & (commPort2 instanceof SerialPort) ) I have 2 serial ports on my computer and I am using RXTX to read and write to them *seperately*. It contains the code from the previous posts. My helper class to manage the serial port over the application. ![]() Test the rxtx read/write functionality using loopback device, multiple threads and serial event Test the rxtx read/write functionality using loopback device and single thread. Read serial port data, using DATA_AVAILABLE interrupt/event or continuous polling over special thread Serial port events in rxtx: its types, usage, and functionality test Special issue for multiple processes that want to access single serial port Manages the port ownership, and its functional test.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |