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.

Generating PWM of lower frequency in CC2541

The users guide says that the lowest possible frequency possible using the various pre-scalars is 1953.125Hz. But i need to produce a pwm at around 400 hz. So is there is any way possible to produce pwm frequencies which are lower than 1953.125 Hz

  • Hello Karnaty,

    You could use the timer with an interrupt to count at a multiple of the 400Hz and then toggle the pin.

    I do recall being able to get lower frequencies around 250Hz by playing with all the modes and clock prescalars.  This may have been without the BLE stack though.

    There are example on the web that provide code for generation your own PWM through software for low frequencies.

    Thanks,

  • The user guide states "Thus, the lowest clock frequency used by Timer 1 is 1953.125 Hz" (page 108).
    This refers to the Timer 1 input clock frequency, not the PWM output frequency.

    Given a 32 mHz system clock and global prescaler of 0, a Timer 1 prescaler of 128 results in 250 kHz timer tick.  A timer count of 625 will result in a 400 Hz output signal.

  • Thanks Richard for the actual count number.  

    I do recall the wordling of that section causing me some confusion before making changes to the registers and measuring the actual frequencies.

    Thanks,

  • Now I remember the issue with obtaining a low frequency PWM.  The clock prescaler (Global as Richard mentioned) affects ALL timers which causes serious problems when running other timed events.  I had to do the PWM in software for a low frequency output in order to use the PWM on other Timers and channels.