Re: [BUG] FTDI driver framing error with even parity

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

 



Hello Andrew,

I can not see such an error with a FT232R!

Your diagram is propably done by the Saleae Logic Logic analyzer. The
analyzer missanalyses the the trace. If you space the character like with
the patch below and if you don't overwrite the CFLAG setting PARENB with the
call to cfmakeraw(&newtio) , like with the patch below, the trace is decoded
right.

Bye

-- 
Uwe Bonnes                bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
diff --git a/main.c b/main.c
index 112689d..6d900a6 100644
--- a/main.c
+++ b/main.c
@@ -5,6 +5,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <termios.h>
+#include <unistd.h>
 #include "uart.h"
 
 
@@ -19,6 +20,11 @@ int main(int argc, char* argv[]) {
 	}
 	
 	char *hello = "Hello, world\n";
-	write(us->fd, hello, strlen(hello));	
+        char *p;
+        for (p = hello; *p; p++)
+        {
+            write(us->fd, p, 1);
+            usleep(1000);
+        }
 }
 
diff --git a/uart.c b/uart.c
index 4a5c7ca..c2fbfa4 100644
--- a/uart.c
+++ b/uart.c
@@ -70,6 +70,7 @@ int uart_init(struct uart_settings_t* us)
 	}
 	tcgetattr(fd,&oldtio); /* save current port settings */
 	bzero(&newtio, sizeof(newtio));
+	cfmakeraw(&newtio);
 	newtio.c_cflag =  us->cfl | CLOCAL | CREAD;
 	newtio.c_iflag = us->ifl;
 	newtio.c_oflag = us->ofl;
@@ -77,7 +78,6 @@ int uart_init(struct uart_settings_t* us)
 	newtio.c_lflag = 0;
 	newtio.c_cc[VTIME]    = 0;   /* inter-character timer unused */
 	newtio.c_cc[VMIN]     = 1;   /* We're non-blocking */
-	cfmakeraw(&newtio);
 	tcflush(fd, TCIFLUSH);
 	tcsetattr(fd,TCSANOW,&newtio);
 	us->fd=fd;
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux