data rates for serial input in Java?

Discussion in 'Java' started by David Merrill, Mar 7, 2004.

  1. 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.
     
    David Merrill, Mar 7, 2004
    #1
    1. Advertising

  2. 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ö
     
    =?iso885915?q?Roger_Lindsj=F6?=, Mar 7, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Abs
    Replies:
    0
    Views:
    528
  2. Abs
    Replies:
    0
    Views:
    420
  3. Abs
    Replies:
    0
    Views:
    440
  4. Max Kotasek
    Replies:
    4
    Views:
    1,032
    Max Kotasek
    Apr 9, 2010
  5. Martin
    Replies:
    14
    Views:
    560
    Terence
    Nov 15, 2009
Loading...

Share This Page