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.

CCS/LAUNCHXL-CC2640R2: PWM

Part Number: LAUNCHXL-CC2640R2

Tool/software: Code Composer Studio

Hello!

I use cc2640r2 sdk with pwm driver. I want to start low - frequency pwm(about 5Hz), but i couldn't with standart fucntions : PWM_start().

So i have a question - what are the boundaries of possible frequencies - from what can i start and to what can i go up?

And what have i do if i need pwm period 1 ms and duty 0.5 ms?

Best regards, Dmitriy.

  • Try to use the following code for 5Hz PWM.

        PWM_Handle pwm1 = NULL;
        PWM_Params params;
    
        /* Call driver init functions. */
        PWM_init();
    
        PWM_Params_init(&params);
    
        params.idleLevel = PWM_IDLE_LOW; // Output low when PWM is not running
        params.periodUnits = PWM_PERIOD_HZ; // Period is in Hz
        params.periodValue = 5; // 5Hz
        params.dutyUnits = PWM_DUTY_FRACTION; // Duty is in fractional percentage
        params.dutyValue = (uint32_t) (((uint64_t) PWM_DUTY_FRACTION_MAX * 50) / 100);; // 50% initial duty cycle
    
        pwm1 = PWM_open(Board_PWM0, &params);
        if (pwm1 == NULL) {
            /* Board_PWM0 did not open */
            while (1);
        }
        PWM_start(pwm1);
    

  • Please see the documentation of the driver:

    dev.ti.com/.../

    Siri