FX3 Fast GPIO Sampling

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

cross mob
jl46
Level 4
Level 4
50 replies posted 50 sign-ins 25 replies posted

Hello,

For my project, I'm currently using the FX3 (CYUSB3014) and looked into the SPI GPIO bit banging example as reference for the bit banging approach and given my timing requirements, it seems that we would need a delay less than a microsecond in between bits. From the looks of it, the smallest delay that can be used is with the CyU3PBusyWait (1uS). Is it possible to sample the logic levels of the GPIO pin/s with smaller delays and perform bit banging at a faster rate?

Thanks

 

 

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
AliAsgar
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 750 replies posted

Hi JL46,

1. What I have understood from your question is the 4 unused data bits of GPIF has to be initialized as HIGH and kept HIGH throughout the transfer. If its correct, GPIO4-7 can be pulled up using a resistor externally.
Also other GPIOs apart from DQ0-DQ7 can be used and initialized in the firmware.

2. There are two methods for reading the sampled data through control center,

a. You could declare a global flag, and change its value only when a particular vendor command is received by the firmware. Then you can check for this flag in the GpifToUsbDmaCallback and depending on the value of the flag, you could either discard or commit the buffer accordingly.
b. In the GPIF state machines, in the transition equations, there is FW_TRG. You could use (!DRDY&FW_TRG) in the GPIF transition equation (STATE0 -> STATE1) and in the firmware, call the  CyU3PGpifControlSWInput() API when a particular vendor command is received. For more information on this API, refer to Pg No. 263 of the FX3APIGuide.

3. When you double-click on a state, you can set how many times the state has to be repeated. So for the GpifToUsb project which I have shared with you, I have specified this value to be 32 for STATE1. I have attached a snapshot for your reference. So yes, 32 bits will be read from a GPIO synchronously with clk and drdy. 

Best Regards,
AliAsgar

View solution in original post

0 Likes
24 Replies