Serial communication on Linux using Java

P

Pashmina

Hi,
Our application on Linux needs to communicate with some devices. We
are using RxTx package for that, and have been successful in
establishing a connection to the modem and retrieving the data. But
the data is recieved in blocks/chunks and not the entire data. The
code seems to be fine. So wanted to know if this could be a problem
with the serial port hardware buffer, which is filling up and then the
data is being read. If yes, what can i do to solve the problem.
Also, previously we were using wvdial to establish the connection and
the data was received properly.
Has anyone encountered such a problem before, or does anyone know what
the problem could be?

Thanks & Regards,
Pashmina
 
I

iksrazal

Hi,
Our application on Linux needs to communicate with some devices. We
are using RxTx package for that, and have been successful in
establishing a connection to the modem and retrieving the data. But
the data is recieved in blocks/chunks and not the entire data. The
code seems to be fine. So wanted to know if this could be a problem
with the serial port hardware buffer, which is filling up and then the
data is being read. If yes, what can i do to solve the problem.
Also, previously we were using wvdial to establish the connection and
the data was received properly.
Has anyone encountered such a problem before, or does anyone know what
the problem could be?

Thanks & Regards,
Pashmina

Some quick thoughts, assumming rs232 and not rs485 or rs422. Use this
link for a good reference:

http://www.mathworks.com/access/helpdesk/help/toolbox/instrument/ch_ser22.html

1) Typically there are other handshaking control pins, besides rx/tx,
like cts/rts, that can help indicate when to read/send data. A
voltmeter on the pins or the docs may help there.

Quick def:

Controlling the Flow of Data: Handshaking

Data flow control or handshaking is a method used for communicating
between a DCE and a DTE to prevent data loss during transmission. For
example, suppose your computer can receive only a limited amount of
data before it must be processed. As this limit is reached, a
handshaking signal is transmitted to the DCE to stop sending data.
When the computer can accept more data, another handshaking signal is
transmitted to the DCE to resume sending data.

The DCE and DTE terms can get confusing due "null modem" cables. But
you might know all this - if not read up on it.

2) What type of flox control are you using, hardware or Xon/Xoff?
First, there are theoretical limits on software control - sorry can't
find a link or remember exactly the limit - so it may be an issue.

More likely, your device and host computer have to be using the same
type of control:

http://www.fokus.gmd.de/linux/FAQ/PPP-FAQ-10.html

It is important that the modem, not just the computer, have the proper
setting for flow control. If the modem does not do flow control and
the computer is expecting that the modem will tell it when the buffer
overruns, then the buffer will overrun because the modem is not
configured to tell the computer that it is full.

Likewise if the modem is configured to use RTS/CTS and your computer
is configured to use XON/XOFF then you will not be able to recognize
the modem\s request to suspend transmission.

HTH

Outsource to an American programmer living in brazil!
http://www.braziloutsource.com/
iksrazal
 

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,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top