Part Number: MSP432P401R [MSP432] P5.6 TIMER_A2 hgih frequency PWM generation . Hi, I have to generate various PWM frequencies through P5.6 from 1Hz to 3MHz but I can't generate frequencies more than 24kHz. Please review the setting values below and please provide me a way to generate high frequency PWM on P5.6. SMCLK set : MAP_CS_initClockSignal(CS_SMCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1 ); Timer contorol : TASSEL= SMCLK, ID = 0, EX=0. ..... { PWM_Disable_P5P6_7(_pin); TIMER_A2->CCR[0] = _period; // PWM Period/2 switch(_pin){ case 6:/* Configuring GPIO2.6 as peripheral output for PWM */ TIMER_A2->CCTL[1] = TIMER_A_CCTLN_OUTMOD_6; // CCR3 toggle/set TIMER_A2->CCR[1] = _duty; // CCR3 PWM duty cycle TIMER_A2->CCR[2] = _duty; // CCR4 PWM duty cycle break; case 7:/* Configuring GPIO2.7 as peripheral output for PWM */ TIMER_A2->CCTL[2] = TIMER_A_CCTLN_OUTMOD_6; // CCR4 toggle/set TIMER_A2->CCR[2] = _duty; // CCR4 PWM duty cycle break; } TIMER_A2->EX0 = ex; TIMER_A2->CTL = ((clk & 0x03) DIR |= BIT6 ; // P5.6 - output P5->SEL0 |= BIT6 ; // P5.6 - Port Map functions P5->SEL1 &= ~(BIT6); // P5.6 - default PM functions = TimerA CCRx break; case 7:/* Configuring GPIO5.7 as peripheral output for PWM */ P5->DIR |= BIT7 ; // P5.7 - output P5->SEL0 |= BIT7 ; // P5.7 - Port Map functions P5->SEL1 &= ~(BIT7); // P5.7 - default PM functions = TimerA CCRx break; } }
↧