Part Number:MSP432E401Y
MSP432P401定时器TA选择外部时钟源TACLK,无法计数。已经根据数据手册配置了GPIO7.2作为TA1CLK,可是当我让一个VP=3.3V,VN=0V,占空比50%的PWM输入到该引脚后,发现,定时器不计数。请问哪个环节出现了错误?
下面是我的配置代码
const Timer_A_ContinuousModeConfig continuousModeConfig = {TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK,// ACLK Clock SourceTIMER_A_CLOCKSOURCE_DIVIDER_1,// ACLK/1 = 32.768khzTIMER_A_TAIE_INTERRUPT_ENABLE,// Enable Overflow ISRTIMER_A_DO_CLEAR// Clear Counter }; int main(void) {/* Stop watchdog timer */MAP_WDT_A_holdTimer();/* Configuring P1.0 as output */MAP_GPIO_setAsOutputPin(GPIO_PORT_P1, GPIO_PIN0);MAP_GPIO_setOutputLowOnPin(GPIO_PORT_P1, GPIO_PIN0);/* Starting and enabling ACLK (32kHz) */MAP_CS_setReferenceOscillatorFrequency(CS_REFO_128KHZ);MAP_CS_initClockSignal(CS_ACLK, CS_REFOCLK_SELECT, CS_CLOCK_DIVIDER_4);/* Configuring Continuous Mode */MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P7,GPIO_PIN2, GPIO_PRIMARY_MODULE_FUNCTION);//设置GPIO复用MAP_Timer_A_configureContinuousMode(TIMER_A1_BASE, &continuousModeConfig);/* Enabling interrupts and going to sleep */MAP_Interrupt_enableSleepOnIsrExit();MAP_Interrupt_enableInterrupt(INT_TA1_N);/* Enabling MASTER interrupts */MAP_Interrupt_enableMaster();/* Starting the Timer_A0 in continuous mode */MAP_Timer_A_startCounter(TIMER_A1_BASE, TIMER_A_CONTINUOUS_MODE);while(1){MAP_PCM_gotoLPM0();} } //****************************************************************************** // //This is the TIMERA interrupt vector service routine. // //****************************************************************************** void TA1_N_IRQHandler(void) {MAP_Timer_A_clearInterruptFlag(TIMER_A1_BASE);MAP_GPIO_toggleOutputOnPin(GPIO_PORT_P1, GPIO_PIN0); }
Yale Li:
您好,定时器不计数的具体现象是什么?比如相关的寄存器(TAxR)是什么状态?还有您PWM频率是多少?
,
tang cheng qian tang:
发现问题了,我信号发生器坏了
,
Yale Li:
好的