Have an IDLE state in between the START state and the one where you drive data. Then jump from this idle state to the drive state only if the DMA channel of Thread0 is ready and then jump back once it isn't. This way you're preventing contention between the GPIF and USB block trying to both access the same buffer.
See the attached figure.
gpif_sm.PNG 18.3 K
Also, in such cases, APIs such as CyU3PDmaChannelGetStatus() will come in handy. Print the channel status in a loop and see what the XferCount values are once you transfer data. They will give some clue as to what the problem is.
Thank you for your supporting.
But I still fail in send out data from usb to p-port. I use debug print and I sure FX3 receive data from usb but I don't know why fx3
never send data out even producer call back function is called. I feel something in GPIF was wrong. Could you teach me how to check the GPIF status like GPIF is actived or not, GPIF status, etc?
Thank you very much.