drivers: wifi: esp_at: Fix serial receive interrupt can't exit
If a character is received immediately after modem_iface_uart_init called, the modem_iface_uart_isr function will not read the data in the serial port fifo register as the context has not been registered at this time, which will result in the program not being able to exit the interrupt, so the context should registered before the serial port is initialised. Signed-off-by: Hongquan Li <hongquan.prog@gmail.com>
This commit is contained in:
parent
53ae195f0d
commit
41e33573e8
1 changed files with 8 additions and 8 deletions
|
@ -1606,6 +1606,14 @@ static int esp_init(const struct device *dev)
|
||||||
.hw_flow_control = DT_PROP(ESP_BUS, hw_flow_control),
|
.hw_flow_control = DT_PROP(ESP_BUS, hw_flow_control),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* The context must be registered before the serial port is initialised. */
|
||||||
|
data->mctx.driver_data = data;
|
||||||
|
ret = modem_context_register(&data->mctx);
|
||||||
|
if (ret < 0) {
|
||||||
|
LOG_ERR("Error registering modem context: %d", ret);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
ret = modem_iface_uart_init(&data->mctx.iface, &data->iface_data, &uart_config);
|
ret = modem_iface_uart_init(&data->mctx.iface, &data->iface_data, &uart_config);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -1627,14 +1635,6 @@ static int esp_init(const struct device *dev)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
data->mctx.driver_data = data;
|
|
||||||
|
|
||||||
ret = modem_context_register(&data->mctx);
|
|
||||||
if (ret < 0) {
|
|
||||||
LOG_ERR("Error registering modem context: %d", ret);
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* start RX thread */
|
/* start RX thread */
|
||||||
k_thread_create(&esp_rx_thread, esp_rx_stack,
|
k_thread_create(&esp_rx_thread, esp_rx_stack,
|
||||||
K_KERNEL_STACK_SIZEOF(esp_rx_stack),
|
K_KERNEL_STACK_SIZEOF(esp_rx_stack),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue