I would like to know the reason the following code results in INTERRUPT STACK OVERFLOW.
The function is an Edge Triggered Interrupt and problem comes when I try to start a one shot timer.
Timer component is created before with priority 3 and 2000 stack. I have a periodic timer running and 4 interrupts (Edge Triggered Interrupts) can start another timer each. Therefore, I can have 5 timers running at the same time. Problem comes when trying to create the first timer within an interrupt.
static void CleanWiegandDoor1(_timer_id timer_id,pointer event_ptr,uint_32 seconds,uint_32 milliseconds){ Door1Counter = 0; } void DMA_T0_ISR(pointer dummy_param){ if(!Door2Counter){ _timer_start_oneshot_after( CleanWiegandDoor2, 0 , TIMER_KERNEL_TIME_MODE, 50 ); } Door2Counter++; if(Door2Counter >= WiegandBitQty){ Door2Counter = 0; FifoInsertDataID(codeReadD2, 2); //Codigo y La Puerta codeReadD2 = 0; } DTIM_clr_flag(0); return;}
Regards
Solved! Go to Solution.
You can't start a timer from an ISR. The timer component uses a semaphore internally - _time_start waits on the semaphore. You can't wait on a semaphore from an ISR, so therefore you can't call _timer_start from an ISR.
Okay, I will reorder my question.
How can I start a timer from an interrupt?
You can't start a timer from an ISR. The timer component uses a semaphore internally - _time_start waits on the semaphore. You can't wait on a semaphore from an ISR, so therefore you can't call _timer_start from an ISR.
I though I could call that function since it is not specifically mentioned in the list of
"3.10.3.2 Functions That ISRs Should Not Call "
Thank you,
Yes, it should also be documented under traits, but is not.
It has been reported to the development team.