title: C linux: Serial communication lost some first bytes when receive data
body: <p>I'm working on Linux system that using modbus rtu RS485 to send and receive data. My device is master and just send &quot;request latest data&quot;(8Bytes include 2Byte CRC) to slaver (from now is only 1 slaver) every 1second. when Slaver receive request, they will prepare data (71Bytes include CRC) and send back to Master. I can't see the source of Slaver because this is commercial product.
  Both of Master and Slaver using same baud rate 38400.</p>
  <p>Result:</p>
  <ol>
  <li>When check communication between Master and Slaver, sometimes (average is 1-2hours) data from Slaver is lost some first Bytes, and first Byte that received has been modified with other value that sent from Slaver (sometime lost some first Bytes only)</li>
  <li>Sometime data from Slaver not come (timeout but do not receive any data). I tried to increase timeout by 500ms or 1sec but still occurs without any change</li>
  <li>I tested Slaver by communication with Teraterm and there is no error like above. Data that sent and received are OK. With Master, I also tested with Teraterm and there is no error.</li>
  <li>When I try to catching data while Master and Slaver send &amp; receive data, when problem are occurred(not receive any data or lost some first bytes) on both of Master side and on my PC side (try to catching data byte Teraterm on PC).</li>
  </ol>
  <p>I believe that problem is on Master side, and maybe on serial port setting, but I don't know where were wrong. Please help.</p>
  <p>Sorry for my poor English!</p>