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 ...
- 01-18-2011 #1Just 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.
- 01-18-2011 #2
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()...
- 01-18-2011 #3Just 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..


