Re: [Ftdi-usb-sio-devel] Data corruption on serial link using FTDI USB to serial driver and RS232
Brought to you by:
bryder
From: Michael P. <mic...@gm...> - 2018-03-16 23:14:08
|
Mats, I don't know the answer, but I see patterns in the data. I suggest carefully checking parity, 1vs2 stop bits, and 7vs8 bits/char and reporting what you see. I can't remember the chipset, but I've seen some converters don't respect all those settings, so you might try 8n1 if you can. Buffering with usb to serial is hit or miss in my experience. I assume the converter is COTS, not custom, and it's a plain serial cable. An oscope would make this easier. Maybe also try sending other patterns involving 5,A,3,C. Michael On Mar 16, 2018 10:33, "Mats Jansson" <mat...@te...> wrote: > Hi, > > I have a problem with the FTDI USB Serial port driver in an embedded > system. > The embedded system is a running Linux kernel 4.4, and we have an > atmel processor. > > The FTDI USB Serial port driver is built into the kernel. > > I attach an the USB end of an FTDI USB to RS232 adapter to the linux unit > and connect > the RS232 connector to a PC. > > In a terminal window on my linux unit I do the following > $ echo 01234567899876543210 > /dev/ttyUSB0 > $ echo 01234567899876543210 > /dev/ttyUSB0 > $ echo 01234567899876543210 > /dev/ttyUSB0 > $ echo 01234567899876543210 > /dev/ttyUSB0 > $ echo 01234567899876543210 > /dev/ttyUSB0 > > In the other end I have connected a PC and built a very simple program > that opens the COM port, reads data and prints it out. > I was expecting to get the data as (printed in hex values): > Read 20 bytes [30 31 32 33 34 35 36 37 38 39 39 38 37 36 35 34 33 32 31 30] > Read 20 bytes [30 31 32 33 34 35 36 37 38 39 39 38 37 36 35 34 33 32 31 30] > Read 20 bytes [30 31 32 33 34 35 36 37 38 39 39 38 37 36 35 34 33 32 31 30] > Read 20 bytes [30 31 32 33 34 35 36 37 38 39 39 38 37 36 35 34 33 32 31 30] > Read 20 bytes [30 31 32 33 34 35 36 37 38 39 39 38 37 36 35 34 33 32 31 30] > > But the resulting data on the PC from the three lines of echo above is: > Read 14 bytes [D6 B6 96 76 56 36 16 F6 D6 D6 F6 16 36 56 ] > Read 28 bytes [76 96 B6 D6 F6 B6 00 D6 B6 96 76 56 36 16 F6 D6 D6 F6 16 36 > 56 76 96 B6 D6 F6 B6 00 ] > Read 14 bytes [D6 B6 96 76 56 36 16 F6 D6 D6 F6 16 36 56 ] > Read 15 bytes [76 96 B6 D6 F6 B6 00 D6 B6 96 76 56 36 16 F6 ] > Read 29 bytes [D6 D6 F6 16 36 56 76 96 B6 D6 F6 B6 00 D6 B6 96 76 56 36 16 > F6 D6 D6 F6 16 36 56 76 96 ] > > Not only the data is not all what I suspected, there seems to be some > buffering issue. > > I have tested with different speeds on the line, 2400, 9600, 57600 and > 115200 and the result is the same in all cases. I have also tested to > send data the other way, and the result is similar. > > Does anyone have any idea what could be wrong here? > Why is the data corrupted? > > Best Regards, > Mats mailto:mat...@te... > > > ------------------------------------------------------------ > ------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Ftdi-usb-sio-devel mailing list > Ftd...@li... > https://lists.sourceforge.net/lists/listinfo/ftdi-usb-sio-devel > |