Skip to content

Esp32c3 Serial.baudRate() is 2x too high #5287

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

Closed
s-hadinger opened this issue Jun 14, 2021 · 3 comments · Fixed by #5549
Closed

Esp32c3 Serial.baudRate() is 2x too high #5287

s-hadinger opened this issue Jun 14, 2021 · 3 comments · Fixed by #5549
Assignees

Comments

@s-hadinger
Copy link
Contributor

Hardware:

Board: ESP32-C3-DevKitM-1
Core Installation version: 2.0.0 alpha1
IDE name: Platform.io
Flash Frequency: 40Mhz
PSRAM enabled: no
Upload Speed: 115200
Computer OS: Mac OSX

Description:

Describe your problem here

The baudrate returned by Serial.baudRate() is twice the expected value.

The Serial port is opened with 115200, but Serial.baudRate() returns ~230400.

Sketch: (leave the backquotes for code formatting)

#include <Arduino.h>

void setup() {
  Serial.begin(115200);
}

void loop() {
  Serial.printf(">> Serial baudrate: %d\n", Serial.baudRate());
  delay(1000);
}
// Output:
// >> Serial baudrate: 230423
@lbernstone
Copy link
Contributor

lbernstone commented Jun 14, 2021

Yes, uart needs to be rewritten. This should be a workaround until then:

#include <driver/uart.h>
void setup() {
  Serial.begin(115200);
  uint32_t br;
  uint8_t s_port = 0;
  uart_get_baudrate(s_port, &br);
  Serial.println(br);
}

@s-hadinger
Copy link
Contributor Author

Thanks, this works fine.

@SuGlider
Copy link
Collaborator

UART is being refactored to be based on IDF and this issue shall be solved when it is released.

@SuGlider SuGlider reopened this Aug 15, 2021
me-no-dev pushed a commit that referenced this issue Aug 23, 2021
## Summary
This PR is a complete reffactoring of UART Serial Hardware and respective HAL in order to use IDF instead of current Register manipulation approach. 

It  implements Arduino SerialEvent functionality. 

Fix #5287  
Fix #5273 
Fix #5519 
Fix #5247 
Fix #5403
Fix #5429
Fix #5047
Fix #5463
Fix #5362 
Fix #5112  
Fix #5443 

## Impact
It solves many reported issues related to UART.
It was tested and works fine for ESP32, ESP-S2 and ESP32-C3.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants