0

A program in c using termios works well if the port is ttyusb0, but misses/garbles data if got through ttys0 i.e comport com1.

proogram runs under ubuntu 9.04 & 10.04

Please suggest the remedies cause for this discrepancy.

dreamcrash
  • 47,137
  • 25
  • 94
  • 117

2 Answers2

0

Garbled serial data is usually due to using the wrong serial speed. The default might be different for the usb port vs normal serial port. Are you calling cfsetispeed and cfsetospeed?

Per Johansson
  • 6,697
  • 27
  • 34
  • speed setting is being done using this statement:- new_port_settings.c_cflag = baudr | CS8 | CLOCAL | CREAD;with baudr being B19200 and is same for both.thnx – ashwani_gupt Mar 24 '12 at 21:01
0

Are you using the same serial cable for both tests? At higher baud rates, a bad cable can result in noise. If ttyusb0 has a short cable between the USB adapter and the device, but ttyS0 is a long ribbon cable, you'd easily see noise on ttyS0 but not ttyusb0.

tomlogic
  • 11,489
  • 3
  • 33
  • 59