USB Camera freezes on SDK 4.3

Hi,

I have upgraded my project from a 4.2 SDk to a latest 4.3 R2 and have faced performance issue with my USB camera.
On 4.2 I had stable ~8-10 frames per second without any freezes but on 4.3 something was changed: for 2-3 sec I have 8-10 fps, then there is a lag for about 1-2 seconds where I have only 1-2 fps… and so on.

To check my assumption I have reverted back Raptor’s firmware and solution to v 4.2. After that everything works good, without lags.

Any ideas on how to find root cause of these freezes on 4.3 SDK?

@ Sergey Bokhantsev - sounds like garbage collection.

Thanks for your reply Mark

I sure GC is not the reason because there is no any reports about it in the Output window…
And again, after swithing to 4.2 - everything works.

May be some changes in GHI usb host implementation? I have no idea how to diagnose this issue.

Can someone check GHI camera with Raptor?

Hello GHI guys and Everyone,

I’m blocked by this issue and really need your help.

What I have checked (without any luck):

  • update all loaders and firmware (latest official release)
  • reconnect camera to another USB host (socket 6, 7 on Raptor)
  • use more power (both USB and external supply via DP module)

I’ve collected some time statistics about this freeze and it loks as the following:

[quote]//RUN APPLICATION

1 - 8 (first number is a seconds from the app start, second number is a number of frames reeived)
2 - 10
3 - 9
4 - 10
5 - 9
6 - 1 //FREEZE
7 - 1 //FREEZE
8 - 4 //FREEZE
9 - 7
10 - 5
11 - 6
12 - 10
13 - 10
14 - 9
15 - 10
16 - 9
17 - 1 //FREEZE
18 - 1 //FREEZE
19 - 1 //FREEZE
20 - 4 //FREEZE
21 - 5
22 - 6
23 - 10
24 - 9
25 - 9
26 - 10
27 - 10
28 - 2 //FREEZE
29 - 2 //FREEZE
30 - 2 //FREEZE
…[/quote]

As you can see FPS is goog for 6-7 seconds, then freezes for 3-4 seconds and so on.

Follow is the code I used to collect this statistics:

public partial class Program
    {
        Bitmap b = new Bitmap(160, 120);

        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
        {
            Debug.EnableGCMessages(true);
            camera.CurrentPictureResolution = Camera.PictureResolution.Resolution160x120;

            camera.CameraConnected += (s, e) =>
                {
                    Debug.Print("Camera connected");
                    camera.StartStreaming(b);
                };

            camera.CameraDisconnected += (s, e) =>
            {
                Debug.Print("Camera disconnected");
            };

            camera.BitmapStreamed += (s, e) =>
            {
                Debug.Print(DateTime.Now.ToString());
            };

            Debug.Print("Program Started");
        }
    }

Thanks!

@ Sergey Bokhantsev - I was able to reproduce the issue using the camera Gadgeteer driver, however, if I used the example on https://www.ghielectronics.com/docs/36/usb-host#3127 instead of the Gadgeteer module, it worked fine. Does it work for you?

1 Like

Wow, I didn’t saw this article.
Yes, it’s works stable, thanks!

Where can I find source codes for GHI Camera (2014 R2 release) or it is not open source?

This one seems outdated - http://gadgeteer.codeplex.com/SourceControl/latest#Main/Modules/GHIElectronics/Camera/Software/Camera/Camera_43/Camera_43.cs

@ Sergey Bokhantsev - The current Gadgeteer source can be found at https://bitbucket.org/ghi_elect/gadgeteer

The last commit to make it into an SDK is tagged with that SDK version.