retrohackers.org
https://www.retrohackers.org/

Java and serial port (COMx)
https://www.retrohackers.org/viewtopic.php?f=4&t=550
Page 1 of 1

Author:  Diddl [ Wed Jan 13, 2010 12:22 pm ]
Post subject:  Java and serial port (COMx)

I'm a beginner with JAVA programming.

I try to make a JAVA API to comunicate with a XS-1541 device to read whole diskettes into a D64 image file. Cause Java didn#t have own serial support for Win32 I use this RXTX library.

This RXTX works fine up to the moment data flow is very fast. It is a problem of RXTX or JAVA maybe, cause XS-1541 with Hyperterm work perfectly.



XS-1541 uses floppy code from OpenCBM to read fast. OpenCBM supports different protocolls:
+ S1 - slow
+ S2 faster
+ PAR for parallel floppyies


RXTX seems to loose chars if communication run permanently or big data blocks. S1 and S2 works fine, with PAR floppy send a whole track in 600ms (3 rotations, interleave 1:3).

In this RXTX lib I have tried all to get it run. Input buffers are 16K, so a whole track fit without troubles.

Any idea how to get a working serial communication under JAVA?

Author:  brain [ Wed Jan 13, 2010 7:32 pm ]
Post subject:  Re: Java and serial port (COMx)

Hmm, I use RXTX under Java for COM and I don't remember havng any issues with speed. I'll check my init code.

Jim

Author:  Diddl [ Thu Jan 14, 2010 10:00 am ]
Post subject:  Re: Java and serial port (COMx)

brain wrote:
I'll check my init code.

Thanks, that would be nice. :D

Author:  Diddl [ Fri Jan 15, 2010 8:09 pm ]
Post subject:  Re: Java and serial port (COMx)

Problem solved. :D

by using a "BufferedInputStream" instead of a "InputStream" as described in many sample codes it is working fine now:

Code:
         inputStream = new BufferedInputStream(serialPort.getInputStream(), 16384);
            outputStream = serialPort.getOutputStream();

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/