cancel
Showing results for 
Search instead for 
Did you mean: 

USB Superspeed Peripherals

New Contributor II

Hi,

How can I set the tick rate to 1 microsecond? I have found one API CyU3PSetTime() to set tick rate but I don't know how can I use it to set 1-microsecond tick rate.

Can anyone please help here?

0 Likes
Reply
1 Solution
Moderator
Moderator

Hello,

Please refer to the following KBA which describes how to change timer tick.

EZ-USB® FX3™ Timer Ticks – KBA93074

From the KBA, it is not possible to change the tick rate to 1-micro seconds. Please let me know what exactly is your need by changing it to 1 micro second. Is it to introduce a small delay?

If your requirement is to add a small delay (of microseconds), then please use the API CyU3PBusyWait(). You can refer to FX3 API Guide to understand more about this API.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna

View solution in original post

0 Likes
Reply
7 Replies
Moderator
Moderator

Hello,

Please refer to the following KBA which describes how to change timer tick.

EZ-USB® FX3™ Timer Ticks – KBA93074

From the KBA, it is not possible to change the tick rate to 1-micro seconds. Please let me know what exactly is your need by changing it to 1 micro second. Is it to introduce a small delay?

If your requirement is to add a small delay (of microseconds), then please use the API CyU3PBusyWait(). You can refer to FX3 API Guide to understand more about this API.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna

View solution in original post

0 Likes
Reply
New Contributor II

My requirement is to measure input pulse on-time using CX3 firmware(I am configuring one GPIO as an input). And the minimum resolution we require is 100 microseconds. It means we may get a minimum of 100 microseconds on-time pulse on that particular GPIO.

0 Likes
Reply
Moderator
Moderator

Hello,

Please let me know if you are using a simple or a complex GPIO in your application. Also, according to the present implementation, how are you checking the time upto which the GPIO stays LOW.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes
Reply
New Contributor II

I am using GPIO19 which is complex GPIO as per my knowledge. Currently, we are unable to check for 100 microseconds pulse.

0 Likes
Reply
Moderator
Moderator

Hello,

Please let me know how you are tracking the time for which the GPIO stays low now. Please share the snippets of that section of the code so that I can understand more on the issue. Also, as per the present implementation, what is the smallest time that you are able to detect?

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes
Reply
New Contributor II

Below is the code snippets of GPIO interrupt callback in which I am tracking pulse high time.

void CyFxGpioIntrCb (

        uint8_t gpioId /* Indicates the pin that triggered the interrupt */

        )

{

    CyBool_t gpioValue = CyFalse;

    CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS;

    unsigned long RisingEdgeTime = 0;

    unsigned long FallingEdgeTime = 0;

    /* Get the status of the pin */

     apiRetStatus = CyU3PGpioGetValue (gpioId, &gpioValue);

     if (apiRetStatus == CY_U3P_SUCCESS)

     {

          /* Check status of the pin */

          if (gpioValue == CyTrue)

          {

               RisingEdgeTime = CyU3PGetTime();

          }

          else

          {

               FallingEdgeTime = CyU3PGetTime();

               CyU3PDebugPrint (4, "Pulse high time time = %u\n", FallingEdgeTime - RisingEdgeTime);

               FallingEdgeTime = 0;

               RisingEdgeTime = 0;

          }

     }

}

0 Likes
Reply
Moderator
Moderator

Hello,

Please try the following steps:

1. Use a simple GPIO which is used to identify the state of the input signal.

2. Use another complex GPIO which is configured as a timer.

3. The API CyU3PGpioComplexSampleNow() can be used to sample the value of the timer at an instant.

Please refer to the following KBA to understand how to configure a complex GPIO for this requirement.

How to Get a 0.1-µs Unit Timestamp with FX3 – KBA220034

Also, I have created a sample project by modifying the SDK example GpioApp for your requirement. Please refer to the same and implement the same in your project. While implementing the same in your project, make sure that you do not use GPIOs that are used for other purposes. Please let us know if you face any issue while measuring the time after implementing this.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes
Reply