Author : HemanthR_06 Version: **
Translation - Japanese: FX3 GPIF IIをシリアルモードで構成する - KBA229814 - Community Translated (JA)
Question 1: How do I configure GPIF II in Serial mode?
Answer: The GPIF II interface of FX3 is a programmable state machine that enables a flexible interface that may function either as a master or slave. You can implement both parallel and serial interfaces with GPIF II. The GPIF II interface can be configured either for receiving or sending the data serially, but this configuration cannot be directly done through the GPIF II Designer tool. Therefore, the configuration needs to be done manually i.e., by modifying the generated header file as follows:
1. If not installed, Install EZ-USB FX3 SDK from https://www.cypress.com/documentation/software-and-drivers/ez-usb-fx3-software-development-kit.
2. Create and build the GPIF Designer project using the GPIF II Designer Tool in the EZ-USB FX3 SDK. For using GPIF II Designer tool refer to GPIF II Designer User Guide from <FX3 SDK Installation Path>\Cypress\EZ-USB FX3 SDK\1.3\doc.
3. In the generated GPIF header file, make the following changes in CyFxGpifRegValue:
- a. Set bit 7 and bit 14 of CY_U3P_PIB_GPIF_CONFIG register to ‘1’.
For example, if the value of CY_U3P_PIB_GPIF_CONFIG is 0x80008330, change it to 0x8000C3B0.
Question 2: How do I configure GPIF II in Serial IN mode?
Answer: After configuring the GPIF II interface in serial mode (as mentioned in answer to Q1) the GPIF II interface can be configured either as Serial IN or Serial OUT. To configure GPIF in Serial IN mode, necessary changes need to be done in the CY_U3P_PIB_GPIF_SERIAL_IN_CONFIG register. Refer to the Table 1 for configuring this register
This register allows you to configure the serial input incident on DQ in SERIAL_MODE.
Table 1: GPIF_SERIAL_IN_CONFIG
1: Enable Serial input in SERIAL_MODE
Set this bit to ‘1’ to configure the socket corresponding to chosen GPIF thread as the data sink for serial data.
Specify the thread number of the data sink for serial data
Packing is done only when FRAME_MODE = 0.
Set to ‘1’
Set to ‘0’
0: WORD_SIZE based.
1: **SOF to SOF
2: **SOF to EOF
This should be set as WORD_SIZE-1 for serial interface. For example, if set to ‘0’, it means that 1 bit is to be formed as word. If set to ‘9’, it means that 10 bits will make one word.
Note: **SOF and EOF are the interfacing signals when the FRAME_MODE is not configured as WORD_SIZE based.
SOF: Start of Frame
EOF: End of Frame
- When GPIF II is configured for Serial IN
- Pin DQ  is SOF
- Pin DQ  is EOF
- When GPIF II is configured for Serial OUT
- Pin DQ  is SOF
- Pin DQ  is EOF
Question 3: How do I configure GPIF II in Serial OUT mode?
Answer: After configuring the GPIF II interface in serial mode (as mentioned answer to Q1), to configure the GPIF II as Serial OUT, see the KBA, https://community.cypress.com/docs/DOC-18272.
Question 4: What are the code examples available for GPIF II in Serial mode?
Answer: See the attached FX3 folder which contains the firmware to configure FX3 in Serial mode. The shared firmware can be used to set up two FX3 devices back to back in serial mode.
The UsbtoGpif firmware can be used for Serial Out transfers – Serial Transmitter
- CY_U3P_PIB_GPIF_SERIAL_OUT_CONFIG: 0x00001F83
- Bit : GPIF Serial OUT is enabled
- Bit [3:2]: Socket 0 is set for popping serial data out
- Bit [12:7]: Packing is enabled. Word size set to 32 bits
- Bit [13:22]: No offset for SOF and EOF
GpiftoUsb firmware can be used for Serial In transfers – Serial Receiver
- CY_U3P_PIB_GPIF_SERIAL_IN_CONFIG: 0x00007D83
- Bit : GPIF Serial IN is enabled
- Bit [3:2]: Socket 0 is set for receiving the serial data
- Bit [7:9]: Packing is enabled. Frame mode set as SOF to SOF
- Bit [14:10]: Word size set to 32 bits (This should be set as per serial transmitters word size settings)
Do the following:
- Set up the devices as shown in Figure 1:
Figure 1. FX3 Devices Connected Back-to back in GPIF II Serial Mode
2. EzUSB FX3 SDK contains control center utility which will be used for firmware download to FX3 devices as well as for testing the data transfers. For more details refer to Getting Started to FX3 SDK [Path: :FX3 SDK Installation Path \Cypress\EZ-USB FX3 SDK\1.3\doc]
3. Program both FX3 devices with the respective image (.img) files.
4. Using the control center application, in the EzUSB FX3 SDK, send the data through the BULK-OUT endpoint.
5. After sending the data, receive the data through the control center application through BULK_IN endpoint as shown in Figure 3
Note: The GPIF state machine in the GpifToUsb firmware shared with this document is the same as the state machine in GpifToUsb firmware of the SDK; the data sampled by GPIF II will be committed to the USB (consumer) only when the buffer is full, i.e., when the sampled data is multiple of the DMA buffer size. The DMA buffer size will depend on the USB speed, i.e., the DMA buffer size will be 1024 bytes for USB 3.0 and 512 bytes for USB 2.0.
If the data transferred is not a multiple of the buffer size, error code 997 (timeout error) will occur on the control center.
The results for transferring data through the control center are as follows:
Figure 2. Transferring 32 Bytes of A’s Through Control Center
Data sent from FX3 Transmitter (Serial OUT) Data received by FX3 Receiver (SERIAL IN)
Figure 3. Data Transfer Through Control Cente