Skip to content

Commit 85cd26e

Browse files
authored
fix(uart): changing assert in order to avoid reset
1 parent 054742b commit 85cd26e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cores/esp32/esp32-hal-uart.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,10 @@ static bool _uartTrySetIomuxPin(uart_port_t uart_num, int io_num, uint32_t idx)
317317
}
318318

319319
// Assign the correct function to the GPIO.
320-
assert(upin->iomux_func != -1);
320+
if (upin->iomux_func == -1) {
321+
log_e("IO#%d has bad IOMUX internal information. Switching to GPIO Matrix UART function.", io_num);
322+
return false;
323+
}
321324
if (uart_num < SOC_UART_HP_NUM) {
322325
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 5, 0)
323326
if (upin->input) {

0 commit comments

Comments
 (0)