I'm currently facing an issue with my Real-Time Operating System setup, and I'm seeking your expertise to help me troubleshoot and resolve the problem.
Problem Description:
After configuring and adding 6-7 tasks in my RTOS application, I am encountering an unexpected behavior where only 5 tasks seem to be executing properly. I have already adjusted the stack size and configured the priorities for each task, but the issue persists.
Configuration Details:
- RTOS:FreeRTOS v10.0.0
- Tasks Added: TASKS 7 added
- Stack Size Adjusted: #define configMINIMAL_STACK_SIZE ((uint16_t)64)
- Priority Configured:#define configMAX_PRIORITIES (15).
Code Snippet:
#include <atmel_start.h>
#include <stdlib.h>
#include <string.h>
TaskHandle_t Can_sleep_handle;
TaskHandle_t Can_Read_handle;
TaskHandle_t Can_write_handle;
TaskHandle_t Task3_handle;
TaskHandle_t Task4_handle;
TaskHandle_t Task5_handle;
void Task3()
{
while (1)
{
printf("Task4\n");
vTaskDelay(1000);
}
}
void Task4()
{
while (1)
{
printf("Task5\n");
vTaskDelay(2000);
}
}
void Task5()
{
while (1)
{
printf("Task6\n");
vTaskDelay(7000);
}
}
void Can_Read()
{
while (1)
{
printf("TASK1\n");
vTaskDelay(100);
}
}
void can_sleep()
{
while (1)
{
printf("TASK3\n");
vTaskDelay(1000);
}
}
void Can_write()
{
while (1)
{
printf("TASK2\n");
vTaskDelay(100);
}
}
int main(void)
{
atmel_start_init();
xTaskCreate(Can_write, "Can_write", configMINIMAL_STACK_SIZE, NULL, 2, &Can_write_handle);
xTaskCreate(Can_Read, "Can_Read", configMINIMAL_STACK_SIZE, NULL, 1, &Can_Read_handle);
xTaskCreate(can_sleep, "can_sleep", configMINIMAL_STACK_SIZE, NULL, 3, &Can_sleep_handle);
xTaskCreate(Task3, "Task3", configMINIMAL_STACK_SIZE, NULL, 4, &Task3_handle);
xTaskCreate(Task4, "Task4", configMINIMAL_STACK_SIZE, NULL, 5, &Task4_handle);
xTaskCreate(Task5, "Task5", configMINIMAL_STACK_SIZE, NULL, 6, &Task5_handle);
vTaskStartScheduler();
while (1) {
}
}