I am using MSP430F5529 and MSP430 Driver Library.
As you can see, I set upMode timer configuration, compare mode configuration and enabled the initial interrupts. However, timerA interrupt is not working, I set an indicator whether cod jumps into interrupt or not: ucsFault should be different than 0 if interrupt is working but obviously not. And I don't know where am I doing wrong. I appreciate any help. Regards.
#include "driverlib.h" uint32_t fq_SMCLK = 0; uint32_t ucsFault; void setConf(void); void clockConfiguration(void); int main(void) { WDT_A_hold(WDT_A_BASE); P1DIR |= BIT0; P1OUT &= ~BIT0; clockConfiguration(); setConf(); fq_SMCLK = UCS_getSMCLK(); //__enable_interrupt(); while(1); } void setConf(void) { Timer_A_initUpModeParam upMode = { //uint16_t clockSource; TIMER_A_CLOCKSOURCE_SMCLK, //uint16_t clockSourceDivider; TIMER_A_CLOCKSOURCE_DIVIDER_64, //uint16_t timerPeriod; ((4000000/16/64)/120), //uint16_t timerInterruptEnable_TAIE; TIMER_A_TAIE_INTERRUPT_ENABLE, //uint16_t captureCompareInterruptEnable_CCR0_CCIE; TIMER_A_CCIE_CCR0_INTERRUPT_ENABLE, //uint16_t timerClear; //TIMER_A_DO_CLEAR, TIMER_A_SKIP_CLEAR, //bool startTimer; 1 }; Timer_A_initCompareModeParam comp = { //uint16_t compareRegister; TIMER_A_CAPTURECOMPARE_REGISTER_1, //uint16_t compareInterruptEnable; TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE, //uint16_t compareOutputMode; TIMER_A_OUTPUTMODE_TOGGLE_RESET, //uint16_t compareValue; ((4000000/16/64)/120)*4/5 }; Timer_A_initUpMode(0x0340, &upMode); Timer_A_initCompareMode(0x0340, &comp); Timer_A_enableCaptureCompareInterrupt(0x0340, TIMER_A_CAPTURECOMPARE_REGISTER_1); Timer_A_enableInterrupt(0x0340); Timer_A_startCounter(0x0340, TIMER_A_UP_MODE); } void clockConfiguration(void) { P5SEL |= BIT2+BIT3; // Port select XT2 UCS_initClockSignal(UCS_SMCLK, UCS_XT2CLK_SELECT, UCS_CLOCK_DIVIDER_16); UCS_turnOnXT2(UCS_XT2_DRIVE_4MHZ_8MHZ); UCS_turnOnSMCLK(); UCS_setExternalClockSource(32000, 4000000); UCS_enableClockRequest(UCS_SMCLK); } #pragma vector = TIMER0_A0_VECTOR __interrupt void __isr_Timer_A(void) { ucsFault = 1; switch(TA0IV) { case 0: Timer_A_clearTimerInterrupt(0x0340); Timer_A_clearCaptureCompareInterrupt(0x0340, TIMER_A_CAPTURECOMPARE_REGISTER_0); Timer_A_clearCaptureCompareInterrupt(0x0340, TIMER_A_CAPTURECOMPARE_REGISTER_1); P1OUT |= BIT0; ucsFault = 2; break; case 2: Timer_A_clearTimerInterrupt(0x0340); Timer_A_clearCaptureCompareInterrupt(0x0340, TIMER_A_CAPTURECOMPARE_REGISTER_0); Timer_A_clearCaptureCompareInterrupt(0x0340, TIMER_A_CAPTURECOMPARE_REGISTER_1); P1OUT &= ~BIT0; ucsFault = 3; break; } }