Part Number: MSPM0G3507
Tool/software:
Hey.
I am trying to synchronize some control logic in my code to the CCD1 event of TIMA1.
So I am running a function where I enable this interrupt:
static inline void load_test(uint32_t load_value)
{
GPIOB->DOUTTGL31_0 = DL_GPIO_PIN_3;
// insert control logic here.
// Clear any previous IRQ, then enable.
TIMA1->CPU_INT.IIDX;
TIMA1->CPU_INT.IMASK = DL_TIMER_EVENT_CC1_DN_EVENT;
GPIOB->DOUTTGL31_0 = DL_GPIO_PIN_3;
}
Then in the ISR I disable the interrupt again:
void TIMA1_IRQHandler()
{
GPIOB->DOUTTGL31_0 = DL_GPIO_PIN_17;
// Disable this IRQ
TIMA1->CPU_INT.IIDX;
TIMA1->CPU_INT.IMASK = 0;
// Insert some control logic here.
GPIOB->DOUTTGL31_0 = DL_GPIO_PIN_17;
}
The NVIC is enabled in the main code:
I dont quite understand why - my thinking is it could be pending interrupts, but I assume they are cleared by reading the IIDX register.