Path: news.mathworks.com!not-for-mail
From: "Marco Balsi" <balsi@uniroma1.it>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Failure to read serial port after ~5000 asynch reads
Date: Wed, 15 Apr 2009 09:16:01 +0000 (UTC)
Organization: La Sapienza University
Lines: 22
Message-ID: <gs48kh$2l0$1@fred.mathworks.com>
References: <gbub92$9sr$1@fred.mathworks.com> <gc0tco$6v3$1@fred.mathworks.com> <gc1479$or1$1@fred.mathworks.com> <gc3a48$bjs$1@fred.mathworks.com> <gc5lra$2en$1@fred.mathworks.com> <gh4fri$6vm$1@fred.mathworks.com> <goh4ll$fi3$1@fred.mathworks.com>
Reply-To: "Marco Balsi" <balsi@uniroma1.it>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1239786961 2720 172.30.248.37 (15 Apr 2009 09:16:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 15 Apr 2009 09:16:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1802521
Xref: news.mathworks.com comp.soft-sys.matlab:532835


I also have this problem. In my case I am receiving small packets (15bytes) from a TI microcontroller (MPS430) card interfacing a ZigBee CC2480 trasmitter/receiver. It is connected to a COM port through the USB connector. Reading is done in a for loop. Everything works OK down to a repetition period of 250ms. At that frequency it goes on receiving correctly forever. At higher frequency (lower period) the problem appears in the same way as reported in this thread. This sensitivity to frequency makes me think of some kind of buffer saturation...
By the way, I also tried the same communication through hyperterminal, and in that case it does work correctly down to 100ms, so apparently it is not a problem with something external to Matlab (at least up to some point).
Marco

"Geoff " <reynolds-dot-gw-dot-2@pg.com> wrote in message <goh4ll$fi3$1@fred.mathworks.com>...
> Dave (and Scott) -- I'm suffering a similar behavior where Matlab 2008a fails to read several serial ports after 5000 to 7000 reads of the serial port.  As you've reported, the only way to get the ports to start reading again is exit Matlab.  
> 
> In my case I'm using a timer object, but I've experienced the same problems putting the read/write commands to the serial port in a for loop as well. 
> 
> If you've found any work arounds or found certain tricks with your own code, I'd be appreciative of any insights.
> 
> Thanks,
> 
> Geoff
> 
> "David Atkinson" <djatkinson54@yahoo.co.uk> wrote in message <gh4fri$6vm$1@fred.mathworks.com>...
> > Scott,
> > 
> > I have experienced the same serial port problem. I have a DSP board taking to the PC using Matlab serial port. My m-file contains a repeating while loop which includes a pause(0.1) to set repetition rate. After starting it appears to run perfectly for a few thousand loops then fails. The number of loops before failure is variable. As you found, the only way to fix is to restart Matlab.  I was originally using R2007b but found it does exactly the same with R2008b.  One observation in my case was that if I only transmit data from PC to the  DSP board then it doesn't fail. So the problem appears to be associated with data coming into Matlab.
> > 
> > Dave
> >