Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(UART): ESP32 - Cannot change baud rate from 230400 to 460800 with Serial.updateBaudRate() #10641

Open
1 task done
deltecent opened this issue Nov 23, 2024 · 3 comments · May be fixed by #10642
Open
1 task done

(UART): ESP32 - Cannot change baud rate from 230400 to 460800 with Serial.updateBaudRate() #10641

deltecent opened this issue Nov 23, 2024 · 3 comments · May be fixed by #10642
Assignees
Labels
Milestone

Comments

@deltecent
Copy link

deltecent commented Nov 23, 2024

Board

ESP-WROOM-32

Device Description

I have an ESP-WROOM-32 DEV KIT 1 with RX2 and TX2 (Serial2) connected to a MAX3380 RS232 Transceiver.

Hardware Configuration

Nothing else attached to the board.

Version

v3.0.7

IDE Name

Arduino IDE 2.3.3

Operating System

macOS 13.7.1

Flash frequency

80Mhz

PSRAM enabled

yes

Upload speed

921600

Description

#10172 corrects a problem with baud rates above 250K by setting the proper clock source. This functionality only works in Serial.begin() and does not work in Serial.updateBaudRate().

If Serial.begin() is invoked with a baud rate under 250K, the source clock is set to UART_SCLK_REF_TICK, otherwise the source clock is set to UART_SCLK_APB.

If the source clock is set to UART_SCLK_REF_TICK during Serial.begin(), updating the baud rate with Serial.updateBaudRate() to one that requires UART_SCLK_APB will not work because the source clock isn't change.

Sketch

Serial2.begin(230400);
Serial.printf("%d\n", Serial2.baudRate());
// Clock is now UART_SCLK_REF_TICK

Serial2.updateBaudRate(460800);
Serial.printf("%d\n", Serial2.baudRate());
// Clock is still UART_SCLK_REF_TICK

Serial2.end();
Serial2.begin(460800);
Serial.printf("%d\n", Serial2.baudRate());
// Clock is now UART_SCLK_APB

Debug Message

I do not have any debug output as I do not know how to access the current UART source clock setting from the Serial API. I just know Serial2.baudRate() returns baud rates based on the initial `Serial2.begin()` source clock setting.

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@deltecent deltecent added the Status: Awaiting triage Issue is waiting for triage label Nov 23, 2024
@lucasssvaz lucasssvaz added Peripheral: UART and removed Status: Awaiting triage Issue is waiting for triage labels Nov 23, 2024
@SuGlider
Copy link
Collaborator

Yes. correct. Issue confirmed.
It happens with ESP32 and ESP32-S2 only.
Other SoC activate UART using UART_SCLK_XTAL clock source are safe.

Fix on the way.

@SuGlider
Copy link
Collaborator

@deltecent - Please test the PR #10642 and let me know.

@deltecent
Copy link
Author

@SuGlider I am very new to the Arduino IDE environment. Is there documentation on how to test a PR?

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