Serial.setTxTimeoutMs() function doesn't work?

ETheLaw
Posts: 2
Joined: Tue Aug 20, 2024 7:01 pm

Serial.setTxTimeoutMs() function doesn't work?

Postby ETheLaw » Tue Aug 20, 2024 7:11 pm

Hello!

I'm working on a couple of different projects using the ESP32 core and Arduino development environment. I have a lot of "Serial.println()" statements in my code for debugging, but the code also needs to work well without the serial monitor connected, and that can at times cause slowness as described here: https://github.com/espressif/arduino-esp32/issues/6983

On one of my projects (an M5Stack M5Dial), I use the fix they suggest which is to put "Serial.setTxTimeoutMs(0);" in the setup function, and it works well.

But on my other project, which runs on an ESP32-WROOM-32 dev board, using that function causes the code not to compile. I've reduced it to this fairly simple sketch:

Code: Select all

void setup() {
    Serial.setTxTimeoutMs(0);
}

void loop() {
  // put your main code here, to run repeatedly:
}
(Seriously, that's all it takes to reproduce this problem)

The compilation error I get is:
K:\ESP32_Serial_SetTXTimeoutIssue\ESP32_Serial_SetTXTimeoutIssue.ino: In function 'void setup()':
K:\ESP32_Serial_SetTXTimeoutIssue\ESP32_Serial_SetTXTimeoutIssue.ino:2:12: error: 'class HardwareSerial' has no member named 'setTxTimeoutMs'; did you mean 'setRxTimeout'?
Serial.setTxTimeoutMs(0);
^~~~~~~~~~~~~~
setRxTimeout

exit status 1

Compilation error: 'class HardwareSerial' has no member named 'setTxTimeoutMs'; did you mean 'setRxTimeout'?
This is using the most recent (3.0.4) version of the ESP32 Arduino board library, but I tried a random older version (2.0.17) and it didn't work either. Interestingly, the M5Dial seems to use version 2.1.1 of the ESP32 library that I don't see available for download in the Arduino IDE?

Anyhow, does anyone have any ideas how I can fix this?

ETheLaw
Posts: 2
Joined: Tue Aug 20, 2024 7:01 pm

Re: Serial.setTxTimeoutMs() function doesn't work?

Postby ETheLaw » Wed Aug 21, 2024 11:45 am

Hey... uh... never mind!

I realized what's going on... the board where the function works has "USB CDC" (or whatever it's called), and the board where the function doesn't work has a plan UART... that apparently doesn't support that function! Case closed.

Who is online

Users browsing this forum: Google [Bot] and 78 guests