Using Auto channel for SPI transfers in FX3 – KBA230715
Author: HemanthR_06 Version: **
Translation - Japanese: FX3でのSPI転送にAutoチャネルを使用する - KBA230715 - Community Translated (JA)
Question: How to use Auto channel with SPI as the producer and USB as the consumer?
Answer: The firmware project attached with this article has few modifications done on UsbSpiDmaMode example, available in FX3 SDK in the following path, to implement Auto channel:
C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\serialif_examples\cyfxusbspidmamode
- 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.
Refer to 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.