Author: HemanthR_06 Version: **
Translation - Japanese: FX3のGPIFにシリアルOUTインターフェースを設定する - KBA228346 - Community Translated (JA)
The GPIF Interface can be configured to send out data serially to an external peripheral, but the GPIF II Designer software does not provide a way to do this. Therefore, the configuration must be done manually by modifying the header file generated by GPIF II Designer.
1. Create and build a GPIF Designer project.
2. In the generated GPIF header file, make the following changes in CyFxGpifRegValue:
- Set Bit 7 and Bit 14 of the CY_U3P_PIB_GPIF_CONFIG register to ‘1’.
For example, if the value of CY_U3P_PIB_GPIF_CONFIG is 0x80008330, then change it to 0x8000C3B0.
3. Make necessary changes in the CY_U3P_PIB_GPIF_SERIAL_OUT_CONFIG register (see Table 1). See Table 2 for a description of how serial data is sent out when different configurations are chosen.
Note: These register changes are to be made manually after the GPIF header file is generated by the GPIF Designer because the GPIF II Designer software does not facilitate serial configuration.
See C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\fx3_sdk_1_3_4_src\sdk\firmware\include\gpif_regs.h for the GPIF serial mode registers.
1: Enable serial output in SERIAL_MODE
0: Disable serial output
Set this bit to ‘1’ to configure the socket corresponding to the chosen GPIF thread as Data Source for Serial Data.
Specify the Thread Number which is the Data Source of the Serial Data.
If set to ‘1’:
If words are 1, 2, 4, 8, or 16 bits long, they are received packed into a 32-bit field before committing to the socket. Other word sizes are received zero-padded at the MSBs to the next byte or half-word (16-bit) and then packed to a 32-bit value.
If set to ‘0’:
Every 32-bit value has only one word regardless of the size.
Setting to ‘0’ means that 1 bit is to be formed as word; 9 means 10 bits make a word, and so on. At the first bit of a word, an SOF (Start of Frame) is generated; at the last bit, an EOF (End of Frame) is generated by internal hardware. SOF, EOF, and their offset variants are connected to DQ lines.
Once the GPIF Interface is configured for serial communication, the pin configuration changes as follows:
- DQ – Serial OUT; DQ – SOF signal; DQ – EOF signal.
Number of Bits in a Frame
Word Size Field
Serial OUT data will be zero padded to 32-bit. The data source for GPIF Serial OUT is configured as CY_U3P_PIB_SOCKET_X (i.e., the Consumer Socket provided in the DMA Channel creation is CY_U3P_PIB_SOCKET_X).
For example, if 0x8181 is committed to the socket, the GPIF Serial OUT data will be 0x00008181. This means that MSb padded with zeros. Therefore, ensure that you commit the data which is a multiple of 32 bits (i.e., 4 bytes) if padding is not required.
None of the above
(Number of bits in the Frame) -1
Example 1: Number of bits to be sent out in a frame is 5 (the Word Size field should be set to 4).
If you commit 0xABC10001ABC10010ABC10100ABC11000 (where ABC can be ‘0’ or ‘1’) to the socket, the serial out data will be 0x10001100101010011000: LSb is sent first.
If you commit 0xABC1000101010010ABC1010010011000 (where ABC can be ‘0’ or ‘1’) to the socket, the serial out data will be 0x10001010100101010010011000: LSb is sent first. Therefore, ensure that you commit the data which is a multiple of 32 bits (i.e., 4 bytes) if padding is not required.
From the committed data, only the number of bits specified in the first column will be transmitted; the rest of the data is truncated upto the next committed 32-bit word.
The following examples show the data is sent over the GPIF interface when different word sizes are selected and PACK is set to ‘1’:
In the following figures, DATA refers to Serial OUT data; the bits are sent LSb first.
- Word Size field: 1 (i.e., number of bits in a frame: 2); data committed to the PIB Socket: 0x8181:
- Word Size field: 3 (i.e., number of bits in a frame: 2); data committed to the PIB Socket: 0x8181:
- Word Size field: 4; data committed to the PIB Socket: 0x8181:
- Word Size field: 9; data committed to the PIB Socket: 0x81818181:
- Word Size field: 18; data committed to the PIB Socket: 0x81818181:
The following examples show the data sent over the GPIF interface when different word sizes are selected and PACK is set to ‘0’:
- Word Size field: 1; data committed to the PIB Socket: 0x000000003(2nd) 0x000000001(1st) (Two 32-bit words):
- Word Size field: 3; data committed to the PIB Socket: 0x00000000D(2nd) 0x00000000C(1st) (2 32-bit words):
- Word Size field: 4; data committed to the PIB Socket: 0x00000001D(2nd) 0x00000000C(1st) (Two 32-bit words):