an asynchronous write is already in progress ???? simulink

5 views (last 30 days)
i'im using UDP block receiver and UDP send BLOCK in the same .mdl model
IT RUNS FOR 4 minutes and then there is the ERROR :: (an asynchronous write is already in progress )
help

Answers (1)

Ryan G
Ryan G on 1 Oct 2012
Are you sending and receiving data from the same IP address and Port?
How are you running the model (just the play button?) It sounds like eventually it is attempting to write and for whatever reason it's taking longer than normal, so instead of waiting for the write to finish it moves to the next time step, attempts to read, and can't because the write is still in progress.
  3 Comments
Ryan G
Ryan G on 1 Oct 2012
Well if it's trying to write while it's already writing that may be the issue. One thing you can try is using a MATLAB function block and create an object for the serial port. From there you can check the transfer status of the port. Something like this might work:
s = serial('COM1');
out1 = get(s,'TransferStatus');
And then the output of the MATLAB function block would be a trigger. If the transfer status says it's busy, don't trigger the UDP send, if it is not busy, send the data.
You can also use something like this pacer for simulink that will slow down the model sim time and allow for the UDP send/receive operations to catch up to the time the sim performs them.

Sign in to comment.

Tags

Products

Community Treasure Hunt

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

Start Hunting!