Thread Subject: A timeout occured before the terminator was reached

Subject: A timeout occured before the terminator was reached

From: Roniyus Marjunus

Date: 23 May, 2011 06:55:04

Message: 1 of 14

Dear All,

I would like to tell you about my problem with Matlab, hopefuly someone here could help me. I want to controll my device from Matlab via RS232 port serial. I want to send a command to that device and I also want to receive the response from that device. But I have found some facts, i.e:

-If I use Matlab 2007a, Matlab can send the command to that device and can
receive the response from it.

-But if I use Matlab 2010a, Matlab can send the command to that device but can't receive it, is it strange, right? I got the message from
Matlab, "A timeout occured before the terminator ws reached". Actually, I prefer to use Matlab 2010a but there is a problem like that.

I also have read from the Matlab Forum like this, there are some people also had had a
problem like that. Some other people tried to give a solution. I also have applied
the solution but it still doesn't work.

Finally, I found there is a different property value when the device is connected
to the Matlab 2007a and Matlab 2010a, I found it using function
get(serialport), i.e.

-When I connect the device with Matlab 2007a, I found the value of "Send to
request" property is "ON", but

-When I connect the device with Matlab 2010a, I found the value of "Send to
request" property is "OFF". So I thought this was the problem.

Then I changed the property value from "OFF" to "ON" using function "set"
only for that property when I use Matlab 2010a for that device. But
unfortunattely, I still doesn't work.

This is my code which I use in Matlab 2007a or Matlab 2010a:

global RS;
RS = serial('COM1','Baudrate',9600,'Parity','none','DataBits',8,'StopBits',1,'Terminator','CR');
fopen(RS);

RSCOMMAND = ['A.',num2str(CH),'.D']; %This is the special command for the device
                                                        %CH is the number of channel on the device
fprintf(RS,RSCOMMAND);
IFlow = fscanf(RS);

Thank you very much for your attention and your help.


Best regards,


Roniyus

Subject: A timeout occured before the terminator was reached

From: Ankit Desai

Date: 23 May, 2011 18:05:24

Message: 2 of 14

"Roniyus Marjunus" wrote in message <ird0c8$33d$1@newscl01ah.mathworks.com>...
> Dear All,
>
> I would like to tell you about my problem with Matlab, hopefuly someone here could help me. I want to controll my device from Matlab via RS232 port serial. I want to send a command to that device and I also want to receive the response from that device. But I have found some facts, i.e:
>
> -If I use Matlab 2007a, Matlab can send the command to that device and can
> receive the response from it.
>
> -But if I use Matlab 2010a, Matlab can send the command to that device but can't receive it, is it strange, right? I got the message from
> Matlab, "A timeout occured before the terminator ws reached". Actually, I prefer to use Matlab 2010a but there is a problem like that.
>
> I also have read from the Matlab Forum like this, there are some people also had had a
> problem like that. Some other people tried to give a solution. I also have applied
> the solution but it still doesn't work.
>
> Finally, I found there is a different property value when the device is connected
> to the Matlab 2007a and Matlab 2010a, I found it using function
> get(serialport), i.e.
>
> -When I connect the device with Matlab 2007a, I found the value of "Send to
> request" property is "ON", but
>
> -When I connect the device with Matlab 2010a, I found the value of "Send to
> request" property is "OFF". So I thought this was the problem.
>
> Then I changed the property value from "OFF" to "ON" using function "set"
> only for that property when I use Matlab 2010a for that device. But
> unfortunattely, I still doesn't work.
>
> This is my code which I use in Matlab 2007a or Matlab 2010a:
>
> global RS;
> RS = serial('COM1','Baudrate',9600,'Parity','none','DataBits',8,'StopBits',1,'Terminator','CR');
> fopen(RS);
>
> RSCOMMAND = ['A.',num2str(CH),'.D']; %This is the special command for the device
> %CH is the number of channel on the device
> fprintf(RS,RSCOMMAND);
> IFlow = fscanf(RS);
>
> Thank you very much for your attention and your help.
>
>
> Best regards,
>
>
> Roniyus

Hi,

There was a bug in R2007a (that was later fixed) that showed the status of the "Request To Send (RTS)" pin incorrectly. In order for the object property to synchronize with what the actual line status is, one needed to turn the property off and on. For example:

s = serial('COM1');
fopen(s);
get(s, 'RequestToSend') % reports on but line is off
set(s, 'RequestToSend', 'on') % line stays off
set(s, 'RequestToSend', 'off') % line is still off
set(s, 'RequestToSend', 'on') % line is now on

However, this bug is fixed in R2010a. The property now correctly indicates that state of the pin. You might want to explicitly change the pin status to the required state in R2010a.

Hope this helps.

-Ankit

Subject: A timeout occured before the terminator was reached

From: Roniyus Marjunus

Date: 23 May, 2011 20:30:25

Message: 3 of 14

Dear Ankit,

Thank you for your response but I would to revise my posting before. I have checked again, finally I found that there is no different value for every property of serial port which I use in Matlab 2007a or Matlab 2010a, include the value of "Send to Request", its value are still same, i.e. "OFF".

So, it is very strange because there are no different for all values of the properties of serial port in Matlab 2007a and Matlab 2010a but I only can get the response from the gas controller when I use Matlab 2007a not in Matlab 2010a.

Please help me.

Best regards,

Roniyus Marjunus

Subject: A timeout occured before the terminator was reached

From: Ankit Desai

Date: 24 May, 2011 00:35:05

Message: 4 of 14

"Roniyus Marjunus" wrote in message <ireg51$pdb$1@newscl01ah.mathworks.com>...
> Dear Ankit,
>
> Thank you for your response but I would to revise my posting before. I have checked again, finally I found that there is no different value for every property of serial port which I use in Matlab 2007a or Matlab 2010a, include the value of "Send to Request", its value are still same, i.e. "OFF".
>
> So, it is very strange because there are no different for all values of the properties of serial port in Matlab 2007a and Matlab 2010a but I only can get the response from the gas controller when I use Matlab 2007a not in Matlab 2010a.
>
> Please help me.
>
> Best regards,
>
> Roniyus Marjunus

What happens when you turn the Request to Send property to "ON"?
Does it work then?

Subject: A timeout occured before the terminator was reached

From: Roniyus Marjunus

Date: 24 May, 2011 06:42:03

Message: 5 of 14

Dear Ankit,

There was nothing happen, it still doesn't work. Mmmm... what should I do?
Please help me...

Subject: A timeout occured before the terminator was reached

From: Roniyus Marjunus

Date: 24 May, 2011 11:13:04

Message: 6 of 14

I would like to give you an additional information about my problem. When I use Matlab 2010a to get a response from my gas controller, I got the BytesAvailable and ValuesReceived are always zero, but when I use Matlab 2007a to get a response from my gas controller, I got the BytesAvailable and ValuesReceived are not zero.

That is the additional information from me. Hopefuly you can help me.

Sincerely yours,


Roniyus Marjunus

Subject: A timeout occured before the terminator was reached

From: Ankit Desai

Date: 25 May, 2011 01:57:04

Message: 7 of 14

"Roniyus Marjunus" wrote in message <irg3s0$175$1@newscl01ah.mathworks.com>...
> I would like to give you an additional information about my problem. When I use Matlab 2010a to get a response from my gas controller, I got the BytesAvailable and ValuesReceived are always zero, but when I use Matlab 2007a to get a response from my gas controller, I got the BytesAvailable and ValuesReceived are not zero.
>
> That is the additional information from me. Hopefuly you can help me.
>
> Sincerely yours,
>
>
> Roniyus Marjunus

That's interesting.
It appears that there is no communication between your device and your computer.
No BytesAvailable means no data is sent by the device.

I was going to suggest to check the various serial port settings (baudrate, terminator, parity etc.) and verify that device settings match that of the serial object. But then, if the same code works on R2007a with the same serial port settings, it means that configuration is fine.

At this stage it might be best for you to contact the technical support at MathWorks.

All the best.
-Ankit

Subject: A timeout occured before the terminator was reached

From: Emily

Date: 20 Jul, 2011 19:30:10

Message: 8 of 14

Was this every solved? I'm having the same problem.


"Ankit Desai" <adesai.remove.this@mathworks.com> wrote in message <irhnlg$2bm$1@newscl01ah.mathworks.com>...
> "Roniyus Marjunus" wrote in message <irg3s0$175$1@newscl01ah.mathworks.com>...
> > I would like to give you an additional information about my problem. When I use Matlab 2010a to get a response from my gas controller, I got the BytesAvailable and ValuesReceived are always zero, but when I use Matlab 2007a to get a response from my gas controller, I got the BytesAvailable and ValuesReceived are not zero.
> >
> > That is the additional information from me. Hopefuly you can help me.
> >
> > Sincerely yours,
> >
> >
> > Roniyus Marjunus
>
> That's interesting.
> It appears that there is no communication between your device and your computer.
> No BytesAvailable means no data is sent by the device.
>
> I was going to suggest to check the various serial port settings (baudrate, terminator, parity etc.) and verify that device settings match that of the serial object. But then, if the same code works on R2007a with the same serial port settings, it means that configuration is fine.
>
> At this stage it might be best for you to contact the technical support at MathWorks.
>
> All the best.
> -Ankit

Subject: A timeout occured before the terminator was reached

From: Emily

Date: 20 Jul, 2011 19:32:07

Message: 9 of 14

Was this ever solved? I'm having the same problem.

Subject: A timeout occured before the terminator was reached

From: Ankit Desai

Date: 21 Jul, 2011 21:01:13

Message: 10 of 14

"Emily" wrote in message <j07afn$pi0$1@newscl01ah.mathworks.com>...
> Was this ever solved? I'm having the same problem.

Following the documentation listed here might help.
http://www.mathworks.com/help/techdoc/matlab_external/f95464.html

If that does not work, contacting the technical support is the best bet.

-Ankit

Subject: A timeout occured before the terminator was reached

From: Emily

Date: 22 Jul, 2011 12:42:08

Message: 11 of 14

Thank you for your reply.

I have been performing successful com communication with my devices (SRS - Stanford Research Solutions DAQ boxes) on MatLab 2010a on an XP computer, so I believe my baud, parity, terminators, etc are correct.

We updated an identical computer tower to the functional XP box with Windows 7 and the updated machine can't talk to the same devices. For full disclosure, this appears to be happening at the Windows 7 level because when I use serial communication software other than MatLab, I still can't see the SRS boxes on the 7 machine.

I was just hopeful that a MatLab person had solved this puzzle.

Thank you,

Emily



"Ankit Desai" <adesai.remove.this@mathworks.com> wrote in message <j0a42o$s9e$1@newscl01ah.mathworks.com>...
> "Emily" wrote in message <j07afn$pi0$1@newscl01ah.mathworks.com>...
> > Was this ever solved? I'm having the same problem.
>
> Following the documentation listed here might help.
> http://www.mathworks.com/help/techdoc/matlab_external/f95464.html
>
> If that does not work, contacting the technical support is the best bet.
>
> -Ankit

Subject: A timeout occured before the terminator was reached

From: Emily

Date: 22 Jul, 2011 16:03:10

Message: 12 of 14

My apologies, two bum cables were to blame.

"Emily" wrote in message <j0br70$ebe$1@newscl01ah.mathworks.com>...
> Thank you for your reply.
>
> I have been performing successful com communication with my devices (SRS - Stanford Research Solutions DAQ boxes) on MatLab 2010a on an XP computer, so I believe my baud, parity, terminators, etc are correct.
>
> We updated an identical computer tower to the functional XP box with Windows 7 and the updated machine can't talk to the same devices. For full disclosure, this appears to be happening at the Windows 7 level because when I use serial communication software other than MatLab, I still can't see the SRS boxes on the 7 machine.
>
> I was just hopeful that a MatLab person had solved this puzzle.
>
> Thank you,
>
> Emily
>
>
>
> "Ankit Desai" <adesai.remove.this@mathworks.com> wrote in message <j0a42o$s9e$1@newscl01ah.mathworks.com>...
> > "Emily" wrote in message <j07afn$pi0$1@newscl01ah.mathworks.com>...
> > > Was this ever solved? I'm having the same problem.
> >
> > Following the documentation listed here might help.
> > http://www.mathworks.com/help/techdoc/matlab_external/f95464.html
> >
> > If that does not work, contacting the technical support is the best bet.
> >
> > -Ankit

Subject: A timeout occured before the terminator was reached

From: Ankit Desai

Date: 22 Jul, 2011 16:47:08

Message: 13 of 14

"Emily" wrote in message <j0c6vu$lh4$1@newscl01ah.mathworks.com>...
> My apologies, two bum cables were to blame.
>
> "Emily" wrote in message <j0br70$ebe$1@newscl01ah.mathworks.com>...
> > Thank you for your reply.
> >
> > I have been performing successful com communication with my devices (SRS - Stanford Research Solutions DAQ boxes) on MatLab 2010a on an XP computer, so I believe my baud, parity, terminators, etc are correct.
> >
> > We updated an identical computer tower to the functional XP box with Windows 7 and the updated machine can't talk to the same devices. For full disclosure, this appears to be happening at the Windows 7 level because when I use serial communication software other than MatLab, I still can't see the SRS boxes on the 7 machine.
> >
> > I was just hopeful that a MatLab person had solved this puzzle.
> >
> > Thank you,
> >
> > Emily
> >
> >
> >
> > "Ankit Desai" <adesai.remove.this@mathworks.com> wrote in message <j0a42o$s9e$1@newscl01ah.mathworks.com>...
> > > "Emily" wrote in message <j07afn$pi0$1@newscl01ah.mathworks.com>...
> > > > Was this ever solved? I'm having the same problem.
> > >
> > > Following the documentation listed here might help.
> > > http://www.mathworks.com/help/techdoc/matlab_external/f95464.html
> > >
> > > If that does not work, contacting the technical support is the best bet.
> > >
> > > -Ankit


Thanks for posting the update here.

Regards,
-Ankit

Subject: A timeout occured before the terminator was reached

From: samir

Date: 8 Apr, 2012 18:55:13

Message: 14 of 14

well i'm having the same problem. "A timeout occured before the terminator was reached"
i managed to avoid it by using pause(2) but the thing now is that my program runs slow.Every time i have to recieve data i have to use this pause(2) command.If i use a value below 2 the error still shows up sometimes.

s=serial('com5');
set(s,'BaudRate',9600,'DataBits', 8, 'Parity', 'none','StopBits', 1, 'FlowControl', 'none','Terminator','CR','Timeout',10);
fopen(s);
while(1)
pause(2);
fprintf(s,'0');
    data=fscanf(s);
    data=str2num(data);
    if(data<=10)
       display(data)
    end
end
fclose(s);

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
rts Ankit Desai 23 May, 2011 14:09:07
serial Ankit Desai 23 May, 2011 14:09:06
rssFeed for this Thread

Contact us at files@mathworks.com