RS232 write operation

P

Thread Starter

pv_srt

Hi everyone,

I am writing buffers to the serial port one after the other in a sequence. But since the write operation cannot finish and a new buffer becomes available for writing, some of my buffers are lost.How can I make sure that all my buffers are written and none of them is lost?

I tried to use Sleep() after each write operation to let the WriteFile() function finish writing, but it does not seem to help. Please advise.

Thanks in advance.
 
M

Michael Griffin

Your description is a bit unclear, but it sounds like either the output buffer on the sending end or the input buffer in the receiving end is overflowing
because you are filling the buffer faster than it can empty. The problem is usually at the receiving end, since most serial libraries block if the sending buffer is full.

1) Find out which end the data is being lost at.

2) Try using a bigger buffer.

3) Check your flow control settings and wiring.
 
Top