[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: serial port DTR RTS direct control failed !!



Hi,
What hardware are you using?
What software release are you using?
What does the serial port settings in the kernelconfig look like?
Depending on your hardware it should say something like this:
CONFIG_ETRAX_SER0_DTR_ON_PA_BIT=-1
CONFIG_ETRAX_SER0_RI_ON_PA_BIT=-1
CONFIG_ETRAX_SER0_DSR_ON_PA_BIT=-1
CONFIG_ETRAX_SER0_CD_ON_PA_BIT=-1
CONFIG_ETRAX_SER0_DTR_ON_PB_BIT=4
CONFIG_ETRAX_SER0_RI_ON_PB_BIT=5
CONFIG_ETRAX_SER0_DSR_ON_PB_BIT=6
CONFIG_ETRAX_SER0_CD_ON_PB_BIT=7

Best regards
/Johan

----- Original Message ----- 
From: "Pin Yang Ang" <P.Y.Ang@xxxxxxx.uk>
To: <dev-etrax@xxxxxxx.com>
Sent: Wednesday, May 26, 2004 7:11 PM
Subject: serial port DTR RTS direct control failed !!


> Hi all,
>
> Please give me some advices on this!!
>
> I tried to directly control the RTS and DTR pins on the ETRAX 100 serial
> port. I ran the C programme on a PC with Redhat 7.0, it worked perfect.
But
> when I ran on the ETRAX board (with latest elinux), they is no response at
all.
>
> The PC serial port pins (1,6,8) had a voltage swing of +/- 11V, where as
in
> the ETRAX the voltage of the same pins remains at +7V all the time.
>
> Many thanks in advance!!
>
> Below is the source code:
>
> **************************************************************************
>
> #include <sys/types.h>
> #include <sys/stat.h>
> #include <fcntl.h>
> #include <termios.h>
> #include <stdio.h>
> #include <errno.h>
>
> #include <sys/ioctl.h>
>
> #define BAUDRATE B38400
> #define PORT "/dev/ttyS0"
>
> int main(int argc, char **argv)
> {
> int fd,c, res;
>         struct termios oldtio,newtio;
>         char buf[255];
>
> //
> int rtsEnable, rtsflags;
> int dtrEnable, dtrflags;
> //
> int tdEnable, tdflags;
>
>         /* Open modem device for reading and writing and not as
controlling tty
>            because we don't want to get killed if linenoise sends
CTRL-C.*/
>         fd = open(PORT, O_RDWR | O_NOCTTY );
>         if (fd <0)
> {
> perror(PORT);
> printf("cannot open serial port");
> exit(-1);
> }
>
> sscanf(PORT, "%d", &dtrEnable);
> fprintf(stderr, "dtrEnable are %x.\n", dtrEnable);
>
> ioctl(fd, TIOCMGET, &dtrflags);
>   fprintf(stderr, "dtrFlags are %x.\n", dtrflags);
> sleep(2);
> dtrflags &= ~TIOCM_DTR;
> ioctl(fd, TIOCMSET, &dtrflags);
>   fprintf(stderr, "Setting %x.\n", dtrflags);
> sleep(2);
> ioctl(fd, TIOCMGET, &dtrflags);
>   fprintf(stderr, "dtrFlags are %x.\n", dtrflags);
>
> return 1;
> }
>
> ****************************************************************
>
>