Other Parts Discussed in Thread: MSP430FR6047
Hi,
I´m currently working with a EVM430-FR6047 with a MSP430FR6047 Controller and want to configure a timer to generate a periodical interrupt. My problem is, that the controller doesn´t enter the interrupt service routine. I have configured the timer in the following way, whereat the Timer_A0_Init() function is called in the main function before the while(1) loop:
void Timer_A0_Init(void){
Timer_A_initUpModeParam timerAParam;
timerAParam.clockSource = TIMER_A_CLOCKSOURCE_SMCLK;
timerAParam.clockSourceDivider = TIMER_A_CLOCKSOURCE_DIVIDER_8;
timerAParam.timerPeriod = 10000;
timerAParam.timerInterruptEnable_TAIE = TIMER_A_TAIE_INTERRUPT_ENABLE;
timerAParam.captureCompareInterruptEnable_CCR0_CCIE = TIMER_A_CCIE_CCR0_INTERRUPT_DISABLE;
timerAParam.timerClear = TIMER_A_SKIP_CLEAR;
timerAParam.startTimer = true;
Timer_A_initUpMode(TA0_BASE, &timerAParam);
Timer_A_enableInterrupt(TA0_BASE);
Timer_A_startCounter(TA0_BASE, TIMER_A_UP_MODE);
}
The interrupt service routine where currently just try to toggle a LED and a Port-Pin is the following:
#pragma vector=TIMER0_A0_VECTOR
__interrupt void Timer_A0_ISR(void) {
if(LEDisOn == 1) {
LEDisOn = 0;
hal_system_LEDOff(HAL_SYS_LED_1);
GPIO_setOutputLowOnPin(GPIO_PORT_P7, GPIO_PIN5);
} else {
LEDisOn = 1;
hal_system_LEDOn(HAL_SYS_LED_1);
GPIO_setOutputHighOnPin(GPIO_PORT_P7, GPIO_PIN5);
}
Timer_A_clearTimerInterrupt(TA0_BASE);
}
By debuging the program I found out that the program doesn´t enter the service routine but repeatedly starts from the beginning of the main function.
My guess is that i do not have the right interrupt vector. I´ve tried many other timer interrupt vectors defined in the appropriate header file but nothing worked.
For the sake of completeness here my main function:
int main(void)
{
WDTCTL = WDTPW + WDTHOLD;
hal_system_Init();
hal_uart_Init();
Timer_A0_Init();
GPIO_setAsOutputPin(GPIO_PORT_P7,GPIO_PIN5);
while (1)
{
...
}
}
Thanks in advance and best regards