Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

Configuring FX3 GPIF II in Serial Mode – KBA229814

lock attach
Attachments are accessible only for community members.

Configuring FX3 GPIF II in Serial Mode – KBA229814

ChaitanyaV_61
Employee
Employee
50 questions asked 25 likes received 25 sign-ins

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[]:

    1. 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[14] in SERIAL_MODE.

Table 1: GPIF_SERIAL_IN_CONFIG

Bit

Name

Description

Bit 0

ENABLE

1: Enable Serial input in SERIAL_MODE
0: Disable serial input

Bit 1

SOCKET_MODE

Set this bit to ‘1’ to configure the socket corresponding to chosen GPIF thread as the data sink for serial data.

Bit 3:2

THREAD_NUMBER

Specify the thread number of the data sink for serial data

Bit 6:4

Reserved

Bit 7

PACK

Packing is done only when FRAME_MODE = 0.

Set to ‘1’

  • If words are 1, 2, 4, 8, or 16 bits long, they are packed into a 32-bit field before committing to socket. Other word sizes are zero-padded at the MSB to the next byte or half word (16 bits) and then packed to a 32-bit value

Set to ‘0’

  • Push individual words as soon as they are formed, with MSBs zero-padded.

Bit 9:8

FRAME_MODE

0: WORD_SIZE based.

1: **SOF to SOF

2: **SOF to EOF

Bit 14:10

WORD_SIZE

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.

16:15

Reserved

17

Reserved

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

  1. When GPIF II is configured for Serial IN
    1. Pin DQ [9] is SOF
    2. Pin DQ [8] is EOF
  2. When GPIF II is configured for Serial OUT
    1. Pin DQ [13] is SOF
    2. Pin DQ [12] 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 [0]: 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 [0]: 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:

  1. Set up the devices as shown in Figure 1:

Figure 1. FX3 Devices Connected Back-to back in GPIF II Serial Mode

pastedImage_15.png

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

pastedImage_5.png

Data sent from FX3 Transmitter (Serial OUT)                                      Data received by FX3 Receiver (SERIAL IN)

Figure 3. Data Transfer Through Control Cente

pastedImage_8.pngpastedImage_9.png

Attachments
0 Likes
901 Views
Contributors