mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
fix(uart): Avoid division by zero error when calling uart_get_baudrate
If uart_driver_install is not called before uart_get_baudrate, the UART port may not be ready. In such cases, the register values cannot be read out, leading to a division by zero error in uart_ll_get_baudrate. This commit adds a check to ensure the UART port is enabled before attempting to read its registers. Closes https://github.com/espressif/esp-idf/issues/17513
This commit is contained in:
@@ -248,7 +248,7 @@ esp_err_t uart_set_baudrate(uart_port_t uart_num, uint32_t baudrate);
|
||||
* @param baudrate Pointer to accept value of UART baud rate
|
||||
*
|
||||
* @return
|
||||
* - ESP_FAIL Parameter error
|
||||
* - ESP_FAIL Parameter error or the UART port is not enabled
|
||||
* - ESP_OK Success, result will be put in (*baudrate)
|
||||
*
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user