Hello,
I have a S32K148EVB-Q176, and I modified the freertos_s32k148 SDK to run a small project. I would like to run 3 tasks at different frequencies.
- Task 1 at 500ms
- Task 2 at 1000ms
- Task 3 at 2000ms
With the sample code below, whenever the scheduler starts, it executes only the task with higher priority and that too only once. In this case, the output on the PE console is always, "Task 3 counter : 1".
What am I missing here?
#include "FreeRTOS.h"
#include "task.h"
#include "timers.h"
#include "sdk_project_config.h"
#include <stdio.h>
//void rtos_start(void);
void task1_500ms(void *parameters);
void task2_1000ms(void *parameters);
void task3_2000ms(void *parameters);
int count1 = 0;
int count2 = 0;
int count3 = 0;
int main(void)
{
//rtos_start();
printf("Hello World\n\n");
xTaskCreate(task1_500ms, "Task1", configMINIMAL_STACK_SIZE, NULL, 1, NULL);
xTaskCreate(task2_1000ms, "Task2", configMINIMAL_STACK_SIZE, NULL, 2, NULL);
xTaskCreate(task3_2000ms, "Task3", configMINIMAL_STACK_SIZE, NULL, 3, NULL);
vTaskStartScheduler();
}
void task1_500ms(void *parameters)
{
while(1)
{
printf("Task 1 counter : %d\n", ++count1);
vTaskDelay(500/portTICK_PERIOD_MS);
}
}
void task2_1000ms(void *parameters)
{
while(1)
{
printf("Task 2 counter : %d\n", ++count2);
vTaskDelay(1000/portTICK_PERIOD_MS);
}
}
void task3_2000ms(void *parameters)
{
while(1)
{
printf("Task 3 counter : %d\n", ++count3);
vTaskDelay(2000/portTICK_PERIOD_MS);
}
}
Thanks!