paulmurugan wrote on Friday, February 27, 2015:
Hello Together,
Problem: my code is getting crash within few seconds after my activation of timer input capture interrupt
I have used freeRTOS for freescale HCS12X series microcontroller and developed code for periodic tasks and for interrupt task (porting code taken from HCS12_HCS12X_CodeWarrior_OAF).
Interrupt been implemented with handler task support. Syncronization has been implmented via semaphore and queue concept. As of now i have
created three interrupts.
- RTI interrupt for Timer tick generation (RTI- Real Time iInterrupt)
- Timer over flow interrupt for my use. There is no semaphore and queue have been used inside this routine so portYIELD function is not used within the ISR.
- Timer input capture interrupt, used queue concept. It has a handler task to receive the queue and calling some function.
Actually my code is getting crash within few seconds after my activation of timer input capture interrupt(generated square wave using function generator with frequency about 1Hz to 2Khz). i follow the procedure given in freerTOs manual for implementing ISR and handler function. Perhaps i disable the handler funcion to stop receiving the queue data to know portYIELD would be the reason for crash. But still the problem exist.
I have posted my code below.
#define portYIELD() __asm( “swi” );
/* ISR routine */
__interrupt VectorNumber_Vtim1ch4 void ML_Timer1Ch4_ISR (void)
{
portBASE_TYPE pxHigherPriorityTaskWoken;
ML_Timer_ISRHandlerParam p_ISRarameter;
if( TIM1_TIOS_IOS4 == (Bool)0)
{
parameter.timer = TIMER_1;
parameter.channel = CHANNEL_4;
parameter.timer_count = TIM1_TC4;
parameter.overflow= timer1_Overflow[4];
timer1_Overflow[4] = 0;
}
else
{
/* Future use - Code for Output Compare */
}
TIM1_TFLG1|= 0x10;
xQueueSendToBackFromISR (ML_TIMER_CAPTURE_HANDLE, ¶meter, &pxHigherPriorityTaskWoken);
/* Blocked task, waiting for this Queue has priority higher than the interrupted task */
if(pxHigherPriorityTaskWoken == pdTRUE)
{
portYIELD();
}
}
/* ISR hnadler task 3*/
static void ISRHandleQueueFunction (void pvParameters)
{
BaseType_t return_flag;
SL_ISRHandle_Config taskparameter;
/ Accessing task configuration through task parameters */
taskparameter = (SL_ISRHandle_Config )pvParameters;
for(;
{
/ Queue data receive from interrupt service routine */
return_flag = xQueueReceive(taskparameter->handle_name, &taskparameter;portMAX_DELAY);
/* Task calling */
(taskparameter->taskID)(queueBuffdata);
}
}
__interrupt VectorNumber_Vswi void vPortYield (void)
//void vPortYield (void)
{
portSAVE_CONTEXT();
vTaskSwitchContext();
portRESTORE_CONTEXT();
}
/* RTI interrupt for Tiemr tick generation */
__interrupt VectorNumber_Vrti void TimerTick_ISR (void)
{
#if configUSE_PREEMPTION == 1
{
/* A context switch might happen so save the context. /
portSAVE_CONTEXT();
PORTB_PB2=1;
/ Increment the tick … */
if( xTaskIncrementTick() != pdFALSE )
{
vTaskSwitchContext();
}
CRGFLG_RTIF = (Bool)1;
/* Restore the context of a task - which may be a different task
to that interrupted. */
PORTB_PB2=0;
portRESTORE_CONTEXT();
}
#else
{
xTaskIncrementTick();
CRGFLG_RTIF = (Bool)1;
}
#endif
}
Note:I have not used interrupt nesting in my project. configMAX_SYSCALL_INTERRUPT_PRIORITY is not avilable in my project.