Find the answer to your Linux question:
Results 1 to 3 of 3
Hi, I have a microcontroller sending bytes to a linux computer through a serial port. In a c program I use read() (in unistd.h) to receive those bytes. It seems ...
  1. #1
    Just Joined!
    Join Date
    Jan 2011
    Location
    the Netherlands
    Posts
    2

    [SOLVED] Problem regarding serial port communication

    Hi,

    I have a microcontroller sending bytes to a linux computer through a serial port. In a c program I use read() (in unistd.h) to receive those bytes. It seems that read() does not return all bytes in the order in which they were sent. When I connect the microcontroller to a windows computer the bytes are returned in the order they were sent (by ReadFile()).

    My question is: which settings affect the order in which read() returns data? (I want to read them in the order they were sent.)

    The reason I'm posting here is that I haven't got the faintest idea what I should be searching for in order to solve this.

  2. #2
    Linux Newbie tetsujin's Avatar
    Join Date
    Oct 2008
    Posts
    115
    reading off a serial port should yield the data in the right order. Could we see your code? It's possible you've made a basic error somewhere in the usage of read()...

  3. #3
    Just Joined!
    Join Date
    Jan 2011
    Location
    the Netherlands
    Posts
    2
    Thanks for your reply, but I got it working just now.

    I think a good night's sleep did the trick. When examining the data I noticed that the eighth bit was always zero, because the ISTRIP bit was set in the c_iflag..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...