public inbox for linux-serial@vger.kernel.org
 help / color / mirror / Atom feed
* serial communication problems
@ 2002-05-29 11:05 Deepak Gupta
  2002-05-29 14:07 ` Gerald Emig
  0 siblings, 1 reply; 6+ messages in thread
From: Deepak Gupta @ 2002-05-29 11:05 UTC (permalink / raw)
  To: linux-serial

Hi,

I have a strange problem with the serial line communication in Linux
(RH 7.2, kernel 2.4.7-10).  We have some electronic locks that are
controlled by a PC.  The locks are connected by a RS485 twisted pair
(multidrop) and this line terminates in a 485-232 converter box which
is connected via the serial line to a PC.  The lock vendor has supplied
a Windows software to program the locks which works fine on this PC.
He has also given me the protocol that is followed between the PCs and
the locks.  I am trying to write my own Linux based software for
programming the locks.

The problem is that when the vendor software sends a command to a lock
it replies obediently but when my program writes exactly the same sequence
of bytes to the serial line, I don't get a response (the protocol
says that the lock will not respond unless it gets a valid command).
I know the locks use 9600 baud, 8 bits, no parity, 1 stop bit and I
am using the same.  I also tried with and without hardware flow control
(RTS/CTS) but no luck.  I know that the command I send is right since
I used another PC to listen to what the vendor software writes on the
serial line and it matches the protocol description that I have.

Incidentally I opened up the 232-485 converter box and saw that it
uses only the TX, RX, SG, RTS and CTS lines on the RS232 side.  So 
it cannot be a matter of DTR or some other signal.

Please help.

Deepak Gupta

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: serial communication problems
  2002-05-29 11:05 Deepak Gupta
@ 2002-05-29 14:07 ` Gerald Emig
  2002-05-30  2:55   ` Deepak Gupta
  0 siblings, 1 reply; 6+ messages in thread
From: Gerald Emig @ 2002-05-29 14:07 UTC (permalink / raw)
  To: Deepak Gupta; +Cc: linux-serial

On Wed, 29 May 2002, Deepak Gupta wrote:

> Hi,
>
> I have a strange problem with the serial line communication in Linux
> (RH 7.2, kernel 2.4.7-10).  We have some electronic locks that are
> controlled by a PC.  The locks are connected by a RS485 twisted pair
> (multidrop) and this line terminates in a 485-232 converter box which
> is connected via the serial line to a PC.  The lock vendor has supplied
> a Windows software to program the locks which works fine on this PC.
> He has also given me the protocol that is followed between the PCs and
> the locks.  I am trying to write my own Linux based software for
> programming the locks.
>
> The problem is that when the vendor software sends a command to a lock
> it replies obediently but when my program writes exactly the same sequence
> of bytes to the serial line, I don't get a response (the protocol
> says that the lock will not respond unless it gets a valid command).
> I know the locks use 9600 baud, 8 bits, no parity, 1 stop bit and I
> am using the same.  I also tried with and without hardware flow control
> (RTS/CTS) but no luck.  I know that the command I send is right since
> I used another PC to listen to what the vendor software writes on the
> serial line and it matches the protocol description that I have.
>
> Incidentally I opened up the 232-485 converter box and saw that it
> uses only the TX, RX, SG, RTS and CTS lines on the RS232 side.  So
> it cannot be a matter of DTR or some other signal.
>

I had a similar problem a few days ago.
Old software worked, new one did not.
So I also used a third PC to look what the others talk.
I noticed the same as you.

Solution was that RTS had to be set active.


> Please help.
>
> Deepak Gupta
> -
> To unsubscribe from this list: send the line "unsubscribe linux-serial" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


Gerald Emig

--
EMIG Software		Tel. 06858-6197, Mobil: 0163-4751706
Engelstr. 17		Fax. 0721-151-348672
66564 Ottweiler-Fürth	http://sites.inka.de/heisch
Germany			e-mail: gme@heisch.inka.de


-
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: serial communication problems
       [not found] <005401c20717$6690c0c0$294b82ce@connecttech.com>
@ 2002-05-30  2:52 ` Deepak Gupta
  0 siblings, 0 replies; 6+ messages in thread
From: Deepak Gupta @ 2002-05-30  2:52 UTC (permalink / raw)
  To: Stuart MacDonald; +Cc: linux-serial

The stty settings are OK, I believe.  Here is the output of
"stty -a -F /dev/ttyS0"

speed 9600 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint
ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff
-iuclc -ixany -imaxbel
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0
vt0
ff0
-isig -icanon -iexten -echo echoe
echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke

Any idea what else could be wrong?

Deepak

-----Original Message-----
From: Stuart MacDonald [mailto:stuartm@connecttech.com]
Sent: Wednesday, May 29, 2002 7:18 PM
To: Deepak Gupta
Subject: Re: serial communication problems


From: "Deepak Gupta" <deepak@cse.iitk.ac.in>
> The problem is that when the vendor software sends a command to a lock
> it replies obediently but when my program writes exactly the same sequence
> of bytes to the serial line, I don't get a response (the protocol
> says that the lock will not respond unless it gets a valid command).

Check your tty layer settings with stty when your program has the
port open. You'll need CLOCAL to be set....

> Incidentally I opened up the 232-485 converter box and saw that it
> uses only the TX, RX, SG, RTS and CTS lines on the RS232 side.  So
> it cannot be a matter of DTR or some other signal.

..because 485 doesn't have the same signal set. Also check CREAD.
You'll likely want to set the tty layer into "raw" mode so that
your commands don't get character-processed.

..Stu



^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: serial communication problems
  2002-05-29 14:07 ` Gerald Emig
@ 2002-05-30  2:55   ` Deepak Gupta
  0 siblings, 0 replies; 6+ messages in thread
From: Deepak Gupta @ 2002-05-30  2:55 UTC (permalink / raw)
  To: Gerald Emig; +Cc: linux-serial

RTS is active as reported by /proc/tty/driver/serial.
In fact all three of RTS, CTS, and DTR are shown active.

What else could be wrong?

Deepak

-----Original Message-----
From: Gerald Emig [mailto:gme@heisch.inka.de]
Sent: Wednesday, May 29, 2002 7:37 PM
To: Deepak Gupta
Cc: linux-serial@vger.kernel.org
Subject: Re: serial communication problems


On Wed, 29 May 2002, Deepak Gupta wrote:

> Hi,
>
> I have a strange problem with the serial line communication in Linux
> (RH 7.2, kernel 2.4.7-10).  We have some electronic locks that are
> controlled by a PC.  The locks are connected by a RS485 twisted pair
> (multidrop) and this line terminates in a 485-232 converter box which
> is connected via the serial line to a PC.  The lock vendor has supplied
> a Windows software to program the locks which works fine on this PC.
> He has also given me the protocol that is followed between the PCs and
> the locks.  I am trying to write my own Linux based software for
> programming the locks.
>
> The problem is that when the vendor software sends a command to a lock
> it replies obediently but when my program writes exactly the same sequence
> of bytes to the serial line, I don't get a response (the protocol
> says that the lock will not respond unless it gets a valid command).
> I know the locks use 9600 baud, 8 bits, no parity, 1 stop bit and I
> am using the same.  I also tried with and without hardware flow control
> (RTS/CTS) but no luck.  I know that the command I send is right since
> I used another PC to listen to what the vendor software writes on the
> serial line and it matches the protocol description that I have.
>
> Incidentally I opened up the 232-485 converter box and saw that it
> uses only the TX, RX, SG, RTS and CTS lines on the RS232 side.  So
> it cannot be a matter of DTR or some other signal.
>

I had a similar problem a few days ago.
Old software worked, new one did not.
So I also used a third PC to look what the others talk.
I noticed the same as you.

Solution was that RTS had to be set active.


> Please help.
>
> Deepak Gupta
> -
> To unsubscribe from this list: send the line "unsubscribe linux-serial" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


Gerald Emig

--
EMIG Software		Tel. 06858-6197, Mobil: 0163-4751706
Engelstr. 17		Fax. 0721-151-348672
66564 Ottweiler-Fürth	http://sites.inka.de/heisch
Germany			e-mail: gme@heisch.inka.de


-
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: serial communication problems
       [not found] <Pine.LNX.4.33.0205300846120.17925-100000@emig4.heisch.inka.de>
@ 2002-05-30  6:40 ` Deepak Gupta
  2002-05-30  7:56   ` Deepak Gupta
  0 siblings, 1 reply; 6+ messages in thread
From: Deepak Gupta @ 2002-05-30  6:40 UTC (permalink / raw)
  To: Gerald Emig; +Cc: linux-serial

Thanks for the response.  I tried lowering RTS after
sending the data and raising it again before the next
try (using calls ioctl(fd, TIOCMBIC/TIOCMBIS, ...)).
But no luck.  When I debugged the program, and looked
at /proc/tty/driver/serial at breakpoints, I observed
(as expected) that RTS is high when sending and low
after sending.

I'm feeling desperate, please help .....

Deepak

-----Original Message-----
From: Gerald Emig [mailto:gme@heisch.inka.de]
Sent: Thursday, May 30, 2002 12:21 PM
To: Deepak Gupta
Subject: RE: serial communication problems



If it is such a converter box as you wrote, RTS probably only may active
if your program is sending. If it stays active after that, you can not
receive any data, because RTS switches between receive and transmit of the
box.

On Thu, 30 May 2002, Deepak Gupta wrote:

> RTS is active as reported by /proc/tty/driver/serial.
> In fact all three of RTS, CTS, and DTR are shown active.
>
> What else could be wrong?
>
> Deepak
>
> -----Original Message-----
> From: Gerald Emig [mailto:gme@heisch.inka.de]
> Sent: Wednesday, May 29, 2002 7:37 PM
> To: Deepak Gupta
> Cc: linux-serial@vger.kernel.org
> Subject: Re: serial communication problems
>
>
> On Wed, 29 May 2002, Deepak Gupta wrote:
>
> > Hi,
> >
> > I have a strange problem with the serial line communication in Linux
> > (RH 7.2, kernel 2.4.7-10).  We have some electronic locks that are
> > controlled by a PC.  The locks are connected by a RS485 twisted pair
> > (multidrop) and this line terminates in a 485-232 converter box which
> > is connected via the serial line to a PC.  The lock vendor has supplied
> > a Windows software to program the locks which works fine on this PC.
> > He has also given me the protocol that is followed between the PCs and
> > the locks.  I am trying to write my own Linux based software for
> > programming the locks.
> >
> > The problem is that when the vendor software sends a command to a lock
> > it replies obediently but when my program writes exactly the same
sequence
> > of bytes to the serial line, I don't get a response (the protocol
> > says that the lock will not respond unless it gets a valid command).
> > I know the locks use 9600 baud, 8 bits, no parity, 1 stop bit and I
> > am using the same.  I also tried with and without hardware flow control
> > (RTS/CTS) but no luck.  I know that the command I send is right since
> > I used another PC to listen to what the vendor software writes on the
> > serial line and it matches the protocol description that I have.
> >
> > Incidentally I opened up the 232-485 converter box and saw that it
> > uses only the TX, RX, SG, RTS and CTS lines on the RS232 side.  So
> > it cannot be a matter of DTR or some other signal.
> >
>
> I had a similar problem a few days ago.
> Old software worked, new one did not.
> So I also used a third PC to look what the others talk.
> I noticed the same as you.
>
> Solution was that RTS had to be set active.
>
>
> > Please help.
> >
> > Deepak Gupta
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-serial"
in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >
>
>
> Gerald Emig
>
> --
> EMIG Software		Tel. 06858-6197, Mobil: 0163-4751706
> Engelstr. 17		Fax. 0721-151-348672
> 66564 Ottweiler-Fürth	http://sites.inka.de/heisch
> Germany			e-mail: gme@heisch.inka.de
>
>
>


Gerald Emig

--
EMIG Software		Tel. 06858-6197, Mobil: 0163-4751706
Engelstr. 17		Fax. 0721-151-348672
66564 Ottweiler-Fürth	http://sites.inka.de/heisch
Germany			e-mail: gme@heisch.inka.de


-
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: serial communication problems
  2002-05-30  6:40 ` serial communication problems Deepak Gupta
@ 2002-05-30  7:56   ` Deepak Gupta
  0 siblings, 0 replies; 6+ messages in thread
From: Deepak Gupta @ 2002-05-30  7:56 UTC (permalink / raw)
  To: Deepak Gupta; +Cc: linux-serial, moona

Hi Gerald,

It worked!!  I had to clear RTS after sending as you said.
The mistake I was making was to not wait till all characters
have been actually transmitted.  I inserted a tcdrain(fd)
between write and the ioctl to lower RTS and it worked like
a dream.  Thanks a load.

Deepak

-----Original Message-----
From: Deepak Gupta [mailto:deepak@cse.iitk.ac.in]
Sent: Thursday, May 30, 2002 12:11 PM
To: Gerald Emig
Cc: linux-serial@vger.kernel.org
Subject: RE: serial communication problems


Thanks for the response.  I tried lowering RTS after
sending the data and raising it again before the next
try (using calls ioctl(fd, TIOCMBIC/TIOCMBIS, ...)).
But no luck.  When I debugged the program, and looked
at /proc/tty/driver/serial at breakpoints, I observed
(as expected) that RTS is high when sending and low
after sending.

I'm feeling desperate, please help .....

Deepak

-----Original Message-----
From: Gerald Emig [mailto:gme@heisch.inka.de]
Sent: Thursday, May 30, 2002 12:21 PM
To: Deepak Gupta
Subject: RE: serial communication problems



If it is such a converter box as you wrote, RTS probably only may active
if your program is sending. If it stays active after that, you can not
receive any data, because RTS switches between receive and transmit of the
box.

On Thu, 30 May 2002, Deepak Gupta wrote:

> RTS is active as reported by /proc/tty/driver/serial.
> In fact all three of RTS, CTS, and DTR are shown active.
>
> What else could be wrong?
>
> Deepak
>
> -----Original Message-----
> From: Gerald Emig [mailto:gme@heisch.inka.de]
> Sent: Wednesday, May 29, 2002 7:37 PM
> To: Deepak Gupta
> Cc: linux-serial@vger.kernel.org
> Subject: Re: serial communication problems
>
>
> On Wed, 29 May 2002, Deepak Gupta wrote:
>
> > Hi,
> >
> > I have a strange problem with the serial line communication in Linux
> > (RH 7.2, kernel 2.4.7-10).  We have some electronic locks that are
> > controlled by a PC.  The locks are connected by a RS485 twisted pair
> > (multidrop) and this line terminates in a 485-232 converter box which
> > is connected via the serial line to a PC.  The lock vendor has supplied
> > a Windows software to program the locks which works fine on this PC.
> > He has also given me the protocol that is followed between the PCs and
> > the locks.  I am trying to write my own Linux based software for
> > programming the locks.
> >
> > The problem is that when the vendor software sends a command to a lock
> > it replies obediently but when my program writes exactly the same
sequence
> > of bytes to the serial line, I don't get a response (the protocol
> > says that the lock will not respond unless it gets a valid command).
> > I know the locks use 9600 baud, 8 bits, no parity, 1 stop bit and I
> > am using the same.  I also tried with and without hardware flow control
> > (RTS/CTS) but no luck.  I know that the command I send is right since
> > I used another PC to listen to what the vendor software writes on the
> > serial line and it matches the protocol description that I have.
> >
> > Incidentally I opened up the 232-485 converter box and saw that it
> > uses only the TX, RX, SG, RTS and CTS lines on the RS232 side.  So
> > it cannot be a matter of DTR or some other signal.
> >
>
> I had a similar problem a few days ago.
> Old software worked, new one did not.
> So I also used a third PC to look what the others talk.
> I noticed the same as you.
>
> Solution was that RTS had to be set active.
>
>
> > Please help.
> >
> > Deepak Gupta
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-serial"
in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >
>
>
> Gerald Emig
>
> --
> EMIG Software		Tel. 06858-6197, Mobil: 0163-4751706
> Engelstr. 17		Fax. 0721-151-348672
> 66564 Ottweiler-Fürth	http://sites.inka.de/heisch
> Germany			e-mail: gme@heisch.inka.de
>
>
>


Gerald Emig

--
EMIG Software		Tel. 06858-6197, Mobil: 0163-4751706
Engelstr. 17		Fax. 0721-151-348672
66564 Ottweiler-Fürth	http://sites.inka.de/heisch
Germany			e-mail: gme@heisch.inka.de


-
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-05-30  7:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <Pine.LNX.4.33.0205300846120.17925-100000@emig4.heisch.inka.de>
2002-05-30  6:40 ` serial communication problems Deepak Gupta
2002-05-30  7:56   ` Deepak Gupta
     [not found] <005401c20717$6690c0c0$294b82ce@connecttech.com>
2002-05-30  2:52 ` Deepak Gupta
2002-05-29 11:05 Deepak Gupta
2002-05-29 14:07 ` Gerald Emig
2002-05-30  2:55   ` Deepak Gupta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox