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

serial port 2 (COM2/ser2)



Hello,

I want to use the serial port 2 (COM2/ser2) with 19200 kBaud. But with my 
program, I couldn't change the baudrate.
I think the program is ok, because I can change the baudrate from other 
serial ports (for example ser0) on the Axis Developer Board LX.

My program:

	//open the device
	dev=open(device,O_RDWR | O_NOCTTY | O_NDELAY);
	if(dev<0)
		return(0);

	tcgetattr(dev,&oldio);
	bzero(&newio,sizeof(newio));
	
	newio.c_cflag= BAUDRATE | CS8 | CREAD;   // BAUDRATE is my baudrate!!! it 
						// works for all ports but not for ser2
	newio.c_iflag=IGNPAR | IXON | IXOFF;
	newio.c_oflag=0;
	newio.c_lflag=ICANON;
	
	tcflush(dev,TCIFLUSH);
	tcsetattr(dev,TCSANOW,&newio);
	tcsendbreak(dev,0);
	
	return(1);

Andreas Auer