Forum Discussion
Altera_Forum
Honored Contributor
16 years agoI can't see where in your code you are opening the serial port. In order to make it easier for people wanting to help, you could post the smallest/simplest code that reproduces the problem you are seeing. That would be a simple main() function including the places where you open the uart, configure it and read the characters. Please do that if you can.
From what you've said in your previous posts, it doesn't seem that the OS is guilty about this delay. You say that the whole message is seen on the wire for 2 ms (I'm assuming you've seen that with a scope); after that period, the bytes were probably already received by the OS and placed in its rx buffer. So the only thing that could be slow is getting them from this buffer, which is done by the C functions you use for it (fscanf, etc.). My first try would be to read the incoming bytes with fread(). Of course you should declare a buffer to hold the data in advance: <div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'> char buf[1024]; int bytesCount = read(fd, buf, 1024);</div> Good luck, Ricardo.