UART Baud Rate

robbym
Posts: 4
Joined: Tue Mar 28, 2017 1:00 am

UART Baud Rate

Postby robbym » Tue Aug 29, 2017 3:51 pm

I am having trouble settings UART_NUM_1's baudrate to 5000000.
I am trying to set it with param_config and set_baudrate, but neither work. Calling uart_set_baudrate with 5000000 causes a panic.
Am I missing a step to the ritual?

Code: Select all

const uart_config_t uart_config = {
        .baud_rate = 5000000,
        .data_bits = UART_DATA_8_BITS,
        .parity = UART_PARITY_DISABLE,
        .stop_bits = UART_STOP_BITS_1,
        .flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
};

    ESP_ERROR_CHECK( uart_param_config(UART_NUM_1, &uart_config) );
    ESP_ERROR_CHECK( uart_set_baudrate(UART_NUM_1, 5000000) );
    ESP_ERROR_CHECK( uart_set_pin(UART_NUM_1, 17, 16, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE) );

    ESP_ERROR_CHECK( uart_driver_install(UART_NUM_1, 1024, 1024, 0, NULL, 0) );

robbym
Posts: 4
Joined: Tue Mar 28, 2017 1:00 am

Re: UART Baud Rate

Postby robbym » Thu Aug 31, 2017 2:15 am

Another thing I should mention is that if I just use uart_set_params, and not uart_set_baudrate, then it doesn't panic, but it starts at 115200 regardless of what I set the config to.

ESP_Sprite
Posts: 9772
Joined: Thu Nov 26, 2015 4:08 am

Re: UART Baud Rate

Postby ESP_Sprite » Thu Aug 31, 2017 2:58 am

Hm. Looking at the code, the fuctions you call should have indicated they don't like your parameters by returning an ESP_FAIL argument. Can you post the panic and if possible a backtrace here? I see nothing in the function that causes that specific function to panic. If any, I think we have an off-by-one error in the uart code: can you try setting a baud rate of 499999 instead?

Who is online

Users browsing this forum: Baidu [Spider] and 88 guests