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/TM4C1294NCPDT: PWM Clock Set TM4C1294

Part Number: TM4C1294NCPDT

Tool/software: Code Composer Studio

Hi All,

I want to use PWM to set the clock  to 24MHz of a fingerprint scanner module.  I have written the following code:

ui32Clock = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ|SYSCTL_OSC_MAIN|SYSCTL_USE_PLL|SYSCTL_CFG_VCO_480),24000000);

PWMClockSet(PWM0_BASE,PWM_SYSCLK_DIV_16);

clockget = PWMClockGet(PWM0_BASE);

The clock frequency I'm  getting is 259.

What parameters or api's should be used to get the PWM frequency to 24MHz.

Regards

Rohit

  • Rohit,
    Read the TivaWare Driverlib manual to better understand. Chapter 21 is all about PWM.
    Your main clock must be a multiple of your desired PWM clock; in this case, that's easy with the TM4C129, simply set it to run at the maximum 120MHz.
    Don't divide the PWM clock (particularly, if you divide by 16 as you did, you already start with something slower than the desired signal, so your goal would prove impossible).
    Coming from 120MHz of main clock, you can easily get 24MHz if you use a period of 5 clicks on PWMGenPeriodSet. As for the duty, you can get 40% if you set PWMPulseWidthSet to 2 cycles.
    From these guidelines and some reading of the manual, you will surely be able to better learn PWM and achieve your goal.
    Regards
    Bruno