Kernel panic occurs when calling the esp_modem_new_dev function. Problem (esp-modem, when using C language)
Posted: Wed Jun 26, 2024 7:59 am
I am using esp32 devkit v4 + SIM7600E LTE modem HW.
Based on esp-modem's basic example, pppos-example, when run alone, it progresses well, even obtaining an IP.
I am trying to merge this module into an existing project, but it keeps rebooting due to kernel panic.
The current problem appears to be that an error occurs when executing esp_modem_new_dev, a function in esp_modem_c_api.cpp of the esp-modem module.
Since there is no problem when running alone or when executing other parts of the source code, there seems to be a problem with the execution environment or settings of the esp_modem_new_dev() function, but I am not sure the cause.
I need some guidance or advice.
This is the source code of the part where the problem occurs.
This message occurs when a kernel panic occurs before rebooting.
Thanks.
Based on esp-modem's basic example, pppos-example, when run alone, it progresses well, even obtaining an IP.
I am trying to merge this module into an existing project, but it keeps rebooting due to kernel panic.
The current problem appears to be that an error occurs when executing esp_modem_new_dev, a function in esp_modem_c_api.cpp of the esp-modem module.
Since there is no problem when running alone or when executing other parts of the source code, there seems to be a problem with the execution environment or settings of the esp_modem_new_dev() function, but I am not sure the cause.
I need some guidance or advice.
This is the source code of the part where the problem occurs.
Code: Select all
esp_modem_dce_config_t dce_config = ESP_MODEM_DCE_DEFAULT_CONFIG(CONFIG_LTE_MODEM_PPP_APN);
esp_netif_config_t netif_ppp_config = ESP_NETIF_DEFAULT_PPP();
esp_netif_t *esp_netif_ppp = esp_netif_new(&netif_ppp_config);
assert(esp_netif_ppp);
/* Configure the DTE */
esp_modem_dte_config_t dte_config = ESP_MODEM_DTE_DEFAULT_CONFIG();
ESP_LOGI(TAG, "Initializing esp_modem for the SIM7600 module...");
esp_modem_dce_t *dce = esp_modem_new_dev(ESP_MODEM_DCE_SIM7600, &dte_config, &dce_config, esp_netif_ppp);
This message occurs when a kernel panic occurs before rebooting.
Code: Select all
E (403) ESP_MODEM_THROW: esp_modem_netif.cpp:77 ERROR
abort() was called at PC 0x400d9923 on core 0
0x400d9923: esp_modem::throw_if_error(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, int) at F:/[PJTPATH]/managed_components/espressif__esp_modem/include/cxx_include/esp_modem_exception.hpp:86 (discriminator 7)
Backtrace: 0x4008182e:0x3ffb5510 0x400867f9:0x3ffb5530 0x4008c9c9:0x3ffb5550 0x400d9923:0x3ffb55c0 0x400d997d:0x3ffb5620 0x400d7b86:0x3ffb56b0 0x4000x4008182e: panic_abort at C:/Espressif/components/esp_system/panic.c:466
0x400867f9: esp_system_abort at C:/Espressif/components/esp_system/port/esp_system_chip.c:93
0x4008c9c9: abort at C:/Espressif/components/newlib/abort.c:38
0x400d9923: esp_modem::throw_if_error(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, int) at F:/[PJTPATH]/managed_components/espressif__esp_modem/include/cxx_include/esp_modem_exception.hpp:86 (discriminator 7)
0x400d997d: esp_modem::Netif::Netif(std::shared_ptr<esp_modem::DTE>, esp_netif_obj*) at F:/[PJTPATH]/managed_components/espressif__esp_modem/src/esp_modem_netif.cpp:77 (discriminator 3)
0x400d7b86: esp_modem::DCE_T<esp_modem::GenericModule>::DCE_T(std::shared_ptr<esp_modem::DTE> const&, std::shared_ptr<esp_modem::GenericModule>, esp_netif_obj*) at F:/[PJTPATH]/managed_components/espressif__esp_modem/include/cxx_include/esp_modem_dce.hpp:49 (discriminator 3)
d7bec:0x3ffb56e0 0x400d7f5a:0x3ffb5710 0x400d7f8c:0x3ffb5740 0x40x400d7f5a: esp_modem::DCE* esp_modem::dce_factory::Creator<esp_modem::SIM7600>::create<esp_modem::DCE, esp_modem::DCE*>(esp_modem_dce_config const*) at F:/[PJTPATH]/managed_components/espressif__esp_modem/include/cxx_include/esp_modem_dce_factory.hpp:102
0x400d7f8c: esp_modem::DCE* esp_modem::dce_factory::Factory::build_generic_DCE<esp_modem::SIM7600, esp_modem::DCE, esp_modem::DCE*, std::shared_ptr<esp_modem::DTE>, esp_netif_obj*&>(esp_modem_dce_config const*, std::shared_ptr<esp_modem::DTE>&&, esp_netif_obj*&) at F:/[PJTPATH]/managed_components/espressif__esp_modem/include/cxx_include/esp_modem_dce_factory.hpp:264
00d8585:0x3ffb5780 0x400d860d:0x3ffb57a0 0x400d7008:0x3ffb57e0 00x400d860d: esp_modem_new_dev at F:/[PJTPATH]/managed_components/espressif__esp_modem/src/esp_modem_c_api.cpp:54
0x400d7008: modem_Init at F:/[PJTPATH]/components/LTE/modem.c:34
x400d6e73:0x3ffb5860 0x4011076f:0x3ffb5880 0x40087349:0x3ffb58b00x4011076f: main_task at C:/Espressif/components/freertos/app_startup.c:208
0x40087349: vPortTaskWrapper at C:/Espressif/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:134