MATLAB: Do I get overflow errors with serial communication between Quatech ESC-100F and xPC Target 3.4(R2008a)

fifooverflowSimulink Real-Timexpc

When I do serial communication between Quatech ESC-100F board and xPC Target, I get an overflow error at the transmitting side.

Best Answer

The time step used in xPC Target and in the QuaTech board are only approximations to the time a user specifies. Each of these has a separate crystal oscillator that has some small error. One of them will be slightly faster than the other.
Therefore, any model that expects them to stay exactly in sync will see a FIFO overflow on one side or the other.
A transmit FIFO overflow can occur if the user sent message takes slightly longer than the sample time.
It depends on how many characters are you sending and what baud rate are you using.
For instance, if you are sending 11 characters at 9600 baud, that takes 11*10/9600 = .0115 seconds. Each character has 8 data bits plus 1 start and 1 stop bit. If you're running with a sample time of 0.01 seconds, this example will eventually get a transmit FIFO overflow since you aren't emptying the outgoing FIFO fast enough.
If you have a baud rate that is fast enough to send your whole message in the sample time, but the receiver is running slightly slower than the transmitter, then data in the receive side FIFO will build up until you get a receive FIFO overflow since you aren't taking it out fast enough.
You need to assume that the two machines are running completely asynchronously to avoid problems like your FIFO overflows.