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

Re: com port DTR and RTS - work around



Can you verify that your os/linux/.config
contains the following which enables the
extra status and control signals on the correct ports.

CONFIG_ETRAX_SERIAL_PORT0=y
CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_PB=y
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
CONFIG_ETRAX_SERIAL_PORT1=y
# CONFIG_ETRAX_SER1_DTR_RI_DSR_CD_ON_PB is not set
CONFIG_ETRAX_SERIAL_PORT2=y
CONFIG_ETRAX_SER2_DTR_RI_DSR_CD_ON_PA=y
CONFIG_ETRAX_SER2_DTR_ON_PA_BIT=4
CONFIG_ETRAX_SER2_RI_ON_PA_BIT=5
CONFIG_ETRAX_SER2_DSR_ON_PA_BIT=6
CONFIG_ETRAX_SER2_CD_ON_PA_BIT=7
CONFIG_ETRAX_SERIAL_PORT3=y

if I remember correctly it was missing in early versions
of the devboard lx releases but fixed in later versions.

/Johan

----- Original Message ----- 
From: "Murray Snowden" <mursnow@xxxxxxx.com>
To: "dev-etrax" <dev-etrax@xxxxxxx.com>
Sent: den 8 juli 2002 02:23
Subject: com port DTR and RTS - work around


I was able to clr DTR with one of the hwtest routines:
void clrbits( int bitmap ) {
 int devfd;
 devfd = open("/dev/gpiob", O_WRONLY);
 ioctl(devfd, _IO(ETRAXGPIO_IOCTYPE, IO_CLRBITS), bitmap);
 close( devfd );
}

// my new open
  int setvalue = 0x10;
  
  if ((fd = open("ttyS0", O_RDWR)) < 0) {
    printf("Couldn't open Com1\n");
    exit(1);
  }

  tcgetattr(fd, &tio);          /* get the termio information */
  tio.c_cflag &= ~HUPCL;        /* clear the HUPCL bit */
  tcsetattr(fd, TCSANOW, &tio); /* set the termio information */

  ioctl(fd, TIOCMGET, &status); /* get the serial port status */

  status |= TIOCM_DTR;
  status |= TIOCM_RTS;

  ioctl(fd, TIOCMSET, &status); /* set the serial port status */

  // this takes care or DTR 
  clrbits(setvalue);

  close(fd);                    /* close the device file */

Murray