I am working on Cy7C680-13A usb 2.0 high speed controller. I would like to brief on my system before coming into the problem.
My system has one endpoint (EP2), configured as IN endpoint.
I have used the following lines of codes to enumerate device as a full speed, so that even I plug my USB 2.0 high speed device into a USB high speed host, the device will get enumerated as a full speed, and not high speed, which is a requirement of my project.
USBCS |= 0x08;
CT1 |= 0x02;
I am trying to interface an externel master (a cmos camera sensor) to the usb device controller in asynchronous mode. The clock from the externel master is connected to SLWR signal, where I am expecting the external master to write to the IN endpoint FIFO. The SLWR pin is toggled at the rate of 320ns.
Now the problem is,
For the below mentioned code written in TD_Poll( ), I am not able to get the USB device enumerated.
while(!(EP24FIFOFLGS & 0x04)); //check for programmable flag in EP2
EP2BCH = 0x00; //commiting the packet
EP2BCL = 0x40;
I find that the program is waiting indefinitely at the while loop mentioned in line 1 (things work fine once I comment of the while loop).
Here is how I have configured my programmable flag in TD_Init ( ).
EP2FIFOPFH = (bmBIT7 | bmBIT6); SYNCDELAY;//setting DECIS and PKTSTAT
EP2FIFOPFL = 0x40; SYNCDELAY;
In the above programmable flag configuration, I expect the TD_Poll( ) to come out of while loop once a size of 64 bytes gets filled in EP2. But this is not happening. The program is getting hang inside the while loop mentioned above.
Why is this happening ? Am I missing anything in programmable flag ?