Issue while Debugging a PSoC® 3/5 USB Firmware – KBA89230

Version: **


Question: When you try to debug a working PSoC® USB firmware, you get the error message "USB Device Not Recognized" on the PC. Why is this happening? What is the solution?



This is happening due to the following issue with the ISRs: PSoC sends the descriptors using ISRs. These ISRs are not executed if the PSoC CPU is halted for debugging. Thus, when the PC sends a control request for the descriptors, they are not serviced by the PSoC CPU, which leads to failed enumeration.

To solve this problem: When using the Debug mode in PSoC, the PSoC CPU should be run freely until the device is recognized by the USB host (when the firmware exits the while(!USBFS_1_GetConfiguration()); condition).

The code snippet in the firmware will look like this:


void main()  {   int i,index=0;   /* Enable Global Interrupts */   CyGlobalIntEnable;   /* Start USBFS Operation with 3V operation */   USBFS_1_Start(0u, USBFS_1_3V_OPERATION);   /* Wait for Device to enumerate */   while(!USBFS_1_GetConfiguration());   /* Enumeration is done, enable OUT endpoint for receive data from Host */   USBFS_1_EnableOutEP(OUT_EP);  ...

Here, PSoC can be run step-by-step until the API USBFS_1_Start(). When this API is called it connects the pull-up resistor to the D+ data line, which makes the PC detect the device. After this API, the firmware should be executed freely with a breakpoint on the firmware statement:


As this API is hit, you will see that the USB host has detected the PSoC device. Now, you can do the transactions with USBFS while debugging.