deepakseshan wrote on Thursday, October 31, 2019:
Hello All,
**#define LED_ON1_TASK_PRIORITY 1
#define HEARTBEAT_TASK_PRIORITY 3
void vLEDon1_Task (void pvParameters) (Task 1)
{
(void) pvParameters;
for(;;)
{
IfxStmDemo_run(); //flashing LED using Micro System timer and Timer Interrupt priority is 10
}
}
void vLEDHeartbeatTask (void pvParameters ) ** (Task 2)*
{
unsigned long xLastFlashTime;
unsigned xFlashRate = 500;
( void ) pvParameters;
// Calculate the LED and flash rate.
portENTER_CRITICAL();
{
//...
}
portEXIT_CRITICAL();
// We need to initialise xLastFlashTime prior to the first call to vTaskDelayUntil().
xLastFlashTime = xTaskGetTickCount();
for(;;)
{
// Delay for half the flash period then turn the LED on.
LED_TOGGLE(3);
vTaskDelayUntil( &xLastFlashTime, xFlashRate );
}
}
xTaskCreate( vLEDon1_Task, “LED ON1”, 128, NULL, LED_ON1_TASK_PRIORITY, NULL ); // task 1 - That functiom flashes LED timer interrupt for 100 ms rate.
xTaskCreate( vLEDHeartbeatTask, “LED”, 128, NULL, HEARTBEAT_TASK_PRIORITY, NULL ); // task 2 - normal toggle using taskdelay()
By looking at the above code, When i try to run the program, Eventhough Task 2 has got Higher RTOS priority, the program Excecutes Task 1 due to STM timer interrupt priority is high as Micro interrupt.
I also tried to introduce Taskdelay() function in Task 1 where both Tasks are stopped running.
I also tried to give both task equal priority but again both tasks stopped working.
Note:- ** #define configKERNEL_INTERRUPT_PRIORITY 2** The RTOS priority number 2 is defined in the Micro interrupt vector table as same priority (2) which is a timer interrupt for running scheduler.
How to manage RTOS interrupts against the Micro interrupt?
Please do not hesitate to ask me for more informationif required.
Kind regads,
Deepak