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.

CC2640R2F: PWM output frequency is not accurate

Part Number: CC2640R2F


Hi,

SDK5.10

I want to use CC2640r2f to generate 2.048MHz PWM wave, but the output frequency is not accurate (it is 2.08696MHz).
The codes and test diagram are as follows:

PWM_Handle PWMHandleCLK;
PWM_Params PWMparams;
void HwPWMInit(void)
{
PWM_init();
PWM_Params_init(&PWMparams);
//RED
PWMparams.idleLevel = PWM_IDLE_LOW;
PWMparams.periodUnits = PWM_PERIOD_HZ;
PWMparams.periodValue = 2048000;
PWMparams.dutyUnits = PWM_DUTY_FRACTION;
PWMparams.idleLevel = PWM_IDLE_LOW;
PWMparams.dutyValue = (uint32_t) (((uint64_t) PWM_DUTY_FRACTION_MAX * 50) / 100);
PWMHandleCLK = PWM_open(EEG_BOARD_PWM0, &PWMparams);

// PWM_start(PWMHandleCLK);

Could you help test it and provide the picture?

Thanks

  • Hi Jerry,

    The output given by the CC2640R2F makes sense given the resolution of the PWM timer.  The timer is sourced from the 48 MHz main clock (max allowed value), so although you want 2,048,000 MHz this allows 48/2.048 = int(23.4375) = 23 cycles to achieve the desired PWM period.  The best this device and TI Driver can achieve under these circumstances is (1/23)*48 = 2,0869,565 MHz which is exactly what is output on the oscilloscope.  I hope this is substantial evidence to show that you will not be able to get a more accurate PWM with these conditions.

    Regards,
    Ryan