Home→Forums→MonoBrick Communication Library→Fail to connect Ev3 via USB
Tagged: Connection, Monobrick, Test Project, USB
- This topic has 10 replies, 8 voices, and was last updated 7 years, 6 months ago by Rodrigo Perez Burgues.
November 29, 2013 at 11:27 #3179
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.
KonneNovember 29, 2013 at 21:30 #3182
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:
Good luck and let me know your findings.November 30, 2013 at 00:25 #3183
I have same problem with connection the EV3 brick via usb to windows 7 64x. I tried TestApplication too.
VadimNovember 30, 2013 at 04:16 #3184
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!December 1, 2013 at 16:19 #3185
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.
January 10, 2014 at 14:28 #3820
- This reply was modified 9 years, 3 months ago by Anders Søborg.
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)?January 10, 2014 at 18:37 #3822
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?
AndersJanuary 10, 2014 at 20:43 #3823
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.January 12, 2014 at 20:11 #3833
This is great info – and will for sure be valuable for others – so thanks for the followup…
AndersJune 4, 2014 at 07:17 #4404
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()September 29, 2015 at 21:09 #5489
Rodrigo Perez BurguesParticipant
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
You must be logged in to reply to this topic.