[Ftdi-usb-sio-devel] [SOLVED] Baudrate setting is broken.
Brought to you by:
bryder
From: Teunis v. B. <te...@gm...> - 2014-09-29 15:58:33
|
Dear maintainers, It looks like I solved the problem. I was using this code to set the params for the serial port: new_port_settings.c_cflag = baudr | cbits | cpar | bstop | CLOCAL | CREAD; new_port_settings.c_iflag = IGNPAR; new_port_settings.c_oflag = 0; new_port_settings.c_lflag = 0; new_port_settings.c_cc[VMIN] = 0; /* block untill n bytes are received */ new_port_settings.c_cc[VTIME] = 0; /* block untill a timer expires (n * 100 mSec.) */ cfsetispeed(&new_port_settings, baudr); cfsetospeed(&new_port_settings, baudr); error = tcsetattr(Cport[comport_number], TCSANOW, &new_port_settings); After adding the next two lines to my sourcecode, it works fine: cfsetispeed(&new_port_settings, baudr); cfsetospeed(&new_port_settings, baudr); So, this means that setting the baudrate with: new_port_settings.c_cflag = baudr | cbits | cpar | bstop | CLOCAL | CREAD; is not sufficient?? (baudr is an int that contains the value B9600 or B19200, etc.) Sorry for bothering, Best Regards, Teunis van Beelen -- "C'è qualcosa nella nebbia! Qualcosa nella nebbia ha preso John Lee!" |