cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

Anonymous
Not applicable

I'm trying to get a very basic USB implementation up and running. I intend on just doing some basic vendor-specific transfers but at the moment I can't seem to get the USB device to enumerate for more than a few fractions of a second.

   

 

   

My main loop is very straightforward:

   

 

   
int main(void) {  int i;   CyGlobalIntEnable;  USB_Start(0, USB_DWR_VDDD_OPERATION);   i = 0;  while (! USB_GetConfiguration()) {   Port2Reg_Write(1 << i);   wait100();    i++;   if (i == 😎 {    i = 0;   }  }  Port2Reg_Write(0);  /* ... */ }
   

 

   

Right now, USB_GetConfiguration() never returns nonzero so I sit and spin. The computer (OSX, also tried on Windows and Linux) shows the USB device enumerating and then disappearing, over and over again. If I am quick enough I can see that my manufacturer name and product name strings show up in lsusb output but that's it.

   

 

   

Is there something basic I'm missing? I have studied the examples and they seem to do the same thing, and in fact if I load one of the other PSoC5LP demos (such as the PSoC 4 Pioneer programmer source) it does the same thing, leading me to believe that something isn't correct perhaps on my board.

0 Likes
Reply
13 Replies
Anonymous
Not applicable

 Some additional information:

   
        
  • CY8C5868AXI-LP035
  •     
  • Powered from USB, VDDA/VDDD both 3.3V
  •     
  • USB clock is 48MHz, configured as 2x ILO which is 24MHz
  •     
  • Bus clock is 64MHz, from PLL whose source is ILO
  •     
  • USB D+/D- connected through 22 ohm resistors as per data sheet
  •     
  • no VUSB sensing
  •    
0 Likes
Reply
Esteemed Contributor

You are aware of the example projects link on Creator Start page ?

   

 

   

"Find Example Project"

   

 

   

Regards, Dana.

   

 

   

0 Likes
Reply
Esteemed Contributor

Screenshot attached.

0 Likes
Reply
Esteemed Contributor II

You forgot the infinite loop. When your "while" gets finished the PSoc reboots.

   

 

   

Bob

0 Likes
Reply
Anonymous
Not applicable

 The while (1) { ... }; was left out (it was after the while (! USB_GetConfiguration()) { ... }; loop that never exits.

   

 

   

I've looked at the example projects and tried a few, they do the same thing, which is why I'm suspecting that I'm forgetting something from the hardware side of things, but I'm at a loss as to what it is. USB D+/D- through 22 ohm resistors, PSoC5LP is powered from its own 3.3V supply on both VDDD and VDDA, other PSoC functions work fine (I/O, timers, etc.) but I can't seem to get USB to enumerate and stay enumerated.

0 Likes
Reply
Valued Contributor II

I had something similar to your case.
I had to remake the USB settings on 5 volts.
Seems so:
USBUART_1_Start (0, USBUART_1_5V_OPERATION);
 

0 Likes
Reply
Esteemed Contributor II

Probably the ILO: Its accuracy i-50% to +100% which in no case would be allright for an USB connection.

   

I would suggest you to post your complete project so that we can have a look at all settings. To do so, use File -> Create Workspace Bundle (minimal) and then attach .zip. do NOT use chrome, will not work, use IE instead, works best.

   

 

   

Bob

0 Likes
Reply
Anonymous
Not applicable

 I'm using the ILO as you mentioned, but the clock seems to report +/-0% which is frankly amazing. I'm using the smaller temp range for the project which may be helping I guess.

   

 

   

As requested, I'm attaching the workspace bundle. It's pretty straightforward. Thank you in advance for taking the time to help. I do appreciate it.

   

 

   

-A.

0 Likes
Reply
Anonymous
Not applicable

 Just doing some more reading and came across AN80248 - Improving the Accuracy of Internal Oscillators and another app note that I can't find now which suggested trimming the IMO using the USB 1ms start of frame (SOF) signal.

   

 

   

Is it possible that this must be done manually? I'm in the midst of wiring up a capture timer now to check, but wanted to add this to the discussion to see if I'm off base. The PSoC3 and 5LP documentation both state that they work fine with the internal oscillator but none go into detail about whether clock trimming is required. the example USB projects vary between using an external 24MHz crystal or configuring the IMO for 24MHz but so far I've been unable to get any USB project to work.

   

 

   

The USB Bootloader projects for the 5LP work, but any of the projects that use USB and are configured as "Bootloadable" all do the same thing (endless connect/disconnect on the USB side) once the application is loaded. Very confusing.  I have tried explicitly stating 3V or 5V operation when calling USB_Start() but both have the same result.

   

 

   

At this point I'm convinced that the hardware is fine since the USB Bootloader works fine, and that I've just got something incorrectly configured in the main application (whether Bootloadable or Standalone).

0 Likes
Reply
Anonymous
Not applicable

 Section 14.4.2 of the PSoC5LP Architecture TRM seems to state that the USB clocking subsystem already contains the IMO calibration required to achive +/- 0.25% accuracy for USB...

0 Likes
Reply
Esteemed Contributor II

I could not find anything strange in your settings except that you changed Cypress's default PID to something else.

   

I'm not a crack at USB, but shouldn't you try to keep the defaults so that the Cypress-driver could bind?

   

 

   

Bob

0 Likes
Reply
Anonymous
Not applicable

Thanks for taking a look, Bob, I appreciate it.

   

 

   

In the end I am suspecting it may be an OSX thing. I tried with a Linux system (not a virtual Linux system) and it came right up and I've been able to send and receive USB data. I have to figure out how to bind to WinUSB.Sys and try on a native WIndows system as well, and perhaps file a bug with VMWare Fusion.

   

 

   

Thanks again for your time and patience.

0 Likes
Reply
Esteemed Contributor II

You are always welcome!

   

 

   

Bob

0 Likes
Reply