esp_modem: Ensure uart_param_config and uart pins are set before uart_driver_install
Fixes Guru Meditation Error: Core 0 panic'ed (LoadProhibited) when config with
CONFIG_PM_ENABLE=y && CONFIG_PM_DFS_INIT_AUTO=y.
Merges
@@ -390,11 +390,6 @@ modem_dte_t *esp_modem_dte_init(const esp_modem_dte_config_t *config)
.source_clk = UART_SCLK_REF_TICK,
.flow_ctrl = (config->flow_control == MODEM_FLOW_CONTROL_HW) ? UART_HW_FLOWCTRL_CTS_RTS : UART_HW_FLOWCTRL_DISABLE
};
- /* Install UART driver and get event queue used inside driver */
- res = uart_driver_install(esp_dte->uart_port, CONFIG_MODEM_UART_RX_BUFFER_SIZE, CONFIG_MODEM_UART_TX_BUFFER_SIZE,
- CONFIG_MODEM_UART_EVENT_QUEUE_SIZE, &(esp_dte->event_queue), 0);
- MODEM_CHECK(res == ESP_OK, "install uart driver failed", err_uart_config);
-
MODEM_CHECK(uart_param_config(esp_dte->uart_port, &uart_config) == ESP_OK, "config uart parameter failed", err_uart_config);
if (config->flow_control == MODEM_FLOW_CONTROL_HW) {
res = uart_set_pin(esp_dte->uart_port, CONFIG_MODEM_UART_MODEM_TX_PIN, CONFIG_MODEM_UART_MODEM_RX_PIN,
@@ -411,6 +406,11 @@ modem_dte_t *esp_modem_dte_init(const esp_modem_dte_config_t *config)
res = uart_set_sw_flow_ctrl(esp_dte->uart_port, true, 8, UART_FIFO_LEN - 8);
}
MODEM_CHECK(res == ESP_OK, "config uart flow control failed", err_uart_config);
+ /* Install UART driver and get event queue used inside driver */
+ res = uart_driver_install(esp_dte->uart_port, CONFIG_MODEM_UART_RX_BUFFER_SIZE, CONFIG_MODEM_UART_TX_BUFFER_SIZE,
+ CONFIG_MODEM_UART_EVENT_QUEUE_SIZE, &(esp_dte->event_queue), 0);
+ MODEM_CHECK(res == ESP_OK, "install uart driver failed", err_uart_config);
+
/* Set pattern interrupt, used to detect the end of a line. */
res = uart_enable_pattern_det_baud_intr(esp_dte->uart_port, '\n', 1, MIN_PATTERN_INTERVAL, MIN_POST_IDLE, MIN_PRE_IDLE);
/* Set pattern queue size */
