-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
modem pppos_client idf4.4.7 Not compatible with smart_config process (IDFGH-12876) #576
Comments
Hi @chen-laodi I was able to reproduce the issue and it went away after increasing stack size of the main task. |
@david-cermak Yes, after turning the main task stack size up it seems to be working fine.Thank you |
Hi @david-cermak Adjusting the dte_config.task_stack_size to 8192 did not resolve the issue, despite having plenty of PSRAM space. If you need the complete code, please provide me with your email, and I will send it to you. std::unique_ptr<Terminal> create_uart_terminal(const esp_modem_dte_config *config)
{
TRY_CATCH_RET_NULL(
auto term = std::make_unique<UartTerminal>(config); // this code stack overflow
term->start();
return term;
)
} my code /**
* @brief 初始化蜂窝网
*/
void initialize_cell()
{
// 注册事件回调函数
ESP_ERROR_CHECK(esp_event_handler_register(NETIF_PPP_STATUS, ESP_EVENT_ANY_ID, &event_handler, NULL));
ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, IP_EVENT_PPP_GOT_IP, &event_handler, NULL));
// 配置DCE与PPP netif
esp_modem_dce_config_t dce_config = ESP_MODEM_DCE_DEFAULT_CONFIG("internet");
esp_netif_config_t netif_ppp_config = ESP_NETIF_DEFAULT_PPP();
ppp_netif = esp_netif_new(&netif_ppp_config);
// 配置DTE
esp_modem_dte_config_t dte_config = ESP_MODEM_DTE_DEFAULT_CONFIG();
dte_config.uart_config.tx_io_num = MODEM_TX_IO_NUM;
dte_config.uart_config.rx_io_num = MODEM_RX_IO_NUM;
dte_config.uart_config.flow_control = ESP_MODEM_FLOW_CONTROL_NONE;
dte_config.uart_config.rx_buffer_size = 1024;
dte_config.uart_config.tx_buffer_size = 512;
dte_config.uart_config.event_queue_size = 30;
dte_config.task_stack_size = 2048;
dte_config.task_priority = 5;
dte_config.dte_buffer_size = 512;
dce = esp_modem_new_dev(ESP_MODEM_DCE_SIM7600, &dte_config, &dce_config, ppp_netif);
// 调制解调器切换为AT模式,检查SIM状态
int rssi, ber;
char imsi[32], imei[32];
if (esp_modem_set_mode(dce, ESP_MODEM_MODE_COMMAND) != ESP_OK ||
esp_modem_get_imsi(dce, imsi) != ESP_OK ||
esp_modem_get_imei(dce, imei) != ESP_OK ||
esp_modem_get_signal_quality(dce, &rssi, &ber) != ESP_OK)
{
ESP_LOGE(TAG, "Failed to initialize modem");
no_modem_module();
return;
}
ESP_LOGI(TAG, "IMSI=%s,IMEI=%s,RSSI=%d,BER=%d", imsi, imei, rssi, ber);
// 调制解调器切换为数据模式
esp_err_t err = esp_modem_set_mode(dce, ESP_MODEM_MODE_DATA);
if (err != ESP_OK)
{
ESP_LOGE(TAG, "esp_modem_set_mode(ESP_MODEM_MODE_DATA) failed with %d", err);
return;
}
} log
|
The issue is happening in |
I am indeed using esp_timer, but the exception is not generated by esp_timer itself. I created a timer synchronously during the initialization of PHY. If it detects that the Ethernet cable has not been inserted within 10 seconds, it then shuts down the PHY and starts the MODEM. Due to the insufficient detail in the output logs, I am unable to fully pinpoint the problem. However, I am quite certain that the stack overflow occurs when executing this line: dce = esp_modem_new_dev(ESP_MODEM_DCE_SIM7600, &dte_config, &dce_config, ppp_netif); phy init code void initialize_eth(bool start_timer)
{
// 注册eth插入监听计时器
if (start_timer)
{
const esp_timer_create_args_t timer_args = {
.callback = &no_eth_timer_callback,
.name = "no_eth_timer"};
ESP_ERROR_CHECK(esp_timer_create(&timer_args, &no_eth_timer));
}
// 为以太网创建新的 esp-netif 默认实例
esp_netif_config_t cfg = ESP_NETIF_DEFAULT_ETH();
eth_netif = esp_netif_new(&cfg);
// 初始化 MAC 配置
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
mac_config.smi_mdc_gpio_num = ETH_MDC_GPIO;
mac_config.smi_mdio_gpio_num = ETH_MDIO_GPIO;
eth_mac_t = esp_eth_mac_new_esp32(&mac_config);
// 初始化 PHY 配置
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
phy_config.phy_addr = ETH_PHY_ADDR;
phy_config.reset_gpio_num = ETH_PHY_RST_GPIO;
eth_phy_t = esp_eth_phy_new_ip101(&phy_config);
// 安装 ETH 驱动
esp_eth_config_t config = ETH_DEFAULT_CONFIG(eth_mac_t, eth_phy_t);
esp_err_t ret = esp_eth_driver_install(&config, ð_handle);
if (ret != ESP_OK)
{
ESP_LOGE(TAG, "Ethernet driver installation failed with error: %s", esp_err_to_name(ret));
return;
}
// 将以太网驱动程序附加到 TCP/IP 堆栈
s_eth_glue = esp_eth_new_netif_glue(eth_handle);
ESP_ERROR_CHECK(esp_netif_attach(eth_netif, s_eth_glue));
// 注册用户定义的事件处理程序
ESP_ERROR_CHECK(esp_event_handler_register(ETH_EVENT, ESP_EVENT_ANY_ID, &event_handler, NULL));
ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, IP_EVENT_ETH_GOT_IP, &event_handler, NULL));
// 启动以太网驱动程序状态机
ESP_ERROR_CHECK(esp_eth_start(eth_handle));
} no_eth_timer_callback /**
* @brief 网线插入定时器回调函数
* 若10s内没有插入网线,则关闭eth开启调制解调器
*/
static void no_eth_timer_callback(void *arg)
{
// 取消注册事件处理程序
ESP_ERROR_CHECK(esp_event_handler_unregister(IP_EVENT, IP_EVENT_ETH_GOT_IP, &event_handler));
ESP_ERROR_CHECK(esp_event_handler_unregister(ETH_EVENT, ESP_EVENT_ANY_ID, &event_handler));
// 卸载ETH
ESP_ERROR_CHECK(esp_eth_stop(eth_handle));
ESP_ERROR_CHECK(esp_eth_del_netif_glue(s_eth_glue));
ESP_ERROR_CHECK(esp_eth_driver_uninstall(eth_handle));
eth_phy_t->del(eth_phy_t);
eth_mac_t->del(eth_mac_t);
esp_netif_destroy(eth_netif);
no_eth_timer = NULL;
// 失能PHY
gpio_set_level(ETH_PHY_RST_GPIO, 0);
vTaskDelay(pdMS_TO_TICKS(2000));
// 开启modem
initialize_cell();
} |
Hi @david-cermak |
Answers checklist.
General issue report
Problem Description
When using idf4.4.7 ppp to access the Internet, there is an incompatibility problem when starting wifi smart_config at the same time. When switching to idf5.2.1, it can run normally. Is it probably caused by freeRTOS?
After transplanting the pppos_client routine to my project, mqtt sending data and voip receiving calls will also cause this exception. The cost of migrating my project based on idf4.4.7 to idf5.x is very high.
In the attached test code I roughly identified the code that caused the problem
uxBits = xEventGroupWaitBits(s_wifi_event_group, CONNECTED_BIT | ESPTOUCH_DONE_BIT, true, false, portMAX_DELAY);
, but I did not have the ability to solve itDebug Logs
pppos_client.zip
The text was updated successfully, but these errors were encountered: