Go to Post FIRST is kind of like charity work... you are, even if only in some small way, helping our future just a little bit, and you get a great feeling from it. Even if you are just ringing a bell (or clapping MOE sticks together), you're helping. - Amanda Morrison [more]
Home
Go Back   Chief Delphi > Technical > National Instruments LabVIEW and Data Acquisition > LabView and Data Acquisition
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #16   Spotlight this post!  
Unread 27-01-2006, 13:48
Peter H Peter H is offline
Registered User
FRC #1606 (Dragons)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Oyster Bay NY
Posts: 21
Peter H is an unknown quantity at this point
Re: Labview keeps freezing

Quote:
Originally Posted by Mark McLeod
For us, the 1/25 version eliminated the run-away progress bar behavior that version 1/17 exhibited.

Peter H came over to play last night and we were able to grab frames repeatedly from his camera, but with my laptop.
Today, I erased the LabView GUI and reloaded it with the 1/25/06 CMUCam2 demo. Now, and also last night, I have completely different intermittent failures.

Sometimes, I can Grab Frame OK. The rest of the time, I Grab Frame, the red LED flashes, the blue progress bar advances to the end, the progress bar disappears, a partial frame shows, and an error box appears "The application is closing because of a reported error ...". The status code is -1073807252. The status source is "VISA Read in get picture.vi>CMUcam2.vi>CMUcam2GUI.vi" I had to expand the status box to read this.

I can click on the error box, it disappears, and the run icon reverts to not running. I can click on the run icon again, and repeat the process - sometimes it works, sometimes not.

What is my problem?
Reply With Quote
  #17   Spotlight this post!  
Unread 27-01-2006, 14:22
Joe Hershberger Joe Hershberger is offline
National Instruments
AKA: jhersh
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 1997
Location: Austin, TX
Posts: 148
Joe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to all
Re: Labview keeps freezing

Quote:
Originally Posted by Peter H
Today, I erased the LabView GUI and reloaded it with the 1/25/06 CMUCam2 demo. Now, and also last night, I have completely different intermittent failures.

Sometimes, I can Grab Frame OK. The rest of the time, I Grab Frame, the red LED flashes, the blue progress bar advances to the end, the progress bar disappears, a partial frame shows, and an error box appears "The application is closing because of a reported error ...". The status code is -1073807252. The status source is "VISA Read in get picture.vi>CMUcam2.vi>CMUcam2GUI.vi" I had to expand the status box to read this.

I can click on the error box, it disappears, and the run icon reverts to not running. I can click on the run icon again, and repeat the process - sometimes it works, sometimes not.

What is my problem?
That error means that you are overflowing the VISA serial buffer. That is why you get a partial frame before it fails. Are you using a slow computer? What kind of serial port? Are there any settings in the device manager's properties for your serial port that will allow you to increase the buffer that is used on the serial port?

I'll look at the code to see if there is anything that can be done to make the program less susceptible to the problem. One solution is to lower the Baud rate (which would need to be done both on the camera and in the application / MAX) but would make the frame grabbing even slower. Hopefully we can avoid having to do that.

Cheers!
-Joe
Reply With Quote
  #18   Spotlight this post!  
Unread 27-01-2006, 14:58
Joe Hershberger Joe Hershberger is offline
National Instruments
AKA: jhersh
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 1997
Location: Austin, TX
Posts: 148
Joe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to all
Re: Labview keeps freezing

Quote:
Originally Posted by Peter H
Sometimes, I can Grab Frame OK. The rest of the time, I Grab Frame, the red LED flashes, the blue progress bar advances to the end, the progress bar disappears, a partial frame shows, and an error box appears "The application is closing because of a reported error ...". The status code is -1073807252. The status source is "VISA Read in get picture.vi>CMUcam2.vi>CMUcam2GUI.vi" I had to expand the status box to read this.
I am testing this with a USB to serial converter. The converter sends between 3000 and 4000 bytes at a time. The code handles this just fine. The error refers to a buffer overflow from your serial hardware moving the data into VISA. The data comes faster than the VISA driver can pull it out of your serial device. This means that either your computer is too slow or overworked (interrupt flooded... do you have a hard disk or CD Rom that is running in PIO mode) such that it can't access the serial port frequently /quickly enough. This is often resolved on slow machines by the hardware supporting a small amount of buffering to allow for more jitter in the driver trying to retrieve the data. If you are using a USB to Serial adapter, there's a good chance it isn't implementing a good buffering scheme or that it isn't configured well (if it's configurable). The solution may be to get a better converter. I have a USB 2.0 adapter from FTDI. It works very well.

What are you using?

-Joe
Reply With Quote
  #19   Spotlight this post!  
Unread 27-01-2006, 15:09
Peter H Peter H is offline
Registered User
FRC #1606 (Dragons)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Oyster Bay NY
Posts: 21
Peter H is an unknown quantity at this point
Re: Labview keeps freezing

Quote:
Originally Posted by Joe Hershberger
That error means that you are overflowing the VISA serial buffer. That is why you get a partial frame before it fails. Are you using a slow computer? What kind of serial port? Are there any settings in the device manager's properties for your serial port that will allow you to increase the buffer that is used on the serial port?

I'll look at the code to see if there is anything that can be done to make the program less susceptible to the problem. One solution is to lower the Baud rate (which would need to be done both on the camera and in the application / MAX) but would make the frame grabbing even slower. Hopefully we can avoid having to do that.

Cheers!
-Joe
My laptop uses an Intel Premium M730, at 1.6 GHz, and 512 MB memory. I don't find any option in WinXP2 to increase the buffer size. The RS-232 serial port is built in to the mother board. No other app is running while LabView is running.

If this is a buffer size problem, why does it work more often than not? When I get a partial frame, it is anywhere from 10% to 90% of the full frame.
Reply With Quote
  #20   Spotlight this post!  
Unread 27-01-2006, 16:13
Joe Hershberger Joe Hershberger is offline
National Instruments
AKA: jhersh
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 1997
Location: Austin, TX
Posts: 148
Joe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to all
Re: Labview keeps freezing

Quote:
Originally Posted by Peter H
My laptop uses an Intel Premium M730, at 1.6 GHz, and 512 MB memory. I don't find any option in WinXP2 to increase the buffer size. The RS-232 serial port is built in to the mother board. No other app is running while LabView is running.

If this is a buffer size problem, why does it work more often than not? When I get a partial frame, it is anywhere from 10% to 90% of the full frame.
Your setup seems reasonable. I have a serial port that plugs into the PCMCIA port that looks just like a standard ISA UART. In the properties of the port in Device manager is has the option to turn on buffering (it allows 14 bytes for transmit and 15 bytes for receive)... I would expect that to be available to you as well, but it depends on which UART chip they used on your motherboard. The older models of UARTS have no buffering at all... the driver must read every byte that comes in before the next one comes. This can be difficult to achieve and very inefficient, which is why newer UARTs have buffering. or operating systems like Windows that are not real-time, it is difficult to service every byte with low latency (before the next byte). It is much easier for something like the PIC in the RC.

If it works more often than not, then VISA is barely not able to keep up with the serial stream. This should only be an issue for receiving, so you shouldn't have problems with things like programming your RC. You may have problems if you try reading the memory at full speed. I will add an option in the code to allow you to make it work for your serial port and computer. It will slow down the rate at which the camera sends bytes to you and will eliminate the buffer overflows (as long as you set it high enough). You will want to start with 1 bit delay (the default is 0 which is causing your problems) and increase it until your problem goes away. Since it almost works now, I would expect that a value of 1 or 2 should be sufficient to make it work very well.

At least I'm confident that this should solve the problems you and others have been having. Thanks for helping to diagnose the problem so that everyone can enjoy the benefits of a working system! I'll post it when I finish the addition.

Cheers!
-Joe
Reply With Quote
  #21   Spotlight this post!  
Unread 27-01-2006, 17:11
Joe Hershberger Joe Hershberger is offline
National Instruments
AKA: jhersh
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 1997
Location: Austin, TX
Posts: 148
Joe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to all
Re: Labview keeps freezing

Peter,

I've posted the new version. Please let me know if it solves your problem.

Thanks,
-Joe
Reply With Quote
  #22   Spotlight this post!  
Unread 27-01-2006, 18:12
Peter H Peter H is offline
Registered User
FRC #1606 (Dragons)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Oyster Bay NY
Posts: 21
Peter H is an unknown quantity at this point
Re: Labview keeps freezing

Quote:
Originally Posted by Joe Hershberger
Peter,

I've posted the new version. Please let me know if it solves your problem.

Thanks,
-Joe
With the 1/27 version, LabView still sometimes show a partial frame, even with the serial port delay set to 4. I see little difference between a delay of 1 and 4. One difference now is that when LabView shows a partial frame, the red LED keeps blinking for the usual duration, the blue progress bar disappears, and no error is posted. LabView is still in run mode, and I can select Grab Frame again - which may or not show a full frame.

My earlier post was misleading. The serial port buffers are set to 14 and 15. I had thought you meant a software buffer. And many (~50?) WinXP processes are running in the background; most, I have no idea what they do. Maybe one of these sometimes prevents LabView from fetching the data?

I can operate LabView CMUcam2 GUI reliably on my desktop; Grab Frame works 20 times out of 20. But that is faster, with fewer background processes.
Reply With Quote
  #23   Spotlight this post!  
Unread 28-01-2006, 04:41
Joe Hershberger Joe Hershberger is offline
National Instruments
AKA: jhersh
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 1997
Location: Austin, TX
Posts: 148
Joe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to all
Re: Labview keeps freezing

Quote:
Originally Posted by Peter H
With the 1/27 version, LabView still sometimes show a partial frame, even with the serial port delay set to 4. I see little difference between a delay of 1 and 4. One difference now is that when LabView shows a partial frame, the red LED keeps blinking for the usual duration, the blue progress bar disappears, and no error is posted. LabView is still in run mode, and I can select Grab Frame again - which may or not show a full frame.
If you are not getting the VISA error when it aborts the frame grab, then the serial delay is not likely to help. So the LED continues to blink after the download bar disappears? That would indicate that it is quiting early. There are currently three reasons why the frame grab stops. If there is an error, if the expected time plus 50% passes, or enough bytes appear.If you look at the image, when only a partial frame is downloaded... does i look like there are lines missing in the middle, or does it look complete and error free up to the point that the image is truncated? If it's not an interrupt servicing issue, then it's most likely data corruption. Is your serial cable frayed or shorting out? Are you running lots of motors around it? Is your battery FULLY charged?

Quote:
Originally Posted by Peter H
My earlier post was misleading. The serial port buffers are set to 14 and 15. I had thought you meant a software buffer. And many (~50?) WinXP processes are running in the background; most, I have no idea what they do. Maybe one of these sometimes prevents LabView from fetching the data?
In that case I'm surprised you ever got that VISA error. Did you check for PIO mode?

Quote:
Originally Posted by Peter H
I can operate LabView CMUcam2 GUI reliably on my desktop; Grab Frame works 20 times out of 20. But that is faster, with fewer background processes.
I'm glad to hear it works somewhere! I thought maybe you wouldn't believe that it works here!


Let me know,
-Joe
Reply With Quote
  #24   Spotlight this post!  
Unread 28-01-2006, 11:50
Peter H Peter H is offline
Registered User
FRC #1606 (Dragons)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Oyster Bay NY
Posts: 21
Peter H is an unknown quantity at this point
Re: Labview keeps freezing

Quote:
Originally Posted by Joe Hershberger
If you are not getting the VISA error when it aborts the frame grab, then the serial delay is not likely to help. So the LED continues to blink after the download bar disappears? That would indicate that it is quiting early. There are currently three reasons why the frame grab stops. If there is an error, if the expected time plus 50% passes, or enough bytes appear.If you look at the image, when only a partial frame is downloaded... does i look like there are lines missing in the middle, or does it look complete and error free up to the point that the image is truncated? If it's not an interrupt servicing issue, then it's most likely data corruption. Is your serial cable frayed or shorting out? Are you running lots of motors around it? Is your battery FULLY charged?

In that case I'm surprised you ever got that VISA error. Did you check for PIO mode?

I'm glad to hear it works somewhere! I thought maybe you wouldn't believe that it works here!


Let me know,
-Joe
The partial image is complete, as far as it goes - no missing lines. I have used 2 serial cables, both look OK, both give the same result. No motors or robot controller - I run the camera stand-alone on my desk. Battery is fully charged, and voltage stays about 7.5 volts while running. COM1 / Resources shows IRQ 4; no PIO.

Micrsoft Antispyware used 9% of cpu every few seconds. Killed it, but no change. Other processes use 2-3% every few seconds.

LabView is now adequate for my purpose.
Reply With Quote
  #25   Spotlight this post!  
Unread 28-01-2006, 21:55
Joe Hershberger Joe Hershberger is offline
National Instruments
AKA: jhersh
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 1997
Location: Austin, TX
Posts: 148
Joe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to all
Re: Labview keeps freezing

Quote:
Originally Posted by Peter H
The partial image is complete, as far as it goes - no missing lines. I have used 2 serial cables, both look OK, both give the same result. No motors or robot controller - I run the camera stand-alone on my desk. Battery is fully charged, and voltage stays about 7.5 volts while running. COM1 / Resources shows IRQ 4; no PIO.

Micrsoft Antispyware used 9% of cpu every few seconds. Killed it, but no change. Other processes use 2-3% every few seconds.

LabView is now adequate for my purpose.
Just to be clear, does the red light continue to flash after the download bar disappears and the error message pops up?

Thanks,
-Joe
Reply With Quote
  #26   Spotlight this post!  
Unread 30-01-2006, 12:32
Peter H Peter H is offline
Registered User
FRC #1606 (Dragons)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Oyster Bay NY
Posts: 21
Peter H is an unknown quantity at this point
Re: Labview keeps freezing

Quote:
Originally Posted by Joe Hershberger
Just to be clear, does the red light continue to flash after the download bar disappears and the error message pops up?

Thanks,
-Joe
Usually yes. The download bar disappears and the frame stops updating at the same time, and the red LED continues to flash for a total of about 8 - 10 seconds. There is no error message other than the partial frame. I can select Grab Frame, and the download repeats for another try.

Sometimes, the previous behavior shows: the red LED stops when the frame update stops, the download bar repeats after several seconds, and no red LED. The Grab Frame button stays green, but, if I click it, it grays out. The download bar still repeats about every 25 seconds.
Reply With Quote
  #27   Spotlight this post!  
Unread 30-01-2006, 22:04
Joe Hershberger Joe Hershberger is offline
National Instruments
AKA: jhersh
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 1997
Location: Austin, TX
Posts: 148
Joe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to all
Re: Labview keeps freezing

Quote:
Originally Posted by Peter H
Usually yes. The download bar disappears and the frame stops updating at the same time, and the red LED continues to flash for a total of about 8 - 10 seconds. There is no error message other than the partial frame. I can select Grab Frame, and the download repeats for another try.

Sometimes, the previous behavior shows: the red LED stops when the frame update stops, the download bar repeats after several seconds, and no red LED. The Grab Frame button stays green, but, if I click it, it grays out. The download bar still repeats about every 25 seconds.
That is very interesting. From the behavior you describe, it sounds like the timeout for the frame grab is being computed incorrectly. The only inputs that the timeout is based upon is the Baud rate, the serial port delay, and the image dimensions that are returned from the camera. The first two shouldn't change unless you change them. It sounds as though the data coming from the camera may be getting corrupted.

Do you know how to probe lines in LabVIEW? It is a good way to debug LabVIEW code. I need you to open the "get picture.vi" inside of "CMUCam2 demo.llb" and switch to the block diagram (Ctrl-e), right click on the computed number of bytes and click probe. Then run the CMUCam Gui Application and let me know what the probe says for each of the cases you described above. I'm thinking that for whatever reason, you are having trouble with that, but lets see what you find from the probe.

Thanks,
-Joe
Reply With Quote
  #28   Spotlight this post!  
Unread 30-01-2006, 22:10
Joe Hershberger Joe Hershberger is offline
National Instruments
AKA: jhersh
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 1997
Location: Austin, TX
Posts: 148
Joe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to all
Re: Labview keeps freezing

Quote:
Originally Posted by Peter H
Usually yes. The download bar disappears and the frame stops updating at the same time, and the red LED continues to flash for a total of about 8 - 10 seconds. There is no error message other than the partial frame. I can select Grab Frame, and the download repeats for another try.

Sometimes, the previous behavior shows: the red LED stops when the frame update stops, the download bar repeats after several seconds, and no red LED. The Grab Frame button stays green, but, if I click it, it grays out. The download bar still repeats about every 25 seconds.
Here's a picture that shows you where to probe.

Thanks,
-Joe
Attached Thumbnails
Click image for larger version

Name:	get picture probe.JPG
Views:	37
Size:	95.7 KB
ID:	3923  
Reply With Quote
  #29   Spotlight this post!  
Unread 31-01-2006, 21:47
Peter H Peter H is offline
Registered User
FRC #1606 (Dragons)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Oyster Bay NY
Posts: 21
Peter H is an unknown quantity at this point
Re: Labview keeps freezing

Quote:
Originally Posted by Joe Hershberger
Here's a picture that shows you where to probe.

Thanks,
-Joe
There are 3 cases. I deleted the byte counter and then reselected it before each case, to ensure it started at 0.
1 Correct operation, the full frame appears: as soon as I select Grab Frame, the number of bytes shows 114242
2 Partial frame, red LED continues to blink: as soon as I select Grab Frame, the number of bytes shows 114242
3 Partial frame, progress bar advances spontaneously, no red LED blinking: the number of bytes does not change from 0.
I have not knowingly changed any LabView settings. I removed LAbView and reinstalled it a few days ago, but saw no change in operation. Since this GUI works OK with a desktop computer, I suspect some incompatibility between my laptop and the camera, that produces a hiccup in the data flow, and LabView can not tolerate the hiccup.
Reply With Quote
  #30   Spotlight this post!  
Unread 01-02-2006, 01:17
Joe Hershberger Joe Hershberger is offline
National Instruments
AKA: jhersh
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 1997
Location: Austin, TX
Posts: 148
Joe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to all
Re: Labview keeps freezing

Quote:
Originally Posted by Peter H
There are 3 cases. I deleted the byte counter and then reselected it before each case, to ensure it started at 0.
1 Correct operation, the full frame appears: as soon as I select Grab Frame, the number of bytes shows 114242
2 Partial frame, red LED continues to blink: as soon as I select Grab Frame, the number of bytes shows 114242
3 Partial frame, progress bar advances spontaneously, no red LED blinking: the number of bytes does not change from 0.
I have not knowingly changed any LabView settings. I removed LAbView and reinstalled it a few days ago, but saw no change in operation. Since this GUI works OK with a desktop computer, I suspect some incompatibility between my laptop and the camera, that produces a hiccup in the data flow, and LabView can not tolerate the hiccup.
Peter,

I'm suspecting that it will now work properly for you most of the time. The new update (from 2006.01.31) will much more robustly check that it is getting what is expected and quit if it doesn't. It also flushes the serial port buffers completely now and interrupts any currently executing streams on the camera. This means that even if the camera is in the middle of a frame grab (for whatever reason) and the app asks for a new frame, it will abort the first one and ask for a fresh new one. You should never get case 3 from above, now. If you get case 2 (I'm really not sure how this is happening since the size is correct) then it should fix itself on the next try.

Good luck!
-Joe
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Example LabVIEW Apps - Dashboard, CMUcam2 and Motors Russ Beavis National Instruments LabVIEW and Data Acquisition 9 21-01-2007 17:19
LabVIEW Com Port Error 354.FIRST LabView and Data Acquisition 4 18-01-2006 18:43
National Instruments LabVIEW and Data Acquisition Forum Danny Diaz National Instruments LabVIEW and Data Acquisition 1 16-01-2006 13:20
COM port settings for CMUcam labview testing and programming pwilczynski Programming 1 15-01-2006 15:09
National Instruments LabVIEW & Data Aquisition Forums Brandon Martus Announcements 0 22-11-2005 21:12


All times are GMT -5. The time now is 17:50.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi