Skip to content

CTBot ESP32 && Task watchdog #128

Description

@bosoft-ESP

Hi, I've been trying for a few months to get a 2 core esp32 to not run Task watchdog.
The code has 2 tasks:
task1 in loop core 1: reads 2 pins and handles a flash led with millis().
task2 in Task_2 core 0: only reads and sends Telegram messages. Read is checked every 40 seconds and send is usually every 15 to 20 hours.

The ESP32 is reset from time to time with this information:

E (12865821) task_wdt: Task watchdog got triggered. The following tasks/users did not reset the watchdog in time:
E (12865821) task_wdt: - IDLE0 (CPU 0)
E (12865821) task_wdt: Tasks currently running:
E (12865821) task_wdt: CPU 0: Task_2
E (12865821) task_wdt: CPU 1: loopTask
E (12865821) task_wdt: Aborting.
E (12865821) task_wdt: Print CPU 0 (current core) backtrace	
Rebooting...

After several tests, I think I found the solution: Add in the CTBotSecureConnection.cpp file a vTaskDelay( pdMS_TO_TICKS( 7 ) ) only for ESP32. I only tried 7 and it worked. Other values might work better or worse.

	while (telegramServer.connected()) {
		#if defined ARDUINO_ARCH_ESP32
		vTaskDelay( pdMS_TO_TICKS( 7 ) ) ); <------
		#endif
		while (telegramServer.available()) {
			c = telegramServer.read();
			response += (char)c;
			if (c == ‘\’) {
				// escape character -> read next and skip
				c = telegramServer.read();
				response += (char)c;
				continue;
			}

Regards

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions