-->
Page 1 of 3

RTOS xTaskCreate, vTaskDelay and the watchdog timer

PostPosted: Tue Nov 10, 2015 7:59 pm
by kolban
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:

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?

Re: RTOS xTaskCreate, vTaskDelay and the watchdog timer

PostPosted: Tue Nov 10, 2015 8:56 pm
by martinayotte
I'm anxious to do some followup on Kolban issue.
I'm using RTOS on STM32 without problem, but I didn't yet on ESP since I'm using ArduinoESP (I've even thought porting the RTOS Arduino_STM32 into ArduinoESP, but to much time to spend).
In other world, this is an interesting thread ... ;)

Re: RTOS xTaskCreate, vTaskDelay and the watchdog timer

PostPosted: Thu Nov 12, 2015 1:38 am
by march_seven
martinayotte wrote:I'm anxious to do some followup on Kolban issue.
I'm using RTOS on STM32 without problem, but I didn't yet on ESP since I'm using ArduinoESP (I've even thought porting the RTOS Arduino_STM32 into ArduinoESP, but to much time to spend).
In other world, this is an interesting thread ... ;)



are you sure????

do you find the strncasscmp()? and the stroul()?????

Re: RTOS xTaskCreate, vTaskDelay and the watchdog timer

PostPosted: Thu Nov 12, 2015 3:12 am
by tve
The main task on which user_main ran has a certain priority and now you're running the taskConnect at some other priority. The Espressif Wifi stuff runs on the main task, that's why user_init has to return. Now, if your taskConnect task has a higher priority than the main task, you will starve the wifi processing and hence the wdt fires. At least that's how I'd explain what you observe. You can get and print the task priorities to verify by calling some FreeRTOS function, I believe...