Skip to content

Commit

Permalink
fix: Fixes ESP32 and ESP32-S2 uartGetBaudrate() with CPU Freq lower t…
Browse files Browse the repository at this point in the history
…han 80MHz
  • Loading branch information
SuGlider authored Feb 17, 2024
1 parent 958da19 commit 886e898
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cores/esp32/esp32-hal-uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,12 @@ uint32_t uartGetBaudRate(uart_t* uart)

UART_MUTEX_LOCK();
uint32_t baud_rate = uart_ll_get_baudrate(UART_LL_GET_HW(uart->num));
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2
uint32_t Freq = getApbFrequency()/1000000;
if (Freq < 80) {
baud_rate = baud_rate / (80 / Freq);
}
#endif
UART_MUTEX_UNLOCK();
return baud_rate;
}
Expand Down

0 comments on commit 886e898

Please sign in to comment.