cancel
Showing results for 
Search instead for 
Did you mean: 

USB Superspeed Peripherals

New Contributor

I need to generate clock with frequency changing between 2MHz and 2.2MHz in every 10 periods. I could generate the clean PWM with

    gpioComplexConfig.outValue    = CyFalse;
    gpioComplexConfig.inputEn     = CyFalse;
    gpioComplexConfig.driveLowEn  = CyTrue;
    gpioComplexConfig.driveHighEn = CyTrue;
    gpioComplexConfig.pinMode     = CY_U3P_GPIO_MODE_PWM;
    gpioComplexConfig.intrMode    = CY_U3P_GPIO_NO_INTR;
    gpioComplexConfig.timerMode   = CY_U3P_GPIO_TIMER_HIGH_FREQ;
    gpioComplexConfig.timer       = 0;
    gpioComplexConfig.period      = (93-1);
    gpioComplexConfig.threshold   = (47-1);


    status = CyU3PGpioSetComplexConfig(GPIO_42, &gpioComplexConfig);

But when I use the interrupt as:

gpioComplexConfig.intrMode = CY_U3P_GPIO_INTR_TIMER_ZERO;

I start to get jitters in the clock:

pastedImage_7.png

even when the callback function is empty.

I tried to use CyU3PGpioComplexUpdate() in the callback to change the period,

void onCallback(uint8_t gpio_id) {

            g_timerIntrCount++;

       

            if (g_timerIntrCount == 20){

                CyU3PGpioComplexUpdate(gpio_id, 46, 92);

                g_timerIntrCount = 0;

            }   

            else if (g_timerIntrCount == 10){

                CyU3PGpioComplexUpdate(gpio_id, 46, 93);

            }

}

but the jitters still occur. How can I solve this issue?

0 Likes
Reply
1 Solution
Moderator
Moderator

Hello,

Please refer to this thread: FX3: Fast interrupt timer implementation

The clock skew cannot be avoided when the interrupts are registered.

Thanks,

Yatheesh

View solution in original post

0 Likes
Reply
1 Reply
Moderator
Moderator

Hello,

Please refer to this thread: FX3: Fast interrupt timer implementation

The clock skew cannot be avoided when the interrupts are registered.

Thanks,

Yatheesh

View solution in original post

0 Likes
Reply