2 Replies Latest reply on Jun 20, 2016 3:20 AM by user_373397504

    FX3 ticks are not 1ms

    user_373397504

      The FX3 SDK ticks appear to be 1.024ms, not 1ms.    For example, a test thread thus:

         
          

          int state =0;
          for(;;)
          {
              CyU3PGpioSimpleSetValue(GPIO_STATUS_LED, state);
              state ^=1;
              CyU3PThreadSleep(1000);
          }

         
         

      This toggles the output at 512millihertz.   Changing the sleep to 1024 toggles at the expected 500millihertz.

         

       How can we correct the FX3 setup to tick properly at the documented 1ms?

        • 1. Re: FX3 ticks are not 1ms
          Madhu Lakshmipathy

          Hi,

             

          If you look into the source CyU3PGpioSimpleSetValue API, there are few statements before which the GPIO state is actually written. Those statements are causing the delay.

             

          If you replace this API by the single statement involving the register write, you will achieve the expected frequency.

             

          For making the register write, please refer the source code of the CyU3PGpioSimpleSetValue API. The source code is available aloing with the FX3 SDK in "C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\fx3_sdk_1_3_3_src.zip"

             

          Regards,

             

          - Madhu Sudhan

          • 2. Re: FX3 ticks are not 1ms
            user_373397504

            No, this response is completely incorrect.    The GPIO is not causing the delay (I would be completely horrified if your GPIO API was implemented so poorly as to cause a timeable delay this gross on such a fast CPU!).  The "few statements" you refer to will execute in mere nanoseconds which is an irrelevant amount - I'm talking about a fixed error on the documented clock rate!

               

            If I toggle at 10Hz, I actually toggle at 10.24Hz.   If I toggle at 1Hz, I actually toggle at 1.024Hz.  The delay is constant irrespective of whether or not I use GPIO calls.  The FX3 really is 'ticking' 1024 times each second, not 1000.

               

            It's a little disappointing to receive such a poor (wrong) answer from a Cypress employee.