Thank you for responding again,
Bonnes, Uwe> As with every hardware/software/firmware setup, try to find
the failing part.
....
Bonnes, Uwe> And there may be even problems with the cables, the connectors
or the USB port on the PC.
If I use the following code it works perfectly:
fd = open("/dev/ttyUSB0", O_RDWR | O_NOCTTY | O_NDELAY);
fcntl(fd, F_SETFL, 0);
if (fd == -1)
printf("Com open failed\n");
//get the current options
tcgetattr(fd, &options);
//edit the current options
options.c_iflag = 0;
options.c_oflag = 0;
options.c_cflag = CS8 | CREAD | CLOCAL; //8n1, 8 data bits, no parity and 1
stop bit
options.c_lflag = 0;
options.c_cc[VMIN] = 1;
options.c_cc[VTIME] = 5;
cfsetispeed(&options, B115200); //Plugwise device I'm using communicates on a
baudrate of 115200
cfsetospeed(&options, B115200);
//set the current options
tcsetattr(fd, TCSANOW, &options);
write(fd, message, message.length());
Doesn't that rule out the failure of hardware?
Therefore I think it must be the code I'm using.
You also said:
Bonnes, Uwe> Maybe RTS/CTS or some other controlling line is in a bad
state.
I think you could be very right here, however I sadly do not know what could be
wrong.
However the earlier mentioned code cannot determine wether ttyUSB0 or ttyUSB1
is the right USB device to communicate with,
this is why I want to use libftdi.
Bonnes, Uwe> That was the reason why I suggested the examples/testserial.
Does that run now ?
Sadly the device I'm using doesn't write anything on its own,
so the serial_read program does work and says read 0 bytes,
but because I can't write to it I'll never read anything and therefore do not
know if it is working or just returning 0 all the time.
Maurice Ampt.
--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
|