K22F10MA interrupts issue

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

K22F10MA interrupts issue

358 Views
aniketmarkande
Contributor III

Hi,

I am working on K22f10MA kinetics controller and also using quantum leaps framework for coding. The question is whenever i get external interrupt once, its going to ISR twice. code and result is given below.

/******* code **********/

uint32_t isr_array[100] ={ 0 };
uint8_t arraycounter = 0;

void IR_PORTC_IRQ_ISR_Handler(void)
{
    isr_array[arraycounter] = PORT_RD_ISFR(PORTC_BASE_PTR);
    arraycounter++;

   INT_SYS_DisableIRQ(g_portIrqId[PORTC_ID]);

   Pit_start();

    PORT_WR_ISFR(PORTC_BASE_PTR, ~0U);

}

note: interrupt is again enabled in timer ISR. Before interrupt is enabled, clearing ISFR register.

/******** results ********/

Name : isr_array
    Details:{4, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4,}

1. Why execution is going into the ISR when no interrupt detected (read 0 from ISFR register), also interrupt flag is cleared.

please help to understand what might be happening?

Thank you in advance.

Regared,

Aniket

Labels (1)
0 Kudos
1 Reply

255 Views
egoodii
Senior Contributor III

You disable the IRQ in the NVIC before clearing the interrupt condition.  This likely sets the 'pending' flag in the NVIC (level-triggered interrupt mode), and while I have no knowledge of the 'INT_SYS_EnableIRQ' process in your environment, I suspect when that is invoked 'later' it fails to clear the pending bit before said actual enable [NVICISERx = 1<<(y%32);] with an appropriate NVICICPRx = 1<<(y%32);

0 Kudos