PIT interrupt handler not triggered on KL26Z

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PIT interrupt handler not triggered on KL26Z

481 Views
mihaineken
Contributor I

I have a FRDM-KL26Z board I am trying to use PIT to get an interrupt, but it fails.

Things that I am doing:

- declare the PIT handler that should print a line of text

void PIT_IRQHandler(void)
{
	PRINTF("PIT_IRQHandler \r\n");
}

- set-up PIT

    unsigned int *sim_scgc6 = (unsigned int *) 0x4004803C;
    *sim_scgc6 |= 1U << 23; // enable clock gate PIT

    unsigned int *pit_mcr = (unsigned int *) 0x40037000;
    *pit_mcr &= ~(1U << 1); // enable PIT
    *pit_mcr &= ~(1U << 0); // timer continues in debug mode

    unsigned int *pit_ldval0 = (unsigned int *) 0x40037100;
    // *pit_ldval0 = 0x0003E7FF; // setup timer 1 for 256000 cycles
    *pit_ldval0 = 0xF;

    unsigned int *pit_tctrl0 = (unsigned int *) 0x40037108;
    *pit_tctrl0 |= 1U << 1; // enable interrupt
    *pit_tctrl0 |= 1U; // start timer

- then enter an infinite loop

I am not getting the line from the PIT handler.

I have attached the full code. Is it something that I am missing? In debug mode I see the timer changing and the TIF flag is set, but the handler is not executed.

Labels (2)
0 Kudos
1 Reply

461 Views
CarlosGarabito
NXP TechSupport
NXP TechSupport

You can find some examples of PIT that can guide you on your design on SDK  (https://mcuxpresso.nxp.com/en/welcome)

0 Kudos