Fail to connect Ev3 via USB

HomeForumsMonoBrick Communication LibraryFail to connect Ev3 via USB

This topic contains 10 replies, has 8 voices, and was last updated by Author Image Rodrigo Perez Burgues 1 year, 10 months ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #3179
    Author Image
    Konrad Oeckel
    Participant

    Hi Anders, and hello to the Monobrick Community

    After the failure with the Monobrick remote connecting to the Ev3, I recently downloaded the Monobrick Test Project.

    I connected the EV3 via USB to the PC, but when I open the Test Application and debug it, I got the message, that the application cannot build a connection to the brick.

    The compiler says:
    An exception of the type “System.BadImageFormatException” appeared in TestApplication.exe.
    An exception of the type “MonoBrick.ConnectionException” appeared in TestApplication.exe.

    So, do you know what the problem could be. I’m using the EV3 (Education set), firmware 1.03E and the EV3 software is running on my PC.

    And by the way, thank you very very much again for the whole Monobrick project and for your help.

    Greets,
    Konne

    #3182
    Author Image
    Bo Yuan
    Participant

    Hello Konrad,

    I do not have the same kit yet (buying EV3 now) so I can not really test this situation. But by looking at the downloaded package I assume this has something to do with the usbdriver. The usbdriver windows dll is not included in the downloaded package so you have to find it somewhere else.

    If I were you I would start by this page:

    http://libusbdotnet.sourceforge.net/V2/Index.html

    Good luck and let me know your findings.

    #3183
    Author Image
    thingumajig
    Participant

    Hello,

    I have same problem with connection the EV3 brick via usb to windows 7 64x. I tried TestApplication too.

    Greets,
    Vadim

    #3184
    Author Image
    Kurutoga twokseven
    Participant

    Hello, all,

    Without an EV3 at hand to test, my best guess, after digging it a bit, is that you need to make sure you are running a windows OS that is compatible the hidapi.dll in the download package, which was compiled with VS2008 and require the VS 2008 redist dlls that a newer system may not have. For example, I am running windows 8.1 64bit and I had trouble loading the dll.

    For your system I recommend you go to hidapi download the source and compile it for yourself.

    I hope the author of Monobrick can comment on this topic. Take care!

    #3185
    Author Image
    Anders Søborg
    Key Master

    Hi

    The error that you are getting implies that you failed to load the hidapi.dll. The hidapi.dll in the MonoBrick download comes from my LEGO Software installation folder. I have tested this on two different Windows machines running Windows 7 64-bit and 32-bit and it worked in both Visual Studio and MonoDevelop. Try to compile your own hidapi.dll or maybe copy the dll file that comes with your LEGO EV3 installation. Just to make things clear the MonoBrick Remote does not support the EV3 yet.

    Anders

    #3820
    Author Image
    Marcin Krzewski
    Participant

    Hi,
    my EV3 is connected via usb, when I run TestApplication I just get “Failed to open connection” error. I’m using Visual Studio 2012 and Windows 8.1. I know it’s probably the hidapi related error, I already tried copying hidapi.dll and hidapi.dylib files from my \LEGO MINDSTORMS EV3 Home Edition\HidApi folder to \TestApplication folder but it doesn’t fix the problem. I also tried compiling my own hidapi library according to instruction on http://www.signal11.us/oss/hidapi/ but it doesn’t give the .dylib file and compiled hidapi.dll alone also doesn’t fix the problem. What am I doing wrong? Could you give me step-by-step instruction how to do it? Or should I switch to different software (Win7/VS2008)?

    #3822
    Author Image
    Anders Søborg
    Key Master

    Hi Marcin – thanks for using MonoBrick Communication library

    Are you using the test project? If yes what error are you getting when importing the dll in the USB class? The DLL that you are trying to import have to match the name of the DLL file. Is this the case?

    Anders

    #3823
    Author Image
    Marcin Krzewski
    Participant

    Thanks for the reply Anders. I was using the test project and I was able to solve the problem on my own. The error was
    (System.BadImageFormatException)A System.BadImageFormatException was thrown. An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
    and I fixed it by changing in the Visual Studio project properities\build target platform option to 32 bit. Hope this can help if someone has the same problem.

    #3833
    Author Image
    Anders Søborg
    Key Master

    Hi

    This is great info – and will for sure be valuable for others – so thanks for the followup…

    Anders

    #4404
    Author Image
    Itay Asayag
    Participant

    Hello fellows,
    I changed the target platform to 32 bit as well, and still getting this exception.
    Although I have to mention that I am developing on VB.NET 2013.
    I’ve tried to write a simple vehicle program and compiled it.
    It worked perfectly.
    Now I am trying to remote control my EV3 with a program I wrote on VB.Net, and I am getting this exception:

    An unhandled exception of type 'MonoBrick.ConnectionException' occurred in MonoBrick.dll
    
    Additional information: Failed to open connection

    The relevant code is in here:

            Dim brick As New Brick(Of Sensor, Sensor, Sensor, Sensor)("usb")
            Dim userInput As String
            brick.Connection.Open()
    #5489

    Hello,

    I test with Visual Studio Community 2015. In order to avoid hidapi load problem; I need to change two build options of the default build project options:
    - Change platform to 32 bits (x86)
    - Change Target NET Framework to 4.0

    Rodrigo

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.

Posted in

Make a donation