Please refer to the GpioApp example from the SDK from the path: C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\serialif_examples\cyfxgpioapp
The above example uses GPIO as input at both edges and when an input level is changed, events are set in the CyFxGpioIntrCb().
I mean, the example that handles interruption calls from from host.
Like I will submit an interrupt URB every few milliseconds and I would like to know how this URBs are handled in the firmware.
I need to create an interrupt endpoint which will notify if some pin has triggered an interrupt.
A mix of cyfxgpioapp and cyfxusbdebug.
But cyfxusbdebug doesn't send information back to the host. At least I cant find where.
The ApplnThread_Entry function from cyfxusbdebug prints to serial port not to some memory for the interrupt endpoint.
Can you please elaborate on, "I need to create an interrupt endpoint which will notify if some pin has triggered an interrupt."?
-> Do you mean to say that the device should automatically let the host know of the available data after a GPIO is triggered?
Can you please let me know why you want to use an ISOC endpoint in this case?
According to the USB spec, the host should poll the interrupt endpoint by using ISOC IN token at a service interval and the device would either respond with the data (If there is any available data) or a Zero-Length Packet (ZLP).
FX3's ISOC endpoint also needs the host to poll the endpoint and issue ISOC IN tokens and FX3 will respond with the data when the GPIO is pressed and then commit a buffer, with pre-defined data, to the host and if GPIO is not pressed, the FX3 will send a ZLP.
Instead of using the ISOC endpoint, you can go ahead and use a BULK endpoint and vendor commands to implement a similar application since you will still be issuing IN tokens in this case and the device will only respond to the host when the GPIO is pressed.
If there's no data, the endpoint with respond with a NACK.
Instead of porting cyfxgpioapp into cyfxusbdebug, you can port the cyfxgpioapp example into the cyfxisosrc or cyfxisosrcsink examples provided in the SDK.
Here's how you can try:
1.) Comment off all the internal CyU3PCommitBuffer() API's in the cyfxisosrc example.
2.) Add the CyU3PGpioInit() function with the required API and the GPIO that you want to use as input using CyU3PGpioSetSimpleConfig().
3.) Copy the CyU3PEventCreate() function from the gpioApp example and add in the CyFxApplicationDefine() of cyfxisosrc.
4.) Add the CyFxGpioIntrCb() function where the GPIO is checked for any input change and respective events are set into the cyfxisosrc firmware.
5.) In the for (; ; ) loop of cyfxisosrc firmware, use CyU3PEventGet() similar to cyfxgpioapp example and check for the high or low event being set in the CB and use CyU3PDmaChannelGetBuffer() and CyU3PDmaChannelCommitBuffer() API's to commit a buffer to the host.
So, if you use GPIO on the FX3 SuperSpeed Explorer Kit, it is connected to a switch. When the switch is pressed, the LOW event is set, and based on this, you can commit a pre-loaded buffer to the host over the ISOC endpoint when the host issues an IN token.