Part Number: MSP432P401R
Tool/software: Code Composer Studio
Hi,
I am trying to generate a PWM using Timer A. I set the clock source for timer A as SMCLK and the clock source for SMCLK as DCO clock. I am not getting a PWM signal. The pin 2.4 is always set to high.
Here is the code modification i did for the example given in the resource library:
//![Simple Timer_A Config]
/* Timer_A PWM Configuration Parameter */
Timer_A_PWMConfig pwmConfig =
{
TIMER_A_CLOCKSOURCE_SMCLK,
TIMER_A_CLOCKSOURCE_DIVIDER_1,
6000000,
TIMER_A_CAPTURECOMPARE_REGISTER_1,
TIMER_A_OUTPUTMODE_RESET_SET,
3000000
};
//![Simple Timer_A Config]
int main(void)
{
/* Halting the watchdog */
MAP_WDT_A_holdTimer();
MAP_CS_setDCOCenteredFrequency(CS_DCO_FREQUENCY_12);
//![Simple Timer_A Example]
// Setting MCLK and SMCLK to 12Mhz with DCO clock as the source
// MAP_CS_setReferenceOscillatorFrequency(CS_REFO_128KHZ);
MAP_CS_initClockSignal(CS_MCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1);
MAP_CS_initClockSignal(CS_SMCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1);
// MAP_PCM_setPowerState(PCM_AM_LF_VCORE1);
I simply set the DCO frequency, and then used that as a clock source to for SMCLK in initClockSignal. Also since my base clock is 12 Mhz and I wanted a PWM time period to be 0.5 sec, hence I gave 6000000 as my tick period and 3000000 as my duty cycle tick count (50%).
Can someone help me and let me know where I am going wrong.
Thank you