Unexpected error: A timeout occurred during the write operation..

14 views (last 30 days)
while sending the data serially i am experiencing a unexpected error:
Error using serial/fprintf (line 156)
Unexpected error: A timeout occurred during the write
operation..
Error in VSigTX (line 28)
fprintf(SendData, '%s',data);
how to remove the error as the sending matrix is a very lagre matrix of about 6400000x1

Accepted Answer

Walter Roberson
Walter Roberson on 20 Apr 2019
Increase the serial output buffer size and also send less in one fprintf.
Renegotiate the protocol with the other side so that there is a line terminator from time to time: at present you send all the lines without any breaks unless your data just happens to contain newline.
If your data is binary rather than line oriented then you should be using fwrite instead of fprintf, and you should probably also be using a binary transfer protocol like zmodem or Kermit because serial is not a reliable protocol. Or configure SLIP or PPP or similar over the serial link and use rcp or ftp to copy data.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!