In my Application I need a Master GPIF to an FPGA with a 16-bit address bus. I want to transmit and receive data through the USB directly to the FPGA.
My plan is to send a control package to setup bulk transfers between the U-Port and the P-Port. With every setup package I would like to chose a new starting address, the number of data words and if the address counter will be incremented or not.
The only functions I found that give me control about the address counter and data counter are CyU3PGpifInitAddrCounter() and CyU3PGpifInitDataCounter(). I found somewhere here on the forum that these functions can be used only after loading the GPIF state machine but before starting it. Is that the correct way to implement a variable address and data counter? If yes, is it enough to disable the state machine with CyU3PGpifDisable(0) before reinitializing the address and data counter and then restarting it using CyU3PGpifSMStart()? Or is there a more direct way to access the address and data counter while the state machine is running?
I want to have another option to send very short commands to the FPGA. For those I don't want to have an extra control package. But I want to send one package with my own header information I extract within the CPU. I use CyU3PGpifWriteDataWords() and CyU3PGpifReadDataWords() to write and read from the bus and the macro CY_U3P_PIB_GPIF_EGRESS_ADDRESS() to setup the address bus.
Writes are working fine when I use "OUT_REG0_VALID" as my transition equation. For reads I trigger the state machine through the FW_TRG transition by calling the commands CyU3PGpifControlSWInput(CyTrue) and CyU3PGpifControlSWInput(CyFalse). Now there is a relatively long delay between FW_TRG going low again. I need to add a state and the end of my read cycles that wait for !FW_TRG before going back to the IDLE state. Is this how it is supposed to be, when I intend to go through the CPU or is there another way to have quicker trigger mechanism.
In the Auto Master project that comes along with this Application Note, you can find that the counters are initialized after loading and starting the state machine. Also, if you refer to the definitions of the APIs CyU3PGpifInitAddrCounter() and CyU3PGpifInitDataCounter(), you can find that it just stops the counters and then reconfigures it again. So, you can use these APIs after starting the state machine. But, make sure that the previous settings are counted fully when you change the settings so that data is not missed.
I did not understand your second question clearly. Kindly share the GPIF II project and elaborate the question so that I can understand it better.