FX3 changing PWM frequency while running

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
sj_1680686
Level 1
Level 1

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
1 Solution
YatheeshD_36
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

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
1 Reply
YatheeshD_36
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hello,

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

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

Thanks,

Yatheesh

0 Likes