uart: uart_get_buffered_data_len(1339): uart driver error with multitasking

uneasy
Posts: 2
Joined: Wed Feb 08, 2023 10:27 pm

uart: uart_get_buffered_data_len(1339): uart driver error with multitasking

Postby uneasy » Sat Feb 11, 2023 6:28 pm

I have some code that does uses 3 in total hardware Serial on ESP32-S3

I wanted to put them in tasks for better performance, but that'n I started getting an error as `uart: uart_get_buffered_data_len(1339): uart driver error `

here is some code:

Code: Select all

Logger mainLog;
CanHandler can;
#ifdef LIN_ENABLED
#include "./LinHandler.h"
LinHandler lin;
#endif

TaskHandle_t Task1, Task2;

void setup() {
#ifdef DEBUG
    delay(3000);
#endif
    mainLog.init();
    can.begin(mainLog);
#ifdef LIN_ENABLED
    lin.begin(mainLog, true);
#endif
    xTaskCreatePinnedToCore(linTask, "LinTAsk", 5000, NULL, 2, &Task1, 0);
    xTaskCreatePinnedToCore(canTask, "canTask", 5000, NULL, 2, &Task2, 1);
    // pinMode(YELLOW_LED, OUTPUT);
    // digitalWrite(YELLOW_LED, LOW);
}

void linTask(void* parameter) {
    for (;;) {
        mainLog.writeSerial("Lin Loop\n");
        lin.write();
        delay(2000);
    }
}

void canTask(void* parameter) {
    for (;;) {
        mainLog.writeSerial("Can Loop\n");
        delay(5000);
    }
}
The problem is in the Task1 `linTask` there I use Serial and Serial1, if I comment out Serial1.write, it's all fine.

Any ideas?

Who is online

Users browsing this forum: Baidu [Spider] and 66 guests