USB Camera crashes when opening Serial Port












0















I'm writing a program in WPF that needs to connect to a serial port to get and send data to a piece of machinery, and connect to a camera mounted on the machinery to show the video stream.



So last week we bought a mini PC (a beelink bt3 pro) to give to our customers when they bought this machinery, so they could install our program on this dedicated pc.
We immediately noticed that on the program startup, the camera would crash with that notorious sound that windows makes when you disconnect an usb device.
So after searching for clues on the problem I found out that when I called serialport.Open(), the camera would crash. For the serial port I use the standard Microsoft library, while for the camera I first used Directshow, then EMGUCV (I switched last week because i tought that the problem was caused by the camera library).



This is the code I use in the test program:



VideoCapture c = new VideoCapture(0);
c.ImageGrabbed += c_ImageGrabbed;
c.Start();
SerialPort port = new SerialPort("COM5", 9600, Parity.None, 8, StopBits.None);
port.Open();


Just after calling Open(), the camera crashes and stops recording, making the windows error sound like it was removed from the PC. No Exceptions are thrown out, and the program keeps running.



It is important to notice that this problem happens only on this PC, and I have the doubt that Windows 10 was not installed correctly, as I found a Windows.old folder in C:, and the system prompts me sometimes to delete the old windows folder.










share|improve this question























  • Windows.old can be due to an upgrade/major update: it's nothing to worry about.

    – Stefan
    Nov 25 '18 at 17:50











  • Does it crash with an exception? Does it crash without the camera? Are there any shared resources between the hardware (like COM port).

    – Stefan
    Nov 25 '18 at 17:51






  • 1





    Is the camera powered over USB? Can you exclude a power problem?

    – Klaus Gütter
    Nov 25 '18 at 19:06











  • @Stefan no exceptions are thrown. It doesn't crash the program. Without a camera there are no errors when calling Open(). Seems as like they share some resources as you said but I don't know how to tell.

    – Marco Filippozzi
    Nov 25 '18 at 19:15






  • 1





    @MarcoFilippozzi: you can test it with an external powered usb hub.

    – Stefan
    Nov 25 '18 at 19:19
















0















I'm writing a program in WPF that needs to connect to a serial port to get and send data to a piece of machinery, and connect to a camera mounted on the machinery to show the video stream.



So last week we bought a mini PC (a beelink bt3 pro) to give to our customers when they bought this machinery, so they could install our program on this dedicated pc.
We immediately noticed that on the program startup, the camera would crash with that notorious sound that windows makes when you disconnect an usb device.
So after searching for clues on the problem I found out that when I called serialport.Open(), the camera would crash. For the serial port I use the standard Microsoft library, while for the camera I first used Directshow, then EMGUCV (I switched last week because i tought that the problem was caused by the camera library).



This is the code I use in the test program:



VideoCapture c = new VideoCapture(0);
c.ImageGrabbed += c_ImageGrabbed;
c.Start();
SerialPort port = new SerialPort("COM5", 9600, Parity.None, 8, StopBits.None);
port.Open();


Just after calling Open(), the camera crashes and stops recording, making the windows error sound like it was removed from the PC. No Exceptions are thrown out, and the program keeps running.



It is important to notice that this problem happens only on this PC, and I have the doubt that Windows 10 was not installed correctly, as I found a Windows.old folder in C:, and the system prompts me sometimes to delete the old windows folder.










share|improve this question























  • Windows.old can be due to an upgrade/major update: it's nothing to worry about.

    – Stefan
    Nov 25 '18 at 17:50











  • Does it crash with an exception? Does it crash without the camera? Are there any shared resources between the hardware (like COM port).

    – Stefan
    Nov 25 '18 at 17:51






  • 1





    Is the camera powered over USB? Can you exclude a power problem?

    – Klaus Gütter
    Nov 25 '18 at 19:06











  • @Stefan no exceptions are thrown. It doesn't crash the program. Without a camera there are no errors when calling Open(). Seems as like they share some resources as you said but I don't know how to tell.

    – Marco Filippozzi
    Nov 25 '18 at 19:15






  • 1





    @MarcoFilippozzi: you can test it with an external powered usb hub.

    – Stefan
    Nov 25 '18 at 19:19














0












0








0








I'm writing a program in WPF that needs to connect to a serial port to get and send data to a piece of machinery, and connect to a camera mounted on the machinery to show the video stream.



So last week we bought a mini PC (a beelink bt3 pro) to give to our customers when they bought this machinery, so they could install our program on this dedicated pc.
We immediately noticed that on the program startup, the camera would crash with that notorious sound that windows makes when you disconnect an usb device.
So after searching for clues on the problem I found out that when I called serialport.Open(), the camera would crash. For the serial port I use the standard Microsoft library, while for the camera I first used Directshow, then EMGUCV (I switched last week because i tought that the problem was caused by the camera library).



This is the code I use in the test program:



VideoCapture c = new VideoCapture(0);
c.ImageGrabbed += c_ImageGrabbed;
c.Start();
SerialPort port = new SerialPort("COM5", 9600, Parity.None, 8, StopBits.None);
port.Open();


Just after calling Open(), the camera crashes and stops recording, making the windows error sound like it was removed from the PC. No Exceptions are thrown out, and the program keeps running.



It is important to notice that this problem happens only on this PC, and I have the doubt that Windows 10 was not installed correctly, as I found a Windows.old folder in C:, and the system prompts me sometimes to delete the old windows folder.










share|improve this question














I'm writing a program in WPF that needs to connect to a serial port to get and send data to a piece of machinery, and connect to a camera mounted on the machinery to show the video stream.



So last week we bought a mini PC (a beelink bt3 pro) to give to our customers when they bought this machinery, so they could install our program on this dedicated pc.
We immediately noticed that on the program startup, the camera would crash with that notorious sound that windows makes when you disconnect an usb device.
So after searching for clues on the problem I found out that when I called serialport.Open(), the camera would crash. For the serial port I use the standard Microsoft library, while for the camera I first used Directshow, then EMGUCV (I switched last week because i tought that the problem was caused by the camera library).



This is the code I use in the test program:



VideoCapture c = new VideoCapture(0);
c.ImageGrabbed += c_ImageGrabbed;
c.Start();
SerialPort port = new SerialPort("COM5", 9600, Parity.None, 8, StopBits.None);
port.Open();


Just after calling Open(), the camera crashes and stops recording, making the windows error sound like it was removed from the PC. No Exceptions are thrown out, and the program keeps running.



It is important to notice that this problem happens only on this PC, and I have the doubt that Windows 10 was not installed correctly, as I found a Windows.old folder in C:, and the system prompts me sometimes to delete the old windows folder.







c# camera serial-port windows-10 emgucv






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 25 '18 at 17:45









Marco FilippozziMarco Filippozzi

76312




76312













  • Windows.old can be due to an upgrade/major update: it's nothing to worry about.

    – Stefan
    Nov 25 '18 at 17:50











  • Does it crash with an exception? Does it crash without the camera? Are there any shared resources between the hardware (like COM port).

    – Stefan
    Nov 25 '18 at 17:51






  • 1





    Is the camera powered over USB? Can you exclude a power problem?

    – Klaus Gütter
    Nov 25 '18 at 19:06











  • @Stefan no exceptions are thrown. It doesn't crash the program. Without a camera there are no errors when calling Open(). Seems as like they share some resources as you said but I don't know how to tell.

    – Marco Filippozzi
    Nov 25 '18 at 19:15






  • 1





    @MarcoFilippozzi: you can test it with an external powered usb hub.

    – Stefan
    Nov 25 '18 at 19:19



















  • Windows.old can be due to an upgrade/major update: it's nothing to worry about.

    – Stefan
    Nov 25 '18 at 17:50











  • Does it crash with an exception? Does it crash without the camera? Are there any shared resources between the hardware (like COM port).

    – Stefan
    Nov 25 '18 at 17:51






  • 1





    Is the camera powered over USB? Can you exclude a power problem?

    – Klaus Gütter
    Nov 25 '18 at 19:06











  • @Stefan no exceptions are thrown. It doesn't crash the program. Without a camera there are no errors when calling Open(). Seems as like they share some resources as you said but I don't know how to tell.

    – Marco Filippozzi
    Nov 25 '18 at 19:15






  • 1





    @MarcoFilippozzi: you can test it with an external powered usb hub.

    – Stefan
    Nov 25 '18 at 19:19

















Windows.old can be due to an upgrade/major update: it's nothing to worry about.

– Stefan
Nov 25 '18 at 17:50





Windows.old can be due to an upgrade/major update: it's nothing to worry about.

– Stefan
Nov 25 '18 at 17:50













Does it crash with an exception? Does it crash without the camera? Are there any shared resources between the hardware (like COM port).

– Stefan
Nov 25 '18 at 17:51





Does it crash with an exception? Does it crash without the camera? Are there any shared resources between the hardware (like COM port).

– Stefan
Nov 25 '18 at 17:51




1




1





Is the camera powered over USB? Can you exclude a power problem?

– Klaus Gütter
Nov 25 '18 at 19:06





Is the camera powered over USB? Can you exclude a power problem?

– Klaus Gütter
Nov 25 '18 at 19:06













@Stefan no exceptions are thrown. It doesn't crash the program. Without a camera there are no errors when calling Open(). Seems as like they share some resources as you said but I don't know how to tell.

– Marco Filippozzi
Nov 25 '18 at 19:15





@Stefan no exceptions are thrown. It doesn't crash the program. Without a camera there are no errors when calling Open(). Seems as like they share some resources as you said but I don't know how to tell.

– Marco Filippozzi
Nov 25 '18 at 19:15




1




1





@MarcoFilippozzi: you can test it with an external powered usb hub.

– Stefan
Nov 25 '18 at 19:19





@MarcoFilippozzi: you can test it with an external powered usb hub.

– Stefan
Nov 25 '18 at 19:19












1 Answer
1






active

oldest

votes


















1














If the camera is powered over USB, it is probably a power problem, i.e. the USB port on the computer does not deliver enough current for a stable operation of the camera.



You may try




  • to connect the camara to a USB port with higher current specification

  • to connect the camera over an externally powered USB Hub.






share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53470188%2fusb-camera-crashes-when-opening-serial-port%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    If the camera is powered over USB, it is probably a power problem, i.e. the USB port on the computer does not deliver enough current for a stable operation of the camera.



    You may try




    • to connect the camara to a USB port with higher current specification

    • to connect the camera over an externally powered USB Hub.






    share|improve this answer






























      1














      If the camera is powered over USB, it is probably a power problem, i.e. the USB port on the computer does not deliver enough current for a stable operation of the camera.



      You may try




      • to connect the camara to a USB port with higher current specification

      • to connect the camera over an externally powered USB Hub.






      share|improve this answer




























        1












        1








        1







        If the camera is powered over USB, it is probably a power problem, i.e. the USB port on the computer does not deliver enough current for a stable operation of the camera.



        You may try




        • to connect the camara to a USB port with higher current specification

        • to connect the camera over an externally powered USB Hub.






        share|improve this answer















        If the camera is powered over USB, it is probably a power problem, i.e. the USB port on the computer does not deliver enough current for a stable operation of the camera.



        You may try




        • to connect the camara to a USB port with higher current specification

        • to connect the camera over an externally powered USB Hub.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jan 30 at 6:20

























        answered Jan 30 at 5:27









        Klaus GütterKlaus Gütter

        2,59221422




        2,59221422
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53470188%2fusb-camera-crashes-when-opening-serial-port%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Wiesbaden

            To store a contact into the json file from server.js file using a class in NodeJS

            Marschland