3 Replies Latest reply on May 16, 2017 10:24 PM by nisa

    FX3 - Reset Timer Value to Zero on Complex GPIO

    jessica.stilwell_2099106

      I have an application in which I have generated a PWM signal on GPIO[40] of my FX3 dev board, and I am wrapping this around to GPIO[33].  I have configured GPIO[33] as complex running off of the high frequency timer.  I have an interrupt triggering upon every rising edge of the input signal.  At this rising edge, I would like to reset the timer value to 0.  

         

      Is there an easy way to do this?  I don't see a function in the API reference manual that allows you to do this.

        • 1. Re: FX3 - Reset Timer Value to Zero on Complex GPIO
          nisa

          You will have to reset the timer on the interrupt. I see that GPIO 40 is output, and GPIO 33 is input, corrrect? 

             

          Can you clarify what are you doing on the rising edge on GPIO33? Can you share the GPIO callback function for us to see?

          • 2. Re: FX3 - Reset Timer Value to Zero on Complex GPIO
            jessica.stilwell_2099106

            That is correct.  GPIO[40] is a pulse.  GPIO[33] is receiving that pulse, so I have a jumper connecting the two on my board.  

               

            Just to give you more information... in the source attached, I used the USBBulkLoopManualAdd example, and I'm trying to timestamp the incoming and outgoing packets.  Ultimately, I would like to use an external PPS signal to do this.  So GPIO[40] emulates a PPS signal, and I would like to use the higher frequency timer on complex GPIO[33] to get more resolution on the timing of the packets.

               

            You'll notice that I tried to use the "CyU3PGpioSetComplexConfig" function to reset the timer in the "gpioCallback" function.  I don't believe this is allowed, as you can only call that once at the beginning to set up the GPIO.  I didn't see another API function call to adjust the timer value once it is started.  You can only adjust the threshold and period.  Thoughts?

            • 3. Re: FX3 - Reset Timer Value to Zero on Complex GPIO
              nisa

              I see that you are configuring the GPIO when you are getting a GPIO Callback. Here, you have defined a new structure of type CyU3PGpioComplexConfig_t. The scope of this is limited to the callback function. So, if you want to configure it using a local structure then you will have to define all the component of the structure.