2 Replies Latest reply on Sep 27, 2017 11:58 PM by ricky.thomson_2593216

    FX3 GPIO from C#




      I am trying to figure out a way to use one of the FX3's GPIF, GPIO pins as a flag when communicating with an FPGA. Hopefully I would trigger this from my C# software when needed. I am aware of how to custom allocate values to a GPIO pin in the FX3 firmware and using the SimpleGPIO functions along with GPIO.outValue. But I haven't been able to figure out how to activate this from a PC software (C#) side of things.


      I was also hoping for pointers on how to reduce the latency on a single transfer between a host PC and an FPGA with the slave FIFO interface loaded onto the FX3. Currently I have a C# program that transfers out 32 bytes , which is stored in FPGA RAM then sent back into the the PC. Currently I'm using the PKTEND signal, instead of filling the whole DMA buffer on the return. Just curious if there is a faster way to do this, possibly with non-bulk end points. I'm currently at 0.4ms for 1 complete transfer.


      Kind Regards

      Ricky Thomson

        • 1. Re: FX3 GPIO from C#



          1. If you want to control GPIO from the host(PC) application, you can send an vendor command and parse it in the Firmware and assert and de-assert the GPIO.


          Refer Bulk Source Sink (C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\basic_examples\cyfxbulksrcsink) Example project for implementing the Vendor commands and Refer GPIO APP (C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\serialif_examples\cyfxgpioapp) for configuring the GPIOs and asserting and de-asserting the GPIOs.



          2.  You have to assert PKTEND# since 32 byte data cannot be committed automatically. Procedure for committing the buffer is same irrespective of endpoints.

          Otherwise, If you want to send only 32 bytes from GPIF to FX3 (FX3 to GPIF), you can create buffer size of 32 bytes and implement flow control (using DMA RDY and Water mark flags) on GPIF interface.


          When ever you send 32 bytes on Bulk Out Ep, the buffer will be committed to P-Port, since it is full.

          Similarly, if you send 32 bytes from FPGA to GPIF, the buffer will be committed automatically, you don't need to use PKTEND# here.

          Here you may get the delays due to Buffer Switching. Please compare the throughput in both the cases and go ahead with best one.

          1 of 1 people found this helpful
          • 2. Re: FX3 GPIO from C#

            Thanks! Both of these are excellent answers, I'll go ahead and try them.