How to debug cyusb_bulk_transfer?

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

cross mob
doch_3739346
Level 4
Level 4

Hi,

In firmware cyfxsrammaster.h, output endpoint is 0x81.

#define CY_FX_EP_PRODUCER                   (0x01)  /* Endpoint 1-OUT. */
#define CY_FX_EP_CONSUMER                   (0x81)  /* Endpoint 1-IN. */

#define CY_FX_PRODUCER_USB_SOCKET           (CY_U3P_UIB_SOCKET_PROD_1)  /* USB Socket 1 is producer */
#define CY_FX_CONSUMER_USB_SOCKET           (CY_U3P_UIB_SOCKET_CONS_1)  /* USB Socket 1 is consumer */

#define CY_FX_PRODUCER_PPORT_SOCKET         (CY_U3P_PIB_SOCKET_1)       /* In,  GPIF Socket 1 is producer. */
#define CY_FX_CONSUMER_PPORT_SOCKET         (CY_U3P_PIB_SOCKET_0)       /* Out, GPIF Socket 0 is consumer. */

Try to send output data (from FX3 GPIF to FPGA) with below command, but FPGA interface is silent.

r = cyusb_bulk_transfer(h1, 0x81, buf, nbr, &transferred, timeout * 1000);

How to debug this?

0 Likes
1 Solution
SrinathS_16
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

Hello,

- The srammaster.c file is intended to write to the SRAM with an 8-bit address bus. Have you modified the source code to suit the read/write to FPGA?

- Also, to perform a write to FPGA from FX3, the OUT endpoint of FX3 should be used, which is 0x01. The IN endpoint 0x81 is used for reading data from the FPGA over to FX3 and then to the host PC.

If interfacing with FPGA is your desired application, please refer to AN65974.

Best regards,

Srinath S

View solution in original post

0 Likes
4 Replies
SrinathS_16
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

Hello,

- The srammaster.c file is intended to write to the SRAM with an 8-bit address bus. Have you modified the source code to suit the read/write to FPGA?

- Also, to perform a write to FPGA from FX3, the OUT endpoint of FX3 should be used, which is 0x01. The IN endpoint 0x81 is used for reading data from the FPGA over to FX3 and then to the host PC.

If interfacing with FPGA is your desired application, please refer to AN65974.

Best regards,

Srinath S

0 Likes

Hi Srinath,

1. I'm referencing cyusb_linux_1.0.5/src/08_cybulk.cpp.

Previously I've successfully write FPGA register with USB Control Center, customized firmware and customized FPGA bit.

Here I'm trying to create my own linux command to write FPGA register. Firmware and FPGA bit are the same.

pastedImage_0.png

2. According to AN87216, output from GPIF to FPGA is Consumer Socket.

pastedImage_1.png

Below left side is original code, so CONSUMER endpoint shall be 0x81. Could you double check.

pastedImage_2.png

0 Likes

Hi Srinath,

You are right! The endpoint is 0x01. If I change the endpoint, GPIF can write data to FPGA.

Why cyfxsrammaster.h define CY_FX_EP_PRODUCER as 0x1? Or only SOCKET is used?

pastedImage_0.png

pastedImage_1.png

pastedImage_2.png

0 Likes

Hello,

Consider the case when the GPIF II interface receives data from the USB interface. The terms PRODUCER and CONSUMER are with respect to the DMA channel. The data is written into the DMA channel by the USB interface, hence is called the PRODUCER socket and the data is emptied from the DMA channel by the GPIF II interface (P-Port), hence is called the CONSUMER socket.

As you can see from the below image, when data is written to the GPIF II interface, the OUT endpoint 0x01 is used. As far as USB interface is concerned, the endpoint 0x01 fills the data into the DMA channel and hence is named as CY_FX_EP_PRODUCER whereas the endpoint 0x81 empties the data from the DMA channel and hence is named as CY_FX_EP_CONSUMER.

pastedImage_0.png

Best regards,

Srinath S

0 Likes