Getting started with FreeRtos
Posted: Thu Mar 02, 2017 8:09 am
Hi,
I'm new in FreeRtos coding (and coding). I've red tutorials about Freertos and watched videos but my code does not execute like I tkinked.
I use platformio IDE and esp32 devKit
What happend :
a pause, and a lot of :
and then :
I don't understand why this happend. On my mind this should print :
I hope you can explain why we begin by priority 2 and then 1, 3, 4 and why it crashs.
Thanks
Guillaume
I'm new in FreeRtos coding (and coding). I've red tutorials about Freertos and watched videos but my code does not execute like I tkinked.
I use platformio IDE and esp32 devKit
Code: Select all
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "nvs_flash.h"
void task_priority1(void *pvParameter)
{
while(1) {
printf("priority = 1\n");
vTaskDelay(1000
/portTICK_RATE_MS);
}
}
void task_priority2(void *pvParameter)
{
while(1) {
printf("priority = 2\n");
vTaskDelay(1000/portTICK_RATE_MS);
}
}
void task_priority3(void *pvParameter)
{
while(1) {
printf("priority = 3\n");
vTaskDelay(1000/portTICK_RATE_MS);
}
}
void task_priority4(void *pvParameter)
{
while(1) {
printf("priority = 4\n");
vTaskDelay(1000/portTICK_RATE_MS);
}
}
void app_main()
{
system_init();
xTaskCreate(&task_priority1, "priority1", 2048, NULL, 1, NULL);
xTaskCreate(&task_priority2, "priority2", 2048, NULL, 2, NULL);
xTaskreate(&task_priority3, "priority3", 2048, NULL, 3, NULL);
xTaskCreate(&task_priority4, "priority4", 2048, NULL, 4, NULL);
vTaskStartScheduler();
}
Code: Select all
priority = 2
priority = 1
priority = 3
priority = 4
Code: Select all
Register dump:
PC Guru Meditation Error: Core 0 panic'ed (Interrupt wdt timeout on CPU0)
Code: Select all
Register dump:
PC Guru Meditation Error: Core 0 panic'ed (abort)
Backtrace: 0x40084d55:0x3ffc2440 0x00040023:0x3ffc2500 0x40084d55:0x3ffc2520 0x400
850e7:0x3ffc25a0 0x40080f9c:0x3ffc25e0
CPU halted.
Code: Select all
priority = 4
priority = 3
priority = 2
priority = 1
priority = 4
priority = 3
priority = 2
priority = 1
[...]
Thanks
Guillaume