Hi guys,
I know that recent versions of Real-Time Windows Target (RTWT) support the RS232 communication better than previous versions. But I need to know more about how well RTWT can support RS232. For example, I have some questions as follow:
1. If I have a RS232 port which is set to run at baudrate 115200 (or even higher), can RTWT handle this?
2. What is the minimum possible sample time RTWT can achieve when working with a RS232 port?
3. Why doesn't RTWT support a virtual RS232 port (the one created by using a USB-to-RS232 cable)?
3. Is there any advice about using RTWT with RS232 communication?
Thank you for reading my question. Any answer would be very appreciated.
Regards,
Uzumaki
|
|
0
|
|
|
|
Reply
|
Uzumaki
|
4/16/2010 3:11:05 AM |
|
Uzumaki wrote:
> 3. Why doesn't RTWT support a virtual RS232 port (the one created by
> using a USB-to-RS232 cable)?
My understanding, based upon briefly looking at some previous messages
(and not based upon practical experience) is that USB to RS232 cables
can not or do not provide a tight enough interrupt latency.
I was just looking at the source for a USB to serial driver, which seems
to indicate that it returned characters after 40 ms or after 62 bytes
have been read (whichever comes first), _unless_ the device is
effectively "polled" by sending it a Special Event request.
Every communication from a USB device is a packet; to receive a single
character requires transfer of at least a 5 byte header; at least one
mass-produced converter also requires reserves the first two bytes of
data for the modem and line status registers. Such devices thus require
the transfer of at least 8 bytes in order to transfer a single
"real-time" byte -- and that is in addition to the time the device
spends negotiating for control of the USB bus and negotiating bus speed.
|
|
0
|
|
|
|
Reply
|
Walter
|
4/16/2010 4:08:20 AM
|
|
"Uzumaki " <narutofan01234@yahoo.com> wrote in message <hq8kg9$pfn$1@fred.mathworks.com>...
> Hi guys,
>
> I know that recent versions of Real-Time Windows Target (RTWT) support the RS232 communication better than previous versions. But I need to know more about how well RTWT can support RS232. For example, I have some questions as follow:
>
> 1. If I have a RS232 port which is set to run at baudrate 115200 (or even higher), can RTWT handle this?
> 2. What is the minimum possible sample time RTWT can achieve when working with a RS232 port?
> 3. Why doesn't RTWT support a virtual RS232 port (the one created by using a USB-to-RS232 cable)?
> 3. Is there any advice about using RTWT with RS232 communication?
>
> Thank you for reading my question. Any answer would be very appreciated.
>
> vRegards,
>
> Uzumaki
Hi Uzumaki,
1. Yes, RTWT can handle 115200 baud.
2. Approximately, 1/100 = 0.01 s (r2007b, r2008a, r2008b)
3. Because USB is not real-time by design.
4. Follow the link http://www.mathworks.com/matlabcentral/linkexchange/links/2041-real-time-control-platform-for-matlab-and-simulink-dc-motor-control and also visit the website mentioned in the video http://zeltom.com/hilink.aspx.
Dan
|
|
0
|
|
|
|
Reply
|
dan
|
4/16/2010 8:25:23 AM
|
|
>
> 1. Yes, RTWT can handle 115200 baud.
> 2. Approximately, 1/100 = 0.01 s (r2007b, r2008a, r2008b)
> 3. Because USB is not real-time by design.
> 4. Follow the link http://www.mathworks.com/matlabcentral/linkexchange/links/2041-real-time-control-platform-for-matlab-and-simulink-dc-motor-control and also visit the website mentioned in the video http://zeltom.com/hilink.aspx.
Hi Dan, thank you for your answer.
According to your answer, 100 Hz seems to be the fastest frequency RTWT can handle (with RS232 communication). But basing on the information from Zeltom, their product can run at frequency 3.8 kHz (the product also communicates with PC via RS232 communication)?
This information contradicts your answer, doesnt it?
Uzumaki
|
|
0
|
|
|
|
Reply
|
Uzumaki
|
4/16/2010 11:28:05 AM
|
|
"Uzumaki " <narutofan01234@yahoo.com> wrote in message <hq9hk5$hun$1@fred.mathworks.com>...
> >
> > 1. Yes, RTWT can handle 115200 baud.
> > 2. Approximately, 1/100 = 0.01 s (r2007b, r2008a, r2008b)
> > 3. Because USB is not real-time by design.
> > 4. Follow the link http://www.mathworks.com/matlabcentral/linkexchange/links/2041-real-time-control-platform-for-matlab-and-simulink-dc-motor-control and also visit the website mentioned in the video http://zeltom.com/hilink.aspx.
>
> Hi Dan, thank you for your answer.
>
> According to your answer, 100 Hz seems to be the fastest frequency RTWT can handle (with RS232 communication). But basing on the information from Zeltom, their product can run at frequency 3.8 kHz (the product also communicates with PC via RS232 communication)?
>
> This information contradicts your answer, doesnt it?
>
> Uzumaki
Uzumaki,
No, it does not. The number I gave you is for RTWT. Their software allows such a high rate. They even have a different version that can achieve 1/15.2e3 = 65.7895e-6 s.
Dan
|
|
0
|
|
|
|
Reply
|
dan
|
4/16/2010 4:03:21 PM
|
|
Hi,
dan schott wrote:
> "Uzumaki " <narutofan01234@yahoo.com> wrote in message
> <hq9hk5$hun$1@fred.mathworks.com>...
>> > > 1. Yes, RTWT can handle 115200 baud.
>> > 2. Approximately, 1/100 = 0.01 s (r2007b, r2008a, r2008b)
>> > 3. Because USB is not real-time by design.
>> > 4. Follow the link
>> http://www.mathworks.com/matlabcentral/linkexchange/links/2041-real-time-control-platform-for-matlab-and-simulink-dc-motor-control
>> and also visit the website mentioned in the video
>> http://zeltom.com/hilink.aspx.
>>
>> Hi Dan, thank you for your answer.
>>
>> According to your answer, 100 Hz seems to be the fastest frequency
>> RTWT can handle (with RS232 communication). But basing on the
>> information from Zeltom, their product can run at frequency 3.8 kHz
>> (the product also communicates with PC via RS232 communication)?
>>
>> This information contradicts your answer, doesnt it?
>>
>> Uzumaki
>
> Uzumaki,
>
> No, it does not. The number I gave you is for RTWT. Their software
> allows such a high rate. They even have a different version that can
> achieve 1/15.2e3 = 65.7895e-6 s.
Actually, the maximum sampling frequency for RS232 in Real-Time Windows
Target is currently 500 Hz, not 100 Hz. Some improvement is planned for
the next version, but not all kinds of RS232 hardware will be able to
run at those higher speeds.
Jan
--
Jan Houska HUMUSOFT s.r.o.
houska@humusoft.com Pobrezni 20
http://www.humusoft.com 186 00 Praha 8
tel: ++ 420 284 011 730 Czech Republic
fax: ++ 420 284 011 740
|
|
0
|
|
|
|
Reply
|
Jan
|
4/18/2010 5:27:58 AM
|
|
Jan Houska <houska@humusoft.com> wrote in message <hqe58u$1vsk$1@ns.felk.cvut.cz>...
> Actually, the maximum sampling frequency for RS232 in Real-Time Windows
> Target is currently 500 Hz, not 100 Hz. Some improvement is planned for
> the next version, but not all kinds of RS232 hardware will be able to
> run at those higher speeds.
>
> Jan
>
>
> --
> Jan Houska HUMUSOFT s.r.o.
> houska@humusoft.com Pobrezni 20
> http://www.humusoft.com 186 00 Praha 8
> tel: ++ 420 284 011 730 Czech Republic
> fax: ++ 420 284 011 740
Hi Jan, thank you for your answer.
Well, 500 Hz is enough for me. However, when you said that 'not all kinds of RS232 hardware will be able to run at those higher speeds', which hardware and speeds were you referring to?
Another question is that: Since my laptop doesn't have any RS232 port, I intend to use an "ExpressCard to RS232" adapter to make one. In this case, will RTWT see and support this RS232 port like a real one?
Regards,
Uzumaki
|
|
0
|
|
|
|
Reply
|
Uzumaki
|
4/18/2010 8:32:05 AM
|
|
Hi Uzumaki,
Uzumaki wrote:
> Well, 500 Hz is enough for me. However, when you said that 'not all
> kinds of RS232 hardware will be able to run at those higher speeds',
> which hardware and speeds were you referring to?
Any port that I know of should be able to run at 500 Hz. I was referring
to the future enhancement that will enable some ports to run at speeds
of 5 kHz and above. This will have to be the "natural" RS232 port, i.e.
no emulation, no bridge, just the I/O port, usually present at address
3F8h (for COM1).
> Another question is that: Since my laptop doesn't have any RS232 port, I
> intend to use an "ExpressCard to RS232" adapter to make one. In this
> case, will RTWT see and support this RS232 port like a real one?
I don't have any experience with this adapter, but I'd guess it will be
able to run at up to 500 Hz of sampling frequency.
Jan
--
Jan Houska HUMUSOFT s.r.o.
houska@humusoft.com Pobrezni 20
http://www.humusoft.com 186 00 Praha 8
tel: ++ 420 284 011 730 Czech Republic
fax: ++ 420 284 011 740
|
|
0
|
|
|
|
Reply
|
Jan
|
4/18/2010 2:00:21 PM
|
|
Hi Jan,
Could you please tell me which versions of Matlab, Simulink and RTWT you are using to achieve 500 Hz? I am having difficulty even getting 100 Hz sampling rate with r2007b and r2008a.
Thanks,
Dan
Jan Houska <houska@humusoft.com> wrote in message <hqe58u$1vsk$1@ns.felk.cvut.cz>...
> Hi,
>
> dan schott wrote:
> > "Uzumaki " <narutofan01234@yahoo.com> wrote in message
> > <hq9hk5$hun$1@fred.mathworks.com>...
> >> > > 1. Yes, RTWT can handle 115200 baud.
> >> > 2. Approximately, 1/100 = 0.01 s (r2007b, r2008a, r2008b)
> >> > 3. Because USB is not real-time by design.
> >> > 4. Follow the link
> >> http://www.mathworks.com/matlabcentral/linkexchange/links/2041-real-time-control-platform-for-matlab-and-simulink-dc-motor-control
> >> and also visit the website mentioned in the video
> >> http://zeltom.com/hilink.aspx.
> >>
> >> Hi Dan, thank you for your answer.
> >>
> >> According to your answer, 100 Hz seems to be the fastest frequency
> >> RTWT can handle (with RS232 communication). But basing on the
> >> information from Zeltom, their product can run at frequency 3.8 kHz
> >> (the product also communicates with PC via RS232 communication)?
> >>
> >> This information contradicts your answer, doesnt it?
> >>
> >> Uzumaki
> >
> > Uzumaki,
> >
> > No, it does not. The number I gave you is for RTWT. Their software
> > allows such a high rate. They even have a different version that can
> > achieve 1/15.2e3 = 65.7895e-6 s.
>
> Actually, the maximum sampling frequency for RS232 in Real-Time Windows
> Target is currently 500 Hz, not 100 Hz. Some improvement is planned for
> the next version, but not all kinds of RS232 hardware will be able to
> run at those higher speeds.
>
> Jan
>
>
> --
> Jan Houska HUMUSOFT s.r.o.
> houska@humusoft.com Pobrezni 20
> http://www.humusoft.com 186 00 Praha 8
> tel: ++ 420 284 011 730 Czech Republic
> fax: ++ 420 284 011 740
|
|
0
|
|
|
|
Reply
|
dan
|
4/19/2010 8:19:04 PM
|
|
"dan schott" <dan1987@hotmail.com> wrote in message <hqidro$pbt$1@fred.mathworks.com>...
> Hi Jan,
>
> Could you please tell me which versions of Matlab, Simulink and RTWT you are using to achieve 500 Hz? I am having difficulty even getting 100 Hz sampling rate with r2007b and r2008a.
>
> Thanks,
>
> Dan
@Jan: Thank you for your answer.
@Dan: I think it also depends on your CPU and your Simulink model. For example, if your CPU is slow and your model is heavy then it will be hard to achieve such a fast sample rate.
Uzumaki
|
|
0
|
|
|
|
Reply
|
Uzumaki
|
4/21/2010 2:18:04 AM
|
|
Hi Dan,
I was using R2010a. But, after you asked, I went back and tried R2007b
and there was no difference. I was able to achieve 500 Hz as well. I was
able to send up to cca 20 bytes on 115200 baud, using Packet Output
block. I was monitoring the output on the oscilloscope and with 20
bytes, there was still a small regular gap between the end of one packet
and the start of another one, with the frequency of 500 Hz. Of course,
when sending just one byte, the individual packets were separated in a
much more visible way.
The maximum sample rate you are able achieve depends on the amount of
data and RS232 baud rate, but you are probably aware of that. Also, it
may depend on your serial port - mine is a "native" RS232 port on the
motherboard, no add-on or even USB-connected device. And, of course, it
depends on your Simulink model which must be able to provide the data in
time. Mine was very simple, just a constant feeding the Packet Output block.
If you think you should be getting higher sampling rate, you can send me
your model (preferrably some minimalistic version) and I can give it a try.
Best Regards, Jan
dan schott wrote:
> Could you please tell me which versions of Matlab, Simulink and RTWT you
> are using to achieve 500 Hz? I am having difficulty even getting 100 Hz
> sampling rate with r2007b and r2008a.
>
> Thanks,
>
> Dan
>
>
>
> Jan Houska <houska@humusoft.com> wrote in message
> <hqe58u$1vsk$1@ns.felk.cvut.cz>...
>> Hi,
>>
>> dan schott wrote:
>> > "Uzumaki " <narutofan01234@yahoo.com> wrote in message >
>> <hq9hk5$hun$1@fred.mathworks.com>...
>> >> > > 1. Yes, RTWT can handle 115200 baud.
>> >> > 2. Approximately, 1/100 = 0.01 s (r2007b, r2008a, r2008b)
>> >> > 3. Because USB is not real-time by design.
>> >> > 4. Follow the link >>
>> http://www.mathworks.com/matlabcentral/linkexchange/links/2041-real-time-control-platform-for-matlab-and-simulink-dc-motor-control
>> >> and also visit the website mentioned in the video >>
>> http://zeltom.com/hilink.aspx.
>> >>
>> >> Hi Dan, thank you for your answer.
>> >>
>> >> According to your answer, 100 Hz seems to be the fastest frequency
>> >> RTWT can handle (with RS232 communication). But basing on the >>
>> information from Zeltom, their product can run at frequency 3.8 kHz >>
>> (the product also communicates with PC via RS232 communication)?
>> >>
>> >> This information contradicts your answer, doesnt it?
>> >>
>> >> Uzumaki
>> > > Uzumaki,
>> > > No, it does not. The number I gave you is for RTWT. Their software
>> > allows such a high rate. They even have a different version that can
>> > achieve 1/15.2e3 = 65.7895e-6 s.
>>
>> Actually, the maximum sampling frequency for RS232 in Real-Time
>> Windows Target is currently 500 Hz, not 100 Hz. Some improvement is
>> planned for the next version, but not all kinds of RS232 hardware will
>> be able to run at those higher speeds.
>>
>> Jan
>>
>>
>> --
>> Jan Houska HUMUSOFT s.r.o.
>> houska@humusoft.com Pobrezni 20
>> http://www.humusoft.com 186 00 Praha 8
>> tel: ++ 420 284 011 730 Czech Republic
>> fax: ++ 420 284 011 740
--
--
Jan Houska HUMUSOFT s.r.o.
houska@humusoft.com Pobrezni 20
http://www.humusoft.com 186 00 Praha 8
tel: ++ 420 284 011 730 Czech Republic
fax: ++ 420 284 011 740
|
|
0
|
|
|
|
Reply
|
Jan
|
4/21/2010 9:57:38 AM
|
|
Thanks Uzumaki,
I have a quite decent computer and my model is very simple (for test purpose). I do not think my model is loading my PC.
Thanks,
Dan
"Uzumaki " <narutofan01234@yahoo.com> wrote in message <hqln8s$9uq$1@fred.mathworks.com>...
> "dan schott" <dan1987@hotmail.com> wrote in message <hqidro$pbt$1@fred.mathworks.com>...
> > Hi Jan,
> >
> > Could you please tell me which versions of Matlab, Simulink and RTWT you are using to achieve 500 Hz? I am having difficulty even getting 100 Hz sampling rate with r2007b and r2008a.
> >
> > Thanks,
> >
> > Dan
>
> @Jan: Thank you for your answer.
>
> @Dan: I think it also depends on your CPU and your Simulink model. For example, if your CPU is slow and your model is heavy then it will be hard to achieve such a fast sample rate.
>
> Uzumaki
|
|
0
|
|
|
|
Reply
|
dan
|
4/21/2010 5:15:21 PM
|
|
Thanks Jan,
My model is also very simple (a packet input and a packet output sending and receiving a uint8 plus two scopes and two gains to monitor the input and output). My RS232 port is also a 'native' one at COM1 (03F8). I connected TXD and RXD together and observed the data at TXD by an oscilloscope. When the sample rate is greater than 100 Hz, the time between two transmitted bytes is 10 ms. Thus, the maximum sample rate I can get is 1 / 10e-3 = 100 Hz.
I will email you my model. I would greatly appreciate if you look at it and tell me what I am doing wrong.
Thanks,
Dan
Jan Houska <houska@humusoft.com> wrote in message <4BCECC12.7000507@humusoft.com>...
> Hi Dan,
>
> I was using R2010a. But, after you asked, I went back and tried R2007b
> and there was no difference. I was able to achieve 500 Hz as well. I was
> able to send up to cca 20 bytes on 115200 baud, using Packet Output
> block. I was monitoring the output on the oscilloscope and with 20
> bytes, there was still a small regular gap between the end of one packet
> and the start of another one, with the frequency of 500 Hz. Of course,
> when sending just one byte, the individual packets were separated in a
> much more visible way.
>
> The maximum sample rate you are able achieve depends on the amount of
> data and RS232 baud rate, but you are probably aware of that. Also, it
> may depend on your serial port - mine is a "native" RS232 port on the
> motherboard, no add-on or even USB-connected device. And, of course, it
> depends on your Simulink model which must be able to provide the data in
> time. Mine was very simple, just a constant feeding the Packet Output block.
>
> If you think you should be getting higher sampling rate, you can send me
> your model (preferrably some minimalistic version) and I can give it a try.
>
> Best Regards, Jan
>
>
> dan schott wrote:
> > Could you please tell me which versions of Matlab, Simulink and RTWT you
> > are using to achieve 500 Hz? I am having difficulty even getting 100 Hz
> > sampling rate with r2007b and r2008a.
> >
> > Thanks,
> >
> > Dan
> >
> >
> >
> > Jan Houska <houska@humusoft.com> wrote in message
> > <hqe58u$1vsk$1@ns.felk.cvut.cz>...
> >> Hi,
> >>
> >> dan schott wrote:
> >> > "Uzumaki " <narutofan01234@yahoo.com> wrote in message >
> >> <hq9hk5$hun$1@fred.mathworks.com>...
> >> >> > > 1. Yes, RTWT can handle 115200 baud.
> >> >> > 2. Approximately, 1/100 = 0.01 s (r2007b, r2008a, r2008b)
> >> >> > 3. Because USB is not real-time by design.
> >> >> > 4. Follow the link >>
> >> http://www.mathworks.com/matlabcentral/linkexchange/links/2041-real-time-control-platform-for-matlab-and-simulink-dc-motor-control
> >> >> and also visit the website mentioned in the video >>
> >> http://zeltom.com/hilink.aspx.
> >> >>
> >> >> Hi Dan, thank you for your answer.
> >> >>
> >> >> According to your answer, 100 Hz seems to be the fastest frequency
> >> >> RTWT can handle (with RS232 communication). But basing on the >>
> >> information from Zeltom, their product can run at frequency 3.8 kHz >>
> >> (the product also communicates with PC via RS232 communication)?
> >> >>
> >> >> This information contradicts your answer, doesnt it?
> >> >>
> >> >> Uzumaki
> >> > > Uzumaki,
> >> > > No, it does not. The number I gave you is for RTWT. Their software
> >> > allows such a high rate. They even have a different version that can
> >> > achieve 1/15.2e3 = 65.7895e-6 s.
> >>
> >> Actually, the maximum sampling frequency for RS232 in Real-Time
> >> Windows Target is currently 500 Hz, not 100 Hz. Some improvement is
> >> planned for the next version, but not all kinds of RS232 hardware will
> >> be able to run at those higher speeds.
> >>
> >> Jan
> >>
> >>
> >> --
> >> Jan Houska HUMUSOFT s.r.o.
> >> houska@humusoft.com Pobrezni 20
> >> http://www.humusoft.com 186 00 Praha 8
> >> tel: ++ 420 284 011 730 Czech Republic
> >> fax: ++ 420 284 011 740
>
>
> --
>
> --
> Jan Houska HUMUSOFT s.r.o.
> houska@humusoft.com Pobrezni 20
> http://www.humusoft.com 186 00 Praha 8
> tel: ++ 420 284 011 730 Czech Republic
> fax: ++ 420 284 011 740
|
|
0
|
|
|
|
Reply
|
dan
|
4/21/2010 5:45:05 PM
|
|
|
12 Replies
567 Views
(page loaded in 0.187 seconds)
|