LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling Silicon Labs CP2112 DLL fron LabVIEW

Solved!
Go to solution

Hi,

 

Does anyone have experience of using the DLLs that ship with the CP2112 to communicate with it from LabVIEW?

I have the GUI that ships with the CP2112 working (in so far as I can connect to the chip, and toggle the GPIO pins), so I know all electrical connections are sound.

Also, when I make a call from LabVIEW to some of the DLL functions that do not involve the hardware (e.g. GetLibraryVersion), I get a sensible values returned, so I know the interface between LabVIEW and the DLL is working.

However, I can't get any functions to work that actually do anything with the hardware.

I am using LV2016 32-bit, but running in Win7 64-bit.  Could this be causing the issue?

Any other ideas?

Dan

Dan
CLD
0 Kudos
Message 1 of 17
(1,957 Views)

Hi DanB1983,

 

     I am wondering if that GUI that comes with the CP2112 could be interfering with LabVIEW and not allowing LabVIEW to have control of the hardware, other than that the behavior would be very strange. 

 

    If the DLL is 64 bits, you would have an issue, but I don't think that's the case here since it would give you a pop-up. 

0 Kudos
Message 2 of 17
(1,922 Views)

Hi Dan

could you make it work?

I'm dealing with the CP2112 DLL. The only function I can do is: HidSmbus_GetNumDevices.

 

I'm dealing with HidSmbus_Open but without success.

 

Adrian

From Argentina

0 Kudos
Message 3 of 17
(1,870 Views)

Hi Adrian, 

 

      It's curious that in your case only one function works. Have you tested if in another Dev. Environment different from LV if you get the same issue for the other functions?

0 Kudos
Message 4 of 17
(1,862 Views)

Hi Carlos

I think it's because I have problems with the variables.

If I use the Silabs software, the functions respond well.

 

0 Kudos
Message 5 of 17
(1,855 Views)

Hi Carlos

 

From what I see, the function that I can use tells me how many devices I have connected.
I can not use the features that require interaction with the device

0 Kudos
Message 6 of 17
(1,839 Views)

You need to be a bit more specific about what doesn't work.

Do you try to use the device in LabVIEW while the Silicon Labs GUI is still running? That almost certainly won't work.

How do you call the Silicon Labs DLL? Did you create the VIs yourself? Are you sure the Call Library Nodes are configured correctly?

Rolf Kalbermatter
Averna BV
0 Kudos
Message 7 of 17
(1,833 Views)

Hi rolfk

 

Do you try to use the device in LabVIEW while the Silicon Labs GUI is still running?

No. 

I used the Silicon Labs GUI to make sure that the CP2112 device worked correctly. I stopped running that software and switched to LabView.

 

How do you call the Silicon Labs DLL?

I use Call library function node.I set the functions according to Silicon Labs specifications, as the file that I attached says

 

Did you create the VIs yourself?

Yes. I did not find VI's made for this device

 

Are you sure the Call Library Nodes are configured correctly?

Maybe I'm setting it up wrong.
In some forums I found that labview has compatibility problems with USB HID devices. Could it be that this is causing me the problem?

0 Kudos
Message 8 of 17
(1,824 Views)

@Adrian89 wrote:


In some forums I found that labview has compatibility problems with USB HID devices. Could it be that this is causing me the problem?


That's nonsense. Yes you can't easily communicate with USB HID devices directly from within LabVIEW. That is because the USB HID interface is still generic and there is no simply API to use for that. You still need to know how to interprete the bits and bytes that are received and transmitted in USB HID messages and they vary for each class of device (keyboard, mouse, custom stuff like your GPIO interface, etc.).

 

But your CP2112 DLL is supposed to solve that problem!

 

It's nice to add the API documentation for your DLL but I'm not going to develop the VIs for you Smiley Very Happy So where are your VIs that do not work?

 

Rolf Kalbermatter
Averna BV
0 Kudos
Message 9 of 17
(1,821 Views)

@rolfk  ha escrito:

I'm not going to develop the VIs for you 

 


Obviously .

My English is not very good, in forums in Spanish I did not find this topic, besides this post is quite new. I assumed it was easier to make myself understood with the documentation.

 

 

 So where are your VIs that do not work?

 

As I said, the HidSmbus_GetNumDevices function if it works for me. 

If I do not use the filter by VID or PID it tells me that I have 6 devices. If I use the filter, it says 1.

Then I try to use another function: HidSmbus_Open

If I use "deviceNum = 0" the response status is "invalid parameter". If I use a number other than 0, the response status is "device not found".I leave you below the features of the function. It does not have anything strange, it's quite simple.

 

Description : This function opens a device using a device number between 0 and HidSmbus_GetNumDevices() – 1 and returns a device object pointer that is used for subsequent accesses.
Prototype : HID_SMBUS_STATUS HidSmbus_Open (HID_SMBUS_DEVICE* device, DWORD deviceNum, WORD vid, WORD pid)
Parameters :

1. device—returns a pointer to an HID USB-to-SMBus device object. This pointer will be used by all subsequent accesses to the device.
2. deviceNum—is a zero-based device index, between 0 and (HidSmbus_GetNumDevices() – 1).
3. vid—filters device results by vendor ID. If both vid and pid are set to 0x0000, then HID devices will not be filtered by VID/PID.
4. pid—filters device results by product ID. If both vid and pid are set to 0x0000, then HID devices will not be filtered by VID/PID.

0 Kudos
Message 10 of 17
(1,812 Views)