Serial communication blocks of real-time windows target do not work in real-time

Serial communication blocks of real-time windows target do not work in real-time

Post by dubice17 W » Tue, 22 Dec 2009 04:07:03


Hello,

I am trying to use real-time windows target to communicate with another computer through the serial port. The problem I have is that the serial communication blocks of real-time windows target do not work in real-time. I am using Matlab 2007b but I have also tried Matlab 2009a and had exactly the same problem. Is there any way to fix the problem?
 
 
 

Serial communication blocks of real-time windows target do not work in real-time

Post by John Wood » Tue, 22 Dec 2009 14:44:03

Hi,

I had the same problem. As far as I know, there is no solution to the problem.

Best regards,

John

 
 
 

Serial communication blocks of real-time windows target do not work in real-time

Post by Frank W » Tue, 22 Dec 2009 18:39:03

> > I am trying to use real-time windows target to communicate with another computer >through the serial port. The problem I have is that the serial communication blocks of >real-time windows target do not work in real-time. I am using Matlab 2007b but I have >also tried Matlab 2009a and had exactly the same problem. Is there any way to fix the >problem?

Hi,
I would first (befoe setting up the project) calculate if the data really can be transmitted in real time. Depending on the baud rate you use you know the amount of bytes that can be transmitted. If this value is too small either increase the baud rate and/or minimize protocol data (if this is possible). If you use your own protocol consider buffering data and processing unimportant tasks at a lower rate.
If there is still too much data you'd have to use ethernet.
Regards
Frank
 
 
 

Serial communication blocks of real-time windows target do not work in real-time

Post by John Wood » Tue, 22 Dec 2009 19:54:03

Hi Frank,

Thank you very much for your reply.

The bottleneck here is not really the hardware (the relatively slow speed of rs232) but poor programming (on both Matlab and Windows side). With 115200 baud (which is the standard maximum speed of the com port), it is possible to achieve 11520 bytes/s "real-time" transmission using 8 data + 1 start + 1 stop bit (without even using the FIFOs). In fact, if I remember correctly, I was achieving this data rate with an i486 running at 33 MHz. Now, I can not achieve a rate faster than 100 bytes/s with a 3.2 GHz dual core i586.

The potential "real-time" transmission rate of the serial port is not really that bad at all (11520 bytes/s). However, thanks to the excellent utilization of hardware resources in Matlab and Windows, we can not even achieve 1/10 of that available capacity. Unfortunately, buffering the data is not a solution as the communication is supposed to be "real-time".

Best regards,

John
 
 
 

Serial communication blocks of real-time windows target do not work in real-time

Post by John Wood » Tue, 22 Dec 2009 20:18:04

I made a mistake in my previous post. 1/10 should be replaced by 1/100 in my previous post. That is, we can not achieve 1/100 of the available capacity (11520 bytes/s).

Sorry about this.

John