Re: CyUSB problems

Discussion of the PSoC CY8C24x94 and other PSoC like USB parts from Cypress should be discussed here. This forum is limited to the discussion of USB portion of those parts. Other forums should still be used to discuss the non USB features of these parts.

Moderator: ericb

Re: CyUSB problems

Postby woodmeister » Sat Nov 07, 2009 7:56 am

I am trying to get a USB interface up and running with a PSOC3 USBFS module
on my development kit. I am currently using Windows 7(32 bit) as my development system.

I down loaded and installed the USB suite tools.

First I created a simple USBFS device project in Creator which would
get data from an ISOC OUT endpoint and send it back out on an ISOC
IN end point. Built the project without any issues.

Next, created a PC program, console app, with Visual C++ using the CyAPI.lib. After clearing up
a couple issues got it to build.

Then I made modifications to the supplied .inf per instructions. (Used the direcory
for the x86 vista vesion. )

Programmed my board, powered down and plugged in and got the driver to install.
To check driver attachment to the board, unplugged the board rebooted the PC,
plugged the board back in in and windows appeared to have properly enumerated my board.

Started my VC++ program in debug and ran it. It succesfully created a CCyUSBDevice object,
and next executed the call to get the number of devices and it correctly returned one device
attached to the driver. But when I attempt to open the device, the open function returns a
false (0) indicating no device present. I then shut down my VC++ program.

Next, I openned up CyConsole to see if it was just my VC++ build that was a problem.
But, when I selected the CyUSB driver, CyConsole showed that I did have one device
attached but that was it. No other information whatsoever. No PID, VID, etc.
Double checked windows device manager and device was mounted had the
right VID, PID, etc.

Next, decided to see if this was just a Windows7 problem so, installed the suite on an XP machine (SP3)
Made the changes to the .INF file plugged in my board, windows loaded up and installed the driver
for my board. Checked device manager and all appeared good. Started up CyConsole, and everytime
I selected the CyUSB driver, the CyConsole threw an exception. If I unplugged my board, and made the selection
all was fine.

So, went back to windows7 and thought that maybe I had an issue with my board design and maybe I was missing
somethng. So, downloaded the Bulk loopback example for the PSOC 3 device, built it and ran the
program that was supplied on the PC. (did all the .inf and install stuff according to the directions) And it did not
work. Called up CyConsole once again and had the same results as I did with my board. Showed a device
connected but no other information at all.

Does anyone have a clue as to what I might be missing or doing wrong? Is there some undisclosed or obscure
undocumented feature I am missing? (some companies refer to bugs as undocumented features lol.)
Where can I look to find out what the problem is? REALLY do not want to write my own driver from
Bite-Size Cheese
Bite-Size Cheese
Posts: 10
Joined: Sat Nov 07, 2009 7:16 am

Re: CyUSB problems

Postby dag48 » Wed Nov 11, 2009 8:02 am

Considering your obvious expertise in SW development, this may be a duh.... but did you use the wizard to configure your USBFS with the desired VID, PID, etc.....
Posts: 3
Joined: Thu Oct 29, 2009 12:02 pm

Re: CyUSB problems

Postby woodmeister » Thu Nov 12, 2009 10:52 am

Thanks for the reply dag48. I did in fact use the install new hardware wizard.
Here's a new update. Today re-installed the USB suite, uninstalled all driver
instances that I had created.

I then, plugged my device back in and re-installed the driver for it.
Now, in my program, whenever I create a new instance of
CCyUSBDevice I get an exception thrown that there was an access
violation trying to access an address location. I then quit my program
and vc++, ran CyConsole it to threw the same exception for the same location.
Not any closer to a solution, but a new wrinkle.

Would like to know if anyone has gotten a PSOC3 USBFS to work at all with the
CYUSB driver?

Please note as I stated previously, the BULK Loopback example for this
part has the same issues. (I tried once again today to make sure.)
Bite-Size Cheese
Bite-Size Cheese
Posts: 10
Joined: Sat Nov 07, 2009 7:16 am

Re: CyUSB problems

Postby woodmeister » Tue Nov 17, 2009 8:05 am

some more info on digging into this issue.

Did some single stepping in my vc++ code and found that during the process
of creating a new instance of CCyUSBdevice. The crash occurs when the
constructor attempts to execute an CCyUSBDevice::open(). This is
where it throws the exception for an access violation trying to read location
0x0000000A. This is exactly the same exception that is being thrown
when trying to access the device with CyConsole.

At this point it appears either there is a problem with the libs, the
driver, or maybe something to do with .inf and how my device is
getting configured or driver installed. Maybe there is a problem
with how the USBFS descriptors are being set up in PSOC Creator.
Any help would really be appreciated other wise, I may just trash the
idea of using a PSOC and going with multichip solution using
FTDI and Microchip PIC solution. I don't want to, since the PSOC3
could incorporate everything I want in one chip.

PS. CyConsole does see my Miniprog3 with all its information.
Bite-Size Cheese
Bite-Size Cheese
Posts: 10
Joined: Sat Nov 07, 2009 7:16 am

Re: CyUSB problems

Postby woodmeister » Wed Nov 18, 2009 11:03 am

Well, I've got the exact point where the exception occurs. During the
creation of a new CCyUSBDevice instance the code reaches here when
the exception occurs:

013C1613 push ebp
013C1614 mov ebp,esp
013C1616 push ecx
013C1617 push ecx
013C1618 push ebx
013C1619 mov edx,ecx
013C161B xor ebx,ebx
013C161D cmp byte ptr [edx+997h],bl
013C1623 je CCyUSBDevice::SetEndPointPtrs+128h (13C173Bh)
013C1629 cmp byte ptr [edx+995h],bl
013C162F je CCyUSBDevice::SetEndPointPtrs+128h (13C173Bh)
013C1635 movzx eax,byte ptr [edx+999h]
013C163C movzx ecx,byte ptr [edx+99Bh]
013C1643 mov eax,dword ptr [edx+eax*4+96Ch]
013C164A mov eax,dword ptr [eax+ecx*4]
013C164D mov ecx,dword ptr [edx+4]
013C1650 mov dword ptr [edx],eax
013C1652 mov dword ptr [eax],ecx
013C1654 mov ecx,edx
013C1656 call CCyUSBDevice::EndPointCount (13BD1C7h)
013C165B movzx eax,al
013C165E dec eax
013C165F cmp eax,ebx
013C1661 mov dword ptr [ebp-8],eax
013C1664 mov dword ptr [edx+8],ebx
013C1667 mov dword ptr [edx+0Ch],ebx
013C166A mov dword ptr [edx+10h],ebx
013C166D mov dword ptr [edx+14h],ebx
013C1670 mov dword ptr [edx+18h],ebx
013C1673 mov dword ptr [edx+1Ch],ebx
013C1676 mov dword ptr [ebp-4],ebx
013C1679 jle CCyUSBDevice::SetEndPointPtrs+128h (13C173Bh)
013C167F push esi
013C1680 push edi
013C1681 mov edi,dword ptr [ebp-4]
013C1684 mov eax,dword ptr [edx]
013C1686 shl edi,2
013C1689 lea esi,[edi+eax+4]
013C168D mov eax,dword ptr [esi]
013C168F mov cl,byte ptr [eax+0Ah] <<<<<<<<<<<<<<<<<<<this is the exception!!!!!!

The endpoints in my device are defined as follows:
EP1,IN,ISOC,Asynchronous,DataEndpoint,Interval=10,Max. Packet size = 64
EP2,OUT,ISOC,Asynchronous,DataEndpoint,Interval=10,Max. Packet size = 64

So, could PSOC Creator be generating some bad configuration info for the
USB end point descriptors? Is this a driver bug? Or is there a USBFS module
bug? Or, is there just something I don't see that I am doing wrong?

Note: Using CyConsole throws a similar exception with trying to access
address 0x0000000A, which is probably at the same point in its code.
Bite-Size Cheese
Bite-Size Cheese
Posts: 10
Joined: Sat Nov 07, 2009 7:16 am

Re: CyUSB problems

Postby woodmeister » Thu Nov 19, 2009 8:47 am

Well, I thought that maybe there was a problem because of the type of
endpoint. I built my project with the USBFS enpoints set as BULK and then
as INT. These did not cause any exceptions to be thrown, in my VC++ project
or CyConsole. Then changed back to my ISOC endpoints, and now I don't get
any exceptions thrown!!! I even plugged it into an XP machine and it no longer
throws an exception with CyConsole. Very strange!!

Now, CyConsole accepts my device but displays no data on it at all.
When I run my VC++ project, I successfully create an instance of CCyUSBDevice
and it successfully determines that there is one device attached to the driver.
However, when I try to open the device, Open() returns FALSE. Initially,
I was passing NULL for a handle when I was creating an instance since
I was not concerned at this point with the reasons for using a handle. So,
I changed my code to add a handle, and CCyUSBDevice returns a handle with
a value of 0x0.

I took a look at the class variables for the instance saw very strange values
(alot of 0xCD or 0xCDCD) and also there were empty descriptor strings. No
endpoints, except control, etc.

Any help here would be appreciated.
Bite-Size Cheese
Bite-Size Cheese
Posts: 10
Joined: Sat Nov 07, 2009 7:16 am

Re: CyUSB problems

Postby blurled » Thu Nov 19, 2009 9:09 pm

When I read about your problem, it seems you are trying to solve 2 problems simultaneously and don't know which end is causing the problem. It could be easier to code Cyusb application first with a known working USB device.
When Windows finds a USB device, it doesn't mean it will allow you to access it - class of system device for example.
Hence, it would appear to a search (device enum) but throws an exception when you try to open it. If you had set the device descriptor to this class, that may be the problem. Best to build and verify each subset with a known working base. It doesn't appear you are experienced working with Cyusb library so perhaps that should be resolved first before trying to debug your device app and your win app simultaneously.
Posts: 1
Joined: Thu Nov 19, 2009 8:52 pm

Re: CyUSB problems

Postby woodmeister » Mon Nov 23, 2009 7:30 am

Thanks for your reply burled. As I noted recently, the exception somehow "magically" disappeared.
However, there is sill the access problem. This problem not only occurs with my VC++ code, but also
occurs when I run CyConsole. CyConsole displays that my device is attached at to some hub and
device number, pulls the name from the .inf but that is all that it displays. My thought is,
by using CyConsole I have eliminated my VC++ coding as an issue, isolating the problem to the
device end.

Further, to eliminate something that I was doing in my PSOC creator project, I loaded the Loopback
example project (AN56718). I built it, programmed my board. I modified the .inf per instructions,
plugged in my board, and did the driver installation thing. Now, with this application loaded,
when I run CyConsole, it sees the board plugged in, but that is it. It doesn't display any other information.

So now, I have used a Cypress supplied test program at both ends and am having problems. Could there be
some thing totally obvious in the .inf I am missing?

By the way, if it hasn't been clear, I have been using the CY8CKIT-001 with the PSOC3 module.

Here's my modified inf by the for the loopback example
; Installation INF for the Cypress Generic USB Driver for Windows Vista
; Processor support for x86 based platforms.
; (c) Copyright 2009 Cypress Semiconductor Corporation

Signature="$WINDOWS NT$"


CYUSB.sys = 1

CYUSB.Files.Ext = 10,System32\Drivers

ExcludeFromSelect = *

%CYUSB_Provider%=Device ;,NT,NTx86,NTamd64

;for all platforms
%VID_04B4&PID_1002.DeviceDesc%=CyUsb, USB\VID_04B4&PID_1002

;for windows 2000 non intel platforms
;%VID_0665&PID_A0A0.DeviceDesc%=CyUsb, USB\VID_0665&PID_A0A0

;for x86 platforms
;%VID_0665&PID_A0A0.DeviceDesc%=CyUsb, USB\VID_0665&PID_A0A0

;for x64 platforms
;%VID_0665&PID_A0A0.DeviceDesc%=CyUsb, USB\VID_0665&PID_A0A0



;Addservice = CYUSB,2,CYUSB.AddService



Addservice = CYUSB,2,CYUSB.AddService



;Addservice = CYUSB,2,CYUSB.AddService



;Addservice = CYUSB,2,CYUSB.AddService

; Deprecating - do not use in new apps to identify a CYUSB driver
; You may optionally include a check for DriverBase in your application to check for a CYUSB driver

DisplayName = %CYUSB_Description%
ServiceBinary = %10%\System32\Drivers\CYUSB.sys
AddReg = CYUSB.AddReg
LoadOrderGroup = Base



CYUSB_Provider = "Cypress"
CYUSB_Company = "Cypress Semiconductor Corporation"
CYUSB_Description = "Cypress Generic USB Driver"
CYUSB_DisplayName = "Cypress USB Generic"
CYUSB_Install = "Cypress CYUSB Driver Installation Disk"
CYUSB_Unused = "."
Bite-Size Cheese
Bite-Size Cheese
Posts: 10
Joined: Sat Nov 07, 2009 7:16 am

Re: CyUSB problems

Postby woodmeister » Mon Nov 23, 2009 11:41 am

I found a USB probe tool that I could use to look directly at
the USB interface on my board. What I found is that there
is no interface descriptor or configuration descriptor. It did
show 2 pipes open for the two endpoints and had the device

To verify that the tool I was using was functional, I looked at the
Miniprog3 that I had plugged in and it displayed all: configuration descriptor,
interface descriptor, the myriad of endpoints and pipes.

So, it looks like a possible USBFS creation issue on the PSOC Creator.
Either there is a step that has been left out in the initialization
or coding for this that needs to be done or perhaps a bug? Has anyone
else using a USBFS in a PSOC3 device have this happen and found a
workaround, or do I have something strange going on?
Bite-Size Cheese
Bite-Size Cheese
Posts: 10
Joined: Sat Nov 07, 2009 7:16 am

Re: CyUSB problems

Postby graaja » Mon Nov 23, 2009 5:12 pm

In the inf file:
Code: Select all
;for all platforms
%VID_04B4&PID_1002.DeviceDesc%=CyUsb, USB\VID_04B4&PID_1002

Can you change this also to your own VID and PID and check?

Also, once the windows binds a driver to a device during enumeration (even if there were some problem in the device), the old driver will be still bound to the device. Making any changes to the device firmware will not make windows to bind the device to a new driver. To enable a new enumeration and driver update do the following.

1. Open Registry Editor (Start >> Run >> Regedit
2. Open HKEY_LOCAL_MACHINE >> SYSTEM >> ControlSet001 >> Enum
3. Delete the keys with VID and PID matching the device
4. Repeat the above for all ControlSets and CurrentControlSet

Now, Windows will install the driver when the device is plugged in.
User avatar
PSoC Master
PSoC Master
Posts: 3084
Joined: Thu Dec 18, 2003 4:35 pm
Location: India

Re: CyUSB problems

Postby woodmeister » Tue Nov 24, 2009 9:40 am

Thanks for the reply Ganesh. Whenever I make a change to my USBFS
configuration, I always uninstall with the option checked to delete the driver
before reprogramming the device. I checked the different locations
you mention in the registry before and after I did this procedure. And this
process does remove all the occurrences of the device in the registry. I
wanted to check to see if this process did what you suggested should be
be done manually. (I'm just uneasy messing directly with registry, it is
Windows after all). Thanks for the idea, didn't work here but may
help some other time. I have tried changing VID's and PID's and still get the
same results.

I'm still concerned that when I use a USB probe tool, that it only
sees the device descriptor and not any of the other descriptors,
such as the configuration descriptors. For this info, I believe the tool
works at the same level as the enumeration process, since it has
no knowledge of driver interfaces.

I thought that this information was set up by generated code in
PSOC Creator from the information you put into the Configure USBFS
dialog? Is there some define I may be missing that is not obvious in the
documentation or some other item? I start by duplicating what every example
does and that is the start device call and then the get configuration to wait
until enumeration is complete. I have checked in the debugger and
execution does complete through this stage.
Bite-Size Cheese
Bite-Size Cheese
Posts: 10
Joined: Sat Nov 07, 2009 7:16 am

Re: CyUSB problems

Postby orob » Mon Nov 30, 2009 10:36 am

your registry settings for USB are in


where ??? is the VID and ### is the Pid, both in hex. Delete the ones of interest in there and you will be prompted for a new driver on the next plug.

My registry also shows a ControlSet001 as well as a ControlSet003, but deleting the entries there doesn't do anything.
The Big Cheese
The Big Cheese
Posts: 606
Joined: Wed Sep 26, 2007 9:06 am
Location: US

Re: CyUSB problems

Postby graaja » Mon Nov 30, 2009 4:55 pm

Did you delete the entry in CurrentControlSet? The entries should be deleted from all the control sets.
User avatar
PSoC Master
PSoC Master
Posts: 3084
Joined: Thu Dec 18, 2003 4:35 pm
Location: India

Re: CyUSB problems

Postby woodmeister » Fri Dec 04, 2009 10:33 am

I did try removing things from the registry but made no difference.

I appreciate you guys taking the time to help, but if you noticed
in in my last post, there seems to be a problem with descriptor access.

The USB probe tool I used is the one supplied with the Windows DDK. It
only indicated a Device descriptor. There were no Configuration, Interface, etc.
descriptors. This tool does not utilize the drivers for a given device to collect
the descriptor information. It accesses any USB device on the bus directly.
I verified this by plugging in a known working USB device that I had not
installed a driver for and did not install its driver. The tool reported
lots of descriptor data (Configuration, Interface, Endpoint, etc.).

So, it seems that at this point that the problem is with the USBFS implementation
as I was unable to get even get the BULK loopback example working which is also
showing this descriptor problem. I have managed to get a simple HID implementation
between PC and PSOC3 up and running.

So, perhaps I am still missing something in setting up a non-HID device or something
else is an issue. Either way, since I have an HID type link working, I need to move on
and for the time being live with the HID limitations on bandwidth.

I am still open to ideas on what to try.
Bite-Size Cheese
Bite-Size Cheese
Posts: 10
Joined: Sat Nov 07, 2009 7:16 am

Re: CyUSB problems

Postby enrique5 » Sat Feb 04, 2012 9:51 pm

I'm having this same problem.
I try the built in samples for HID mouse and the code stays in a loop on

This is a CY8CKIT-001 PSOC3 module.
I'm trying the HID 3 button mouse sample.

Was there a resolution to this?
Posts: 1
Joined: Sat Feb 04, 2012 9:44 pm

Return to “%s” USB

Who is online

Users browsing this forum: No registered users and 1 guest