Boss lady
Boss lady
DIIDevHeads IoT Integration Server
Created by Boss lady on 6/5/2024 in #middleware-and-os
How to identify and resolve the issue causing the task to miss its deadline?
@Middleware & OS Hey guys In my FreeRTOS application, a specific task occasionally misses its deadline, causing system instability. I would like to know what tools or techniques I can use to monitor, profile, or adjust the priority of this task to identify the root cause and prevent these deadline misses from happening. Here is the code for the task with the deadline misses: void vTask1(void *pvParameters) { for(;;) { // Simulate work vTaskDelay(pdMS_TO_TICKS(200)); } }
I have also added a task to monitor the execution time:

void vTaskMonitor(void *pvParameters) {
TickType_t xLastWakeTime;
for(;;) {
xLastWakeTime = xTaskGetTickCount();
vTaskDelayUntil(&xLastWakeTime, pdMS_TO_TICKS(1000));

if (xLastWakeTime > pdMS_TO_TICKS(1000)) {
printf("Task missed its deadline\n");
}
}
}
I have also added a task to monitor the execution time:

void vTaskMonitor(void *pvParameters) {
TickType_t xLastWakeTime;
for(;;) {
xLastWakeTime = xTaskGetTickCount();
vTaskDelayUntil(&xLastWakeTime, pdMS_TO_TICKS(1000));

if (xLastWakeTime > pdMS_TO_TICKS(1000)) {
printf("Task missed its deadline\n");
}
}
}
here is how I created and started the tasks: void main(void) { xTaskCreate(vTask1, "Task 1", 1000, NULL, 1, NULL); xTaskCreate(vTaskMonitor, "Task Monitor", 1000, NULL, 2, NULL); vTaskStartScheduler(); } Can anyone please provide guidance on how to identify and resolve the issue causing the task to miss its deadline?
5 replies