Skip to content

esotic UART baudrates won't work (IDFGH-1970) #4166

Closed
@aster94

Description

@aster94

Environment

  • Development Kit: lolin32
  • IDF version lasted used in the arduino framework
  • Operating System: Windows
  • Power Supply: USB

Problem Description

If i set a custom baudrate in the UART it won't work as expected. At first we tought the problem was in the arduino core (espressif/arduino-esp32#2004), but maybe it is not so I have been suggested to open an iussue here

Code to reproduce this issue

#include <Arduino.h>

#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/uart.h"

#define ECHO_TEST_TXD (UART_PIN_NO_CHANGE)
#define ECHO_TEST_RXD (UART_PIN_NO_CHANGE)
#define ECHO_TEST_RTS (UART_PIN_NO_CHANGE)
#define ECHO_TEST_CTS (UART_PIN_NO_CHANGE)

#define BUF_SIZE 1024

void setup()
{
  uart_config_t uart_config = {
      .baud_rate = 10400,
      .data_bits = UART_DATA_8_BITS,
      .parity = UART_PARITY_DISABLE,
      .stop_bits = UART_STOP_BITS_1,
      .flow_ctrl = UART_HW_FLOWCTRL_DISABLE};
  uart_param_config(UART_NUM_2, &uart_config);
  uart_set_pin(UART_NUM_2, ECHO_TEST_TXD, ECHO_TEST_RXD, ECHO_TEST_RTS, ECHO_TEST_CTS);
  uart_driver_install(UART_NUM_2, BUF_SIZE * 2, 0, 0, NULL, 0);
}

void loop()
{
  const char *data = "test";
  uart_write_bytes(UART_NUM_2, data, 5);
  delay(2);
}

And here there are two logic analyzer data, the esp-idf.sr comes from the code above
test.zip

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions