_timer_start_oneshot_after kills my application

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

_timer_start_oneshot_after kills my application

Jump to solution
2,494 Views
MQXuser
Contributor III

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

 

0 Kudos
Reply
1 Solution
841 Views
EAI
Contributor IV

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.

 

 

View solution in original post

0 Kudos
Reply
5 Replies
841 Views
MQXuser
Contributor III

Okay, I will reorder my question.

 

How can I start a timer from an interrupt?

0 Kudos
Reply
841 Views
MQXuser
Contributor III
I am at the point where I need to solve this problem. How to start a timer from an interrupt?. Are there logical reasons that prevent my application to use the instruction mentioned into a ISR that I have created?
0 Kudos
Reply
842 Views
EAI
Contributor IV

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.

 

 

0 Kudos
Reply
841 Views
MQXuser
Contributor III

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,

0 Kudos
Reply
841 Views
EAI
Contributor IV

Yes, it should also be documented under traits, but is not. 

It has been reported to the development team.

 

Message Edited by EAI on 2009-10-09 11:58 PM
0 Kudos
Reply