This is just an example firmware to demonstrate the Auto channel where SPI is the producer. This has to be modified according to the actual use cases.
This example communicates with SPI Flash like FX3 SDK example.
Only the channel where SPI is the producer is made Auto in the attached firmware. The channel which has SPI as the consumer remains Manual out.
Testing procedure is as follows:
Program the attached firmware into RAM.
Issue 0xC3 vendor command with wLength = 0x200, wIndex = 0x0000, wValue = 0x0000. Zero Length Packet is returned in the data phase of the control transfer as the actual read out data from SPI is sent to the Bulk IN endpoint.
Perform IN transfer on Bulk IN endpoint, where the Flash data can be obtained.
With the attached firmware, reading data length(wLength) > 0x200 is not supported as the Auto channel has only one buffer of size 0x200. The functionality when there are multiple buffers in the Auto channel with SPI as the producer is not in the scope of present discussion.
Referto the attached firmware, only when the 0x200 bytes are read out of the Bulk IN endpoint by the USB Host. This event CY_U3P_DMA_CB_XFER_CPLT is received in the DMA callback.