AnsweredAssumed Answered

Why is my interrupt hard faulting?

Question asked by Evan Griffith on Aug 8, 2019
Latest reply on Aug 16, 2019 by Evan Griffith



I have a TPM counter that is interrupting and then hard faulting.  I can see the counter increment, I can see the modulous is set correctly, I can see that the interrupt is enabled and that the overflow flag has triggered.  However the interrupt never makes it into the interrupt routine.  I also checked the NVIC ISER and ICER and I can see that bit 17 is set in both.  The interrupt per the KL17 user manual for TPM0 is IRQ17, so that seems correct. 


How can I track down where the fault it coming from?  I am using a PE Micro debugger with MCUxpresso on a MKL17Z64VDA4.


Some of my code:


#define BOARD_TPM TPM0
//#define TPM_SOURCE_CLOCK (CLOCK_GetFreq(kCLOCK_McgIrc48MClk)/4)
#define TPM_SOURCE_CLOCK (CLOCK_GetFreq(kCLOCK_McgInternalRefClk))


void TPM0_IRQHandler(void)
    /* Clear interrupt flag.*/
    TPM_ClearStatusFlags(BOARD_TPM, kTPM_TimeOverflowFlag);
    tpmIsrFlag = true;
    //__ISB();  //Needed?


void initializeTPM()
    tpm_config_t tpmInfo;




    //tpmInfo.prescale = TPM_PRESCALER;      /* TPM clock divide by TPM_PRESCALER */
    TPM_Init(BOARD_TPM, &tpmInfo);        /* Initialize TPM module */
    TPM_SetTimerPeriod(BOARD_TPM, USEC_TO_COUNT(1000U, TPM_SOURCE_CLOCK));    /* Set timer period. */
    TPM_EnableInterrupts(BOARD_TPM, kTPM_TimeOverflowInterruptEnable);
    //TPM_EnableInterrupts(BOARD_TPM, kTPM_Chnl0InterruptEnable);