Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Hardware
User Name
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?


  Search this Thread
Old 06-05-2009, 05:54 AM   #1
LQ Newbie
Registered: Jun 2009
Location: Hrvatska
Distribution: Ubuntu
Posts: 10

Rep: Reputation: 0
FTDI communication problems

Hi. I'm using FTDI FT232BM serial converter for communication between PC and custom microcontroller board (Atmel MCU), on linux (but tested on too), ubuntu linux. There are few commands that PC sends, and MCU responds. Most commands are short, 2-3 bytes only, and there was no single error in communication. I recently implemented one command (for some kind of protection), where PC sends command byte + 8 data bytes, and MCU responds with 8 bytes. (Actually, it's double than that, because MCU & PC 'echo' (send back) every byte received). Problem is, out of 250 tests, around 10 of them fail (~3% chance of failure). It's not predictable, sometimes there are 2 failures (out of 250 tests), sometimes 15. What happens is that no data is waiting for me (for PC) in input buffer, like it's lost. Latency is set to 1 ms. Could there be any other issue other that cabling for these errors? (USB cable from board to PC is not shielded, and ~25cm long). I can't debug properly MCU board (it's developed by someone else), but I doubt it's MCU fault (PC normaly scans MCU ~30 times per sec, for it's input lines & state, so there's activity going on all the time). Baud rate is set to 57600. Is there anything else about FTDI or USB serial stuff I may have overlooked? Here's the code I use to setup ttyUSB port:

/* error checking left out */
struct termios st;
int fDev = open("/dev/ttyUSB0", O_RDWR | O_NOCTTY);
tcgetattr(fDev, &st);
cfsetspeed(&st, B57600);
st.c_cflag &= ~PARENB;
st.c_cflag &= ~CSTOPB;
st.c_cflag &= ~CSIZE;
st.c_cflag |=  CS8;
st.c_cflag &= ~CRTSCTS;
st.c_cflag |=  CREAD;
st.c_cflag |=  CLOCAL;
st.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
st.c_iflag &= ~(IXON | IXOFF | IXANY);
st.c_oflag &= ~OPOST;
st.c_cflag &= ~(OCRNL | ONLCR);
st.c_cc[VMIN]  = 0;
st.c_cc[VTIME] = 2;
tcsetattr(fDev, TCSANOW, &st);


ftdi, usbserial

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Fault in KDE processes communication: Could not read network communication list Magnus Johansson MEPIS 0 03-30-2008 12:50 PM
glcd + ftdi + usb tooly Linux - Hardware 1 09-25-2005 11:47 AM
DHCP overcomes my communication problems rickthemick Linux - Networking 3 11-01-2004 08:27 AM
problems communication on ttyS0 _HB_ Linux - Hardware 0 06-24-2004 06:57 AM
Modem communication Problems iannickb Linux - Hardware 1 03-14-2004 08:31 PM > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 09:10 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration