3 Replies Latest reply on Nov 16, 2018 1:51 AM by hman

    inserting constant value to buffer in GPIF state machine


      Dear Cypress,


      I would like to use Cypress FX3 CYUSB3014 with GPIF to translate data via 32-bit bus from external peripheral device to USB Endpoint every clock. Is it possible to insert magic word like 0xAAAAAAAA when for example on my additional signal FlagA or something else the rising edge will  appeared. In other word I want to implement trigger due to mixing Data with my unique (magic) word?

                                  Data on USB Endpoint

      clock cylcle 1  => Data1

      clock cycle 2  => Data2

      after cycle 2 I assert  FlagA to "1" and want to have

      clock cycle 3 =>  0xAAAAAAA

      and after again

      clock cycle 4 = > Data3

      clock cycle 5 => Data4


      Which "action" does this in GPIF designer?


      Could you provide any example.


      Thank you.

        • 1. Re: inserting constant value to buffer in GPIF state machine



          - From your description what I understand is that - whenever the external peripheral sends a pattern like 0xAAAAAAAA to FX3, you need to trigger a GPIO.


          If above is your requirement you can try CMP_DATA action in GPIF designer. For example, see below:

          In the above state machine, when the data sampled is 0xAAAAAAAA then the state transition happens from STATE1 to STATE0. In STATE0, a GPIO is driven high and data is also sampled on the DQ bus. Note that in the above state machine, STATE1 is executed repeatedly until the data match happens.

          Please modify your state machine accordingly to try CMP_DATA




          • 2. Re: inserting constant value to buffer in GPIF state machine

            Dear hman,


            Sorry if my issue explanation was not clear, I meant the situation when on input FlagA rising edge was detected I want to insert a one specific word 0xAAAAAAAA to dma data stream and after this word data stream from 32-bit data bus should be continued until new rising edge on FlagA appeared. In other words I want to add 0xAAAAAAAA to buffer which is used for data traslation from 32-bit bus to DMA Channel.


            Thank you.

            • 3. Re: inserting constant value to buffer in GPIF state machine



              One way I could think of is:

              - Configure your dma channel in such a way that you leave 4 bytes footer. (And the channel should be Manual)

              - In a normal scenario when there is no Flag input assertion, as you get the producer events you just commit the buffer with size dmaBuffer.count (Note that you are not filling in the footer)

              - When GPIF sees the trigger on a input pin, INTR_CPU action can be used to transfer the control to the firmware and in the firmware you can add footer and commit the buffer.

              - After this GPIF state machine resumes which resumes sampling data.


              But the limitation with this approach:

              Your data stream will be as below:

              clock1: data1

              clock2: data2

              clock3 to clock15 (for example)

              clock16: data3


              So, will you have some time between data2 and data3 to do the above operation.


              OR if you are using counters in your GPIF state machine while sampling data (like AN75779 firmware) then I can suggest one more method which can be tried. Please let me know which state machine are you using.