Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Interface to Cypress USB controller

I have a custom device built around a Cypress CY17C68013 USB controller.  The Cypress controller uses a 2-step "re-numeration" process to first load its internal firmware followed by its driver.  A device unique VID/PID is programmed internally on a ROM, when the device is first connected it responds with this VID/PID and the custom firmware for the device is loaded into the device from a SYS file.  After that, the hardware automatically issues a USB RESET and changes the VID/PID to the Cypress IDs ... the reset causes the device to be re-detected and the new VID/PID now causes the Cypress driver (EZusb.sys) to be loaded as the Windows driver to access the device (which now has my custom firmware loaded).
 
I have that all working, and have created a Windows C++ application that can open a handle to the Cypress driver, and can read and write data to my device.
 
Now I want to access the device from within LabVIEW.   I have seen lots of posts on this board about this, but haven't seen any information that is helpful.  I have reall ALL of the links from all of the posts.
 
I tried to use the VISA Driver Wizard ... and this was able to create an INF file, and I could see my device from within MAX.   But, when I send a command to my device, my device does not respond as my firmware does not get loaded into the device in this case through the re-numeration process when I have the VISA driver installed.   As soon as I attach the device the NiViUsbK.sys driver gets loaded as the device driver, without first loading my firmware.
 
Question:  I am wondering if it will be possible to just substitue the NiViUsbK.sys driver for the EZusb.sys driver in my INF files, and have the NI VISA driver loaded in the second phase of the re-numeration process in place of the Cypress EZusb.sys driver?   Is that possible?   Has anybody done that?   And... if I do that, will I then still be able to access my device through my C++ programs?   Because, I need both my C++ programs, and LabVIEW to be able to access the device and it would be a real hassle to have to keep un-installing and re-installing the drivers to use one program or the other!
 
 
Question:   It would be much cleaner and simpler if it is possible in LabVIEW to simply open a handle to the Cypress driver as can be done in C++ and then use THAT driver to communicate with my device from within LabVIEW instead of the NI VISA driver, if that is possible?  (I am new to LabVIEW,  and VERY early in the learning curve).
 
 
Thanks.
Larry
 
0 Kudos
Message 1 of 4
(7,148 Views)
Hey TDSLW,
To give me a better idea of what we are working with, did the driver for this USB device come with any .dll for the drivers. If so you can call the .dll and work with it from within LabVIEW as it seems you want to do. Please take a look at this KnowledgeBase and let us know if this helps with what you want to do.
Regards,

Nicholas K
National Instruments
Applications Engineer
0 Kudos
Message 2 of 4
(7,120 Views)

Hi Nicholas, I understand that Cypress does make a dll, but I do not have it.  I have building with this particular chip for years and am very used to the SYS file driver, I hope to NOT have to switch over to use of a dll in order to make my device accessible to LabVIEW.   If I have a Windows plug-and-play device attached to my computer, and it is responding to other programs that can access USB devices .... I should be able to access it from LabVIEW ???

I can set up my INF files so that when my device installs it loads my firmware, and then loads the NiViUsbK.sys driver as the 2nd part of the re-numeration process instead of the EZusb.sys driver.    When I do that I can see my device in MAX, and it shows up in Device Manager as a NI VISA USB device.  

But, if I try to send a command to my device using the Basic I/O function of the Test Panel .... my device does not respond.   For example, simply sending a " 1 " to my device causes it to power on, and sending a " 2 " causes it to power off.   But when I put a 1 in the Buffer and then press execute ... the return is 0, and nothing happens with my device.   So, the Test Panel is not properly sending the buffer contents through the USB.... ????   I suspect that there is "stuff" going on in the EZusb.sys driver that is not implemented in the same way (or at all) in the NiViUsbK.sys driver ... and therefore the NiViUsbK.sys driver can not talk to my device???

 

0 Kudos
Message 3 of 4
(7,115 Views)

Hello,

we use the Cypress 6803, and Visa, and it works fine.

You will need to do the following:

1. Load a firmeware program into the 68013 that implements the type of interface you want between the 68013 and your hardware system. This firmware program will include as a first byte 0xC0 which means do NOT double renumerate, but just load the eeprom contents and run. This means no further support is required from the PC operating system. The firmware program will include the manufacturers name, the device description string, and the VID and PID to use.

Cypress offer a development kit (http://app.cypress.com/portal/server.pt?space=CommunityPage&control=SetCommunity&CommunityID=285&Pag...) which includes a Keil compiler, and a console to send hex or .iic files to the 68013 to program the eeprom.

Included in this package are examples that you can use to build the interface program. The GPIF designer is useful for defining the interface you will use. The vend_ax source is useful as a framework.

2. Once you have made the 8051 code for the 68013, you can load it in as a hex file, and cause it to re-enumerate. Using cyconsole (which will be associated with the default 68013 PID and VID) you can test your interface by sending data out the bulk out end point (often 02) and read it back via the bulk in endpoint (often 86). You can send vendor commands via the control endpoint (0).

3. Once you have got the 8051 software working, you convert it to an .iic file. The attached file describes this. This file will have the final VID and PID in it.

4. Now you use VISA Driver Wizard to make a USB Raw .inf file. You need to specify the manufacturer, product name, and VID and PID.

5. Next you cycle the power on your product, and Windows will ask for a driver. You point at the .inf file you just made. This will associate your product with the Visa driver.

6. In Labview you open a VISA session with the correct mask - here we are opening all products with VID = 1E41  and PID = 8008

USB0::0x01E41::0x8008?*

using the VISA Find resource vi.

7. Then you start reading and writing to it.

 

hope this helps

Bart

Message 4 of 4
(7,099 Views)