Skip to content

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

Closed
@s-hadinger

Description

@s-hadinger
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

Activity

lbernstone

lbernstone commented on Jun 14, 2021

@lbernstone
Contributor

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

s-hadinger commented on Jun 14, 2021

@s-hadinger
ContributorAuthor

Thanks, this works fine.

self-assigned this
on Aug 15, 2021
SuGlider

SuGlider commented on Aug 15, 2021

@SuGlider
Collaborator

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

added a commit that references this issue on Aug 23, 2021
b1d072d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @lbernstone@s-hadinger@SuGlider@VojtechBartoska

    Issue actions

      Esp32c3 `Serial.baudRate()` is 2x too high · Issue #5287 · espressif/arduino-esp32