serial port behavior

bernatik_at_kn.vutbr.cz
Date: 10/19/05


Date: 19 Oct 2005 11:35:42 -0700

hi all

I am trying to control special device through serial port from Linux.
 For that purpose I need to control DTR signal. I am watching the
signal
 on a oscilloscope, so I know exactly what is happening.

terminology from:
 (http://www.easysw.com/~mike/serial/serial.html)

when DTR is in SPACE level and I call ioctl to set it to SPACE level,
 nothing happen, as expected.
 but when DTR is in MARK level and I set it to MARK level, it generates

 a short
 peak.
 switching from MARK to SPACE works as expected.

second strange thing is, that when the program end, DTR does not change

 to initial level (even if I restore terminal state), and no matter
what
 real DTR state is, reading controlbits always returns same result
 (0x4006).

I am working with serial port first time, so any help/explanation will
 be apreciated.
 I am not sure I am doing smething wrong, or this is "normal" behavior.

 I tested it on 2 different machines, without any difference.

my code is generally taken from Serial Programming Guide, and looks
 like this
 ( open/save/restore modem exactly from guide)

------

//setting DTR
 int controlbits;
 ioctl(fd, TIOCMGET, &controlbits);

//to SPACE
 controlbits |= TIOCM_DTR;

//to MARK
 controlbits &= ~TIOCM_DTR;

ioctl(fd, TIOCMSET, &controlbits);

------

ubuntu, 2.6.10-5 kernel, serial port driver compiled in.
 
thanks for your time, have a nice day



Relevant Pages

  • serial port behavior
    ... I am trying to control special device through serial port from Linux. ... For that purpose I need to control DTR signal. ... but when DTR is in MARK level and I set it to MARK level, ... reading controlbits always returns same result ...
    (comp.unix.programmer)
  • serial port behavior
    ... I am trying to control special device through serial port from Linux. ... For that purpose I need to control DTR signal. ... but when DTR is in MARK level and I set it to MARK level, ... reading controlbits always returns same result ...
    (comp.lang.c)
  • Re: Unsuccessfull serial communication with CF 2.0
    ... Your device requires voltage on RTS or DTR. ... it just can't support the handshaking lines. ... > CF 2.0 SerialPort class to send and receive data via serial port? ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: serial port DTR and RTS
    ... Before I open the serial port, ... But I dont see any potential across thse 2 pins? ... My main purpose to access the DTR and RTS pins is to drive ...
    (comp.soft-sys.matlab)
  • Re: Reading serial port with BASH only
    ... the serial port device has side effects (e.g. DTR changing ... You can write a small program that opens the serial port and ...
    (comp.os.linux.development.system)