This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS/CC1310: PWM Synchronization

Part Number: CC1310

Tool/software: TI-RTOS

I need to output two synchronized PWM signals through RTOS API.

For getting synchronization, I use TimerSynchronize(GPT0_BASE, TIMER_0A_SYNC | TIMER_0B_SYNC);

But it is not effective.   Register SYNC is alway zero.

How can I do?

Thanks!

  • Hi,

    I have tested it using the PWM example from the SDK on a CC1310 launchpad. You must call TimerSynchronize() after PWM_start(), not before. PWM_start()/stop() enable/disable the timer and hence, the sync information is lost.

    void *mainThread(void *arg0)
    {
        PWM_Handle pwm1 = NULL;
        PWM_Handle pwm2 = NULL;
        PWM_Params params;
    
        /* Call driver init functions. */
        PWM_init();
    
        PWM_Params_init(&params);
        params.dutyUnits = PWM_DUTY_US;
        params.dutyValue = 1500;
        params.periodUnits = PWM_PERIOD_US;
        params.periodValue = 3000;
    
        pwm1 = PWM_open(Board_PWM0, &params);
        assert(pwm1 != NULL);
    
        pwm2 = PWM_open(Board_PWM1, &params);
        assert(pwm1 != NULL);
    
        PWM_start(pwm1);
        usleep(371);
        PWM_start(pwm2);
    
        TimerSynchronize(GPT0_BASE, TIMER_0A_SYNC | TIMER_0B_SYNC);
    
        PWM_setDuty(pwm1, 1000);
        usleep(487);
        PWM_setDuty(pwm2, 500);
    
        for (;;);
    
    }

  • It's alright. Thank you!