K22F10MA interrupts issue

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

K22F10MA interrupts issue

732 次查看
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

标签 (1)
0 项奖励
回复
1 回复

629 次查看
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 项奖励
回复