[Ftdi-usb-sio-devel] Communication problems between Ubuntu Linux and Suunto D6 over FTDI usbserial
Brought to you by:
bryder
|
From: Matti D. <ma...@77...> - 2010-04-28 07:59:53
|
Hello - I'm writing a piece of software to talk to my dive computer Suunto
D6 from a linux machine, since Suunto only provides Windows software for
extracting the dive data. To do this I have written some serial code to
talk to the dive computer over the FTDI driver. Plugging the device in the
USB port, the FTDI driver immediately properly loads and creates
/dev/ttyUSB0. I then succesfully open the port, write data to it, but
never get anything back. There just is no reply from the device. I have
verified the protocol format using a byte by byte Serial sniffer on a
Windows machine, where the exact same sequence works properly.
Perhaps there is something wrong in the way I initialize the FTDI serial
port?
Code below:
---------------------------------------------------------------------
m_fd = open("/dev/ttyUSB0", O_RDWR | O_NOCTTY | O_SYNC);
if ( m_fd == -1 )
{
perror("failed to open serial port - ");
exit(-1);
}
// configure the new port settings for 9600baud, 8N1, raw output
termios options = termios();
options.c_cflag = B9600 | CS8 | CLOCAL | CREAD;
options.c_iflag = 0;
options.c_oflag = 0;
options.c_lflag = 0;
// 1 second port read timeout
options.c_cc[VMIN] = 0;
options.c_cc[VTIME] = 10;
// register the new port settings
tcflush(m_fd, TCIFLUSH);
if ( tcsetattr(m_fd, TCSANOW, &options) == -1 )
{
perror("tcsetattr() failed - ");
exit(-1);
}
---------------------------------------------------------------------
After that I just use write(2) and read(2) for rx/tx. I have tried pretty
much every port setting I could think of, and even tried manually setting
the DSR flag.
I am out of options debugging this, and would very much like to get it
running in order not have to have a Windows installation for this single
thing..
BR,
Matti
|