RTOS xTaskCreate, vTaskDelay and the watchdog timer
Posted: Tue Nov 10, 2015 7:59 pm
I'm starting to examine the FreeRTOS support and am playing with starting a task and having it delay for a period of time. My thinking was that when we started a task and it executed a delay, this would cause the task scheduler to run an alternate task (i.e. the ESP8266 processing). However, what I am finding is that the Watch Dog timer is firing. Here is my code:
When it starts, it creates a task (taskConnect). I see the taskConnect task run for about 20 iterrations and then my ESP8266 resets with a WDT timer reset. I had assumed that the vTaskDelay() would have allowed the scheduler to give the rest of the ESP8266 the time it needed to do its work ... but it seems I am missing some concept. Has anyone walked this path before and have any advice to offer?
Code: Select all
#include "esp_common.h"
void taskConnect(void *pData) {
printf("Hello from taskConnect!\n");
int count = 0;
while(1) {
count++;
printf("count - %d\n", count);
//taskYIELD();
vTaskDelay(10);
}
vTaskDelete(NULL);
printf("Task end\n");
}
void user_init(void) {
UART_SetBaudrate(0,115200);
printf("SDK version:%s\n", system_get_sdk_version());
printf("user_init running ...\n");
wifi_set_opmode(NULL_MODE);
xTaskCreate(taskConnect, "taskConnect", 200, NULL, 3, NULL);
}
When it starts, it creates a task (taskConnect). I see the taskConnect task run for about 20 iterrations and then my ESP8266 resets with a WDT timer reset. I had assumed that the vTaskDelay() would have allowed the scheduler to give the rest of the ESP8266 the time it needed to do its work ... but it seems I am missing some concept. Has anyone walked this path before and have any advice to offer?