uart_set_baudrate sets incorrect baud rate
Posted: Mon Mar 21, 2022 9:27 pm
- static QueueHandle_t uart0_queue;
- uart_config_t uart_config = {
- .baud_rate = 115200,
- .data_bits = UART_DATA_8_BITS,
- .parity = UART_PARITY_DISABLE,
- .stop_bits = UART_STOP_BITS_1,
- .flow_ctrl = UART_HW_FLOWCTRL_DISABLE
- };
- // Install UART driver, and get the queue.
- uart_driver_install(UART_NUM_1, 1024, 1024, 20, &uart0_queue, 0);
- uart_param_config(UART_NUM_1, &uart_config);
- vTaskDelay(100 / portTICK_RATE_MS);
- uint32_t baudrate;
- ESP_LOGI("MAIN", "BAUD RATE 0: %d", baudrate);
- uart_get_baudrate(UART_NUM_1, &baudrate);
- ESP_LOGI("MAIN", "BAUD RATE 1: %d", baudrate);
- vTaskDelay(100 / portTICK_RATE_MS);
- uart_set_baudrate(UART_NUM_1, 230400);
- vTaskDelay(100 / portTICK_RATE_MS);
- uart_get_baudrate(UART_NUM_1, &baudrate);
- ESP_LOGI("MAIN", "BAUD RATE 2: %d", baudrate);
- vTaskDelay(100 / portTICK_RATE_MS);
- uart_set_baudrate(UART_NUM_1, 460800);
- vTaskDelay(100 / portTICK_RATE_MS);
- uart_get_baudrate(UART_NUM_1, &baudrate);
- ESP_LOGI("MAIN", "BAUD RATE 3: %d", baudrate);
- vTaskDelay(100 / portTICK_RATE_MS);
- uart_set_baudrate(UART_NUM_1, 921600);
- vTaskDelay(100 / portTICK_RATE_MS);
- uart_get_baudrate(UART_NUM_1, &baudrate);
- ESP_LOGI("MAIN", "BAUD RATE 4: %d", baudrate);
I (857) MAIN: BAUD RATE 0: 0
I (857) MAIN: BAUD RATE 1: 115201
I (1057) MAIN: BAUD RATE 2: 230423
I (1257) MAIN: BAUD RATE 3: 460929
I (1457) MAIN: BAUD RATE 4: 922190
Am I doing something wrong here ?
I am using latest docker image `espressif/idf:release-v4.4` and this is the only code in `app_main()`