FX3 GPIO from C#

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

cross mob
Anonymous
Not applicable

Hi,

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

0 Likes
1 Solution
KandlaguntaR_36
Moderator
Moderator
Moderator
25 solutions authored 10 solutions authored 5 solutions authored

Edited:

---------------------

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.

View solution in original post

3 Replies
KandlaguntaR_36
Moderator
Moderator
Moderator
25 solutions authored 10 solutions authored 5 solutions authored

Edited:

---------------------

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.

Anonymous
Not applicable

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

0 Likes

I can not understand GPIFII…

Please help.

If it is possible, tell by stages how to make a simple test project. For example, there for  a timer interrupt. Each timer interrupt we reads 8 pins through a GPIFII and sore its in user memory.

Than we Invert this value in the program code and then also through GPIFII we out these 8 bits on the pins.

How to configure GPIFII without using templates?

How to make a state GPIFII machine?

How to compile this states?

How to create an h-file?

How to connect it h-file to my project?

I think that this information will be useful not only to me, but also to many other people who use your products (FX3).

Yes, I read your documents, in particular about “slave fifo”, but there is not much information specifically on the issues that I asked now.

0 Likes