Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

USB to I2C communication, CP2112 dev kit and ADT7470

Hello, 

 

I am new to the forum, so I appologize for anything I do that may be frowned upon. 

 

I am working on a project for school where I am trying to communicate with a ADT7470 IC through a Silicon Labs CP2112 USB to SMBus/I2C dev kit. I am fimiliar with Labview, but when it comes to things like this, I get a little lost. I was wondering if anyone here could provide some help to get me started or tell me this isnt possible. I believe that I need to use the NI VISA USB Contol In and Control Out to make this work, I Think. I appreciate all the help and Thank you.

 

CP2112 dev kit: http://www.silabs.com/products/interface/Pages/CP2112EK.aspx

ADT7470: http://www.analog.com/en/products/analog-to-digital-converters/integrated-special-purpose-converters...

0 Kudos
Message 1 of 16
(7,711 Views)

I2C bus devices like the one you mention can be interfaced by a lot of standard interfaces. NI also sells an i2c interface but rather expensive.

An alternative is the https://wiki.openwrt.org/doc/howto/usb.i2c-tiny-usb

Not really the easiest page but very cheap. Maybe even to buy somewhere.

 

If you need more info on how to interface in LabVIEW with i2c just ask.

greetings from the Netherlands
0 Kudos
Message 2 of 16
(7,677 Views)
Hello Albert.Geven,

I appreciate your response and alternative solution. If possible I would like to try to interface the CP2112 dev kit and ADT7470 with Labview. If you have possible solutions and/or examples on how to approach this, that would be great. Thank you for all your help.
0 Kudos
Message 3 of 16
(7,664 Views)

Hi jdl,

 

It looks like there is a Windows dll that comes with the CP2112 kit, or you can download it from the Silicon Labs website. After installing the software, you should be able to import the dll into LabVIEW. This article explains how to do that:

 

How Do I Call a Dynamic Link Library (DLL) from LabVIEW?

http://digital.ni.com/public.nsf/allkb/DCB90714981A1F148625731E00797C33

 

This will create VIs for the functions in the dll that you can then make calls to in LabVIEW. 

 

J. Calvert

Applications Engineer

National Instruments

0 Kudos
Message 4 of 16
(7,626 Views)
Elcalverado,
Thank you very much for your help. I had no idea you could do the import DLL. This should simplify the process of sending commands to the cp2112.

So I'm assuming I will still need a process to find the cp2112 through the computer. Can I do this with the NI VISA Control In? If so, then I'm guessing that following the USB Control In will be the new VIs that I created for the CP2112.
0 Kudos
Message 5 of 16
(7,530 Views)

If there is a good example to access a USB device and send it commands with custom VIs, that would be awesome. If there is something I can read and learn from I should be able to figure this out.

0 Kudos
Message 6 of 16
(7,529 Views)

Sorry, extra post

0 Kudos
Message 7 of 16
(7,528 Views)

Ok so I figured out to import the DLL and make calls to them, The only issue now is doing the write and read to the CP2112 which in turn will be sent to the ADT7470. Do I need to use the VISA Open to see the device, and what do I use to write the information to it. Thank you for your help and I really appreciate it.

0 Kudos
Message 8 of 16
(7,494 Views)

LabVIEW can make calls to the functions in the SLABHIDtoSMBus.dll API. All of the functions are outlined in a document called AN496 that is included with the library. These functions are all you should need to open a connection to the device and write to and read from it. You shouldn't need any VISA calls. Also read throug the user guide for the CP2112 to figure out which calls to make. 

 

J. Calvert

Applications Engineer

National Instruments

0 Kudos
Message 9 of 16
(7,477 Views)

Ok so messing around with CP2112 program provided by Silicon Labs. I have wired the CP2112 to the ADT7470. With the Silicon Labs program, I was able to commuicate with the ADT7470 for both read and write. As I perform these operations, the program tells me what function it calls as it goes along, which is awesome. I figured I can use the same order in Labview to perform the same operation. Now, my question is what is the proper way to wire these function together. I was able to import the dll file and header file to create the VI's. How do I wire these Call Library Function Nodes together. 

 

For example, the CP2112 program uses the HID_SMBUS_OPEN();, to connect to the device, then HID_SMBUS_READREQUEST();, to request a read to a certain slave address. Then, HIS_SMBUS_WRITERQUEST();, to write to a certain address on the slave advice, and finally the HID_SMBUS_READRESPONSE(); to read the response of that address. This worked and all I did was read the value of a register in the ADT7470. So how would I wire all these functions together in Labview to perform the same process. I'm just claifying, because I would like to make sure I'm doing this right. Thank you for all your help, I really appreicate it. 

0 Kudos
Message 10 of 16
(7,450 Views)