2

The setup:
Raspberry Pi 3, running Windows 10 IoT Core Preview {10.0.14342.1000}
Camera: A link to the camera from who I got it from

I recently got a USB Camera working for taking pictures, however after testing found out that taking pictures alone is too slow for my purposes. So, I started looking into trying to work with a full video stream and capturing frames as needed.

I was able to follow along with this sample, and it seemed to be working however around a second into the preview the frame freezes. After freezing, it kicks back out to the start up application, which I thought was odd enough, but then I realized my USB mouse/keyboard were not responding. Thinking I needed to reset the system I went to Powershell to connect to the Pi it was unable to connect.

Even though I doubt it is a pure power issue (because the application continues running happily in the background until the lack of connection to Visual Studios during debug kicks it back to the main App), I have a USB power usage tester that I used to try and determine if the camera is just drawing too much current for the port to supply. It starts off at a default .08A. Before the freeze it reported about .15/.16 A and .9 W at max. After the freeze, the it stayed at a fairly consistent .05A.
I also have a little fan that I rigged to run off USB, to try and see if I could cause similar results. At max (I stopped the fan spinning with my thumb), the fan was drawing .25A and 1.3/4 W, much more than the camera at maximum load. So, I don't believe it's a power issue. The voltages for everything never dipped below 5.4V from what I saw.
I also don't believe it would be a power issue because the camera works fine, at full fps with a recent install of Raspbian Jessy. Using OpenCV, I had the camera set to MPEG, and I tried it with 10, 30 and 60 FPS (tried, even though the camera's documented FPS is 30, just to see what happened; it accepted 60, though it was probably only a few frames from 30 FPS).

So, I'm sure it's something to do with the code I'm trying to run but can't narrow down where the issue is.

What I've done, or What I'm Probably Not Understanding:

The highlight of the code I'm using is:

public async Task InitializeCamera()
{
    var resolutions = Camera.VideoDeviceController.GetAvailableMediaStreamProperties(MediaStreamType.VideoPreview);
    await _mediaCapture.VideoDeviceController.SetMediaStreamPropertiesAsync(MediaStreamType.VideoPreview, resolutions[0]);
}
//[...]
public async Task PreviewStream()
{
    StreamPreview.Source = _mediaCapture;
    await _mediaCapture.StartPreviewAsync();
}

I've got a CaptureElement declared in MainPage.xaml

<CaptureElement x:Name="StreamPreview" Stretch="None" Width="640" Height="480" />

I've tried a number of different stream properties, but nothing seems to really fix anything. I at one point tried changing the container by creating a VideoEncodingProperties object, but it throws an exception "The data specified for the media type is invalid, inconsistent, or not supported by this object. The data specified for the media type is invalid, inconsistent, or not supported by this object." I've even tried just changing the Subtype in the IMediaEncodingProperties object, resolutions[0], but it doesn't really seem to have any effect, though it's the only settable property, at least with default access.

Since the tutorial is part of the broader Universal Windows Applications code base and there are some changes for which I'd have to account, I've also downloaded and tried running code straight from the samples github repository for Windows 10 IoT Core.

Running WebCamSample with the camera I am wanting to use, everything looks like it starts off fine (once I change it to use the resolution setting for the camera, an issue I knew about beforehand), I am able to see the stream start and take a photo, but eventually the stream freezes and once the Ethernet connection times out I'm back on the home screen. I have tried it with a LifeCam-3000 HD and it works fine, with no code alterations.

My questions, in summary

Am I correct in thinking the camera is somehow causing the LAN9514(or the driver for it) to freeze? If so, how could the camera be causing so much havoc with the USB chip? Is there something I'm missing. some property I've overlooked, for the camera to avoid this? Or is this the roadblock that I've been dreading with the non-Supported Hardware cameras?

Any help or sources of information I may have missed would be appreciated.

  • Make sure you have enough USB power going in. A proper power supply. It sounds like classic brownout problems. – Piotr Kula Jul 14 '16 at 20:26
  • Would IoT have that much different power requirements? It also seems odd that everything else seems to work in the background, it's just the USB port going down. – tsimmons15 Jul 14 '16 at 23:27
  • Right... Have you tried using a powered USB hub? – Piotr Kula Jul 15 '16 at 7:24
  • Yes, to no difference. – tsimmons15 Jul 16 '16 at 16:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.