data rates for serial input in Java?

D

David Merrill

Hey folks -
Does anyone have intimate experience doing serial input in Java
(win32)? I've got the following situation (using the current version
of the java comm api):

- microcontroller sending 52 bytes of data via serial to the PC, at a
baud rate of 115200bits/sec - sending a 52-byte "packet" about 180
times/sec.
- java program writing each received byte out to a file (and not
doing *anything* else with the data but writing it out..)

What happens is : the first ~100 packets (52 bytes each) come through
all right, then all hell breaks loose. I get fragments of packets,
chunks of 4 bytes plucked from packets, etc.. It seems to follow a
pattern at this point, although not all of my data is getting through
- looks like bytes are being dropped *before* they get to my
file-writing code in the Java environment.

What I've determined: I looked at the (live) data in HyperTerminal,
and it's beautiful. No bytes are dropped. So it's not something to do
with the serial -> usb adapter that I'm using on my computer. So I
think it's something to do with Java's handling of serial data - i.e.
maybe there is some internal buffering that's getting full, and
starting to misbehave... Has anyone come across this problem before,
or have any suggestions of what I can try?

much appreciated,
David M.
 
?

=?iso885915?q?Roger_Lindsj=F6?=

I proxy serial data at 115200 bps while logging to file without any
dropped bytes at all.

Could you show how you read from the streams?

//Roger Lindsjö
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top