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_tcp_client example in esp_modem library is not working with SIM7600G-H and ESP32-S3 (IDFGH-11018) #352
Comments
Need to keep the loopback address here. Update the (I'll move it to Kconfig option to make it clear) esp-protocols/components/esp_modem/examples/modem_tcp_client/main/modem_client.cpp Line 120 in 6c7259f
In the default config ( The other config ( |
Hi David, thank you for the response and I will test this soon and get back to you shortly. |
Using |
I tried the example from here : https://github.com/david-cermak/esp-protocols/tree/master/components/esp_modem/examples/modem_tcp_client |
Also the latest esp-protocol(https://github.com/espressif/esp-protocols/tree/master/components/esp_modem/examples/modem_tcp_client) is giving below failure: `I (817) app_start: Starting scheduler on CPU0 V (2462) command_lib: sync V (3962) command_lib: sync V (5462) command_lib: sync V (6962) command_lib: sync V (8462) command_lib: sync V (9962) command_lib: sync E (10462) sock_dce: Failed to sync up |
You'll have to configure server's certificate or enable:
in esp-tls to allow for TLS handshake without verification (only for testing) The second error just tells you, that the modem doesn't respond to the initial AT commands -- check wires, restart modem, etc... I'd suggest starting with a simple example first, e.g. with pppos_client and after you're familiar with this library, IDF and connection to your device you can get back to this example. |
Hi, D (1063) command_lib: Response: OK D (1063) sock_dce: Modem in sync D (1173) command_lib: Response: OK V (1173) command_lib: set_pdp_context D (1313) command_lib: Response: OK D (1313) sock_dce: PDP configured V (1423) command_lib: Token: {+NETOPEN: 1} V (1423) command_lib: Token: { V (1423) command_lib: Token: {OK} V (1423) sock_commands: +NETOPEN: 1 D (1533) command_lib: Response: OK D (1533) sock_dce: Network opened V (1643) command_lib: Token: {+IPADDR: 10.223.166.7} V (1643) command_lib: Token: { V (1643) command_lib: Token: {OK} I (1653) sock_dce: Got IP +IPADDR: 10.223.166.7 D (1863) command_lib: Response: +CIPCLOSE: 0,4 ERROR V (1963) partition: Loading the partition table OK D (2013) nvs: nvs_open_from_partition ql_storage 0
+CIPOPEN: 0,0 I (2393) sock_commands: Connected! Regarding the modem is not responsive issue, I dont suspect that on HW side issue as it is working with other program. It is only failing with latest esp-modem library. I will debug further and update if I find something new. |
Hi regarding the AT OK issue I debugged with oscilloscope and saw the the signal back and forth in the UART. Any idea to solve this proble? By the way I tested the pppos_client example and it is working as expected. DATA=esp32-pppos I (1903) esp-netif_lwip-ppp: User interrupt But when I try to call esp-tls it is failing and throwing the error below: |
Hi all, I think there is a bug on this function(file: esp_modem_dte.cpp) which does not have primary_term->read(buffer.data.get(), buffer.size - buffer.consumed); Can you please correct this? |
I think there are 2 more issues on the function command_result DTE::command(const std::string &command, got_line_cb got_line, uint32_t time_ms, const char separator).
I modified the function as below: command_result DTE::command(const std::string &command, got_line_cb got_line, uint32_t time_ms, const char separator) Then now I am getting below output. Basically net_open() is failing. Any idea to solve this? I (813) main_task: Started on CPU0 AT OK D (1453) sock_dce: Modem in sync ATE0 OK V (1953) command_lib: set_pdp_context OK OK D (3453) sock_dce: PDP configured +NETOPEN: 0 OK V (4453) sock_commands: +NETCLOSE: 2 ERROR V (35453) sock_commands: net_open +NETOPEN: 0 OK OR V (36453) sock_commands: +NETCLOSE: 2 ERROR V (67453) sock_commands: net_open +NETOPEN: 0 OK OR V (68453) sock_commands: +NETCLOSE: 2 ERROR V (99453) sock_commands: net_open +NETOPEN: 0 OK OR V (100453) sock_commands: +NETCLOSE: 2 ERROR V (131453) sock_commands: net_open +NETOPEN: 0 OK OR V (132453) sock_commands: +NETCLOSE: 2 ERROR V (163453) sock_commands: net_open +NETOPEN: 0 OK OR V (164453) sock_commands: +NETCLOSE: 2 ERROR V (195453) sock_commands: net_open +NETOPEN: 0 OK OR V (196453) sock_commands: |
Any updates on this? |
There's indeed a bug, introduced by the recent modem refactors. It's missing a callback reset upon removal of our custom AT command processing in this example: --- a/components/esp_modem/src/esp_modem_dte.cpp
+++ b/components/esp_modem/src/esp_modem_dte.cpp
@@ -313,6 +313,7 @@ void DTE::on_read(got_line_cb on_read_cb)
if (on_read_cb == nullptr) {
primary_term->set_read_cb(nullptr);
internal_lock.unlock();
+ set_command_callbacks();
return;
}
internal_lock.lock(); It's also possible to fix it in the example, directly by calling --- a/components/esp_modem/examples/modem_tcp_client/main/sock_dce.cpp
+++ b/components/esp_modem/examples/modem_tcp_client/main/sock_dce.cpp
@@ -104,7 +104,7 @@ void DCE::close_sock()
close(sock);
sock = -1;
}
- dte->on_read(nullptr);
+ dte->set_read_cb(nullptr);
const int retries = 5;
int i = 0;
while (net_close() != esp_modem::command_result::OK) {
@@ -224,15 +224,15 @@ void DCE::start_listening(int port)
bool DCE::connect(std::string host, int port)
{
- dte->on_read(nullptr);
+ dte->set_read_cb(nullptr);
tcp_close();
- dte->on_read([this](uint8_t *data, size_t len) {
+ dte->set_read_cb([this](uint8_t *data, size_t len) {
this->perform_at(data, len);
- return esp_modem::command_result::TIMEOUT;
+ return true;
});
if (!at.start_connecting(host, port)) {
ESP_LOGE(TAG, "Unable to start connecting");
- dte->on_read(nullptr);
+ dte->set_read_cb(nullptr);
return false;
}
state = status::CONNECTING;
@@ -247,7 +247,7 @@ bool DCE::init()
data_ready_fd = eventfd(0, EFD_SUPPORT_ISR);
assert(data_ready_fd > 0);
- dte->on_read(nullptr);
+ dte->set_read_cb(nullptr);
const int retries = 5;
int i = 0;
while (sync() != esp_modem::command_result::OK) { Sorry for the inconvenience, this example is still a bit WIP (we don't run it in the CI). I'll create a PR and add some docs to this example. |
Thanks @david-cermak , we will give that a try! |
Hi Thank you for the update and I tried the above and tls for mqtt is working as we have the network API registered using below 3 lines
But for esp-tls, I am unable to find a registration/init function to register the network API and still getting the below error.
Can you help me to resolve this? |
This is only available for components that use If your networking code doesn't use I've added some description to the example README in #395 |
1.0.4 Bug Fixes - Added USB runner with ESP32S2 with A7670 (edeb936) - Extend docs on AT client example (1f2ceed) - Fix pytest exclusion, gitignore, and changelog checks (2696221) - Fix DTE to post fragments to parsers for USB term (1db1e15) - Fix DUAL_MODE regression from cb6e03a (2aada0f) - Fix AT client example to use custom AT processing (1a5ba98, espressif#352)
Answers checklist.
General issue report
I compiled the modem_tcp_client example and seeing no mqtt publish to the cloud.
I did following modifications those are mandatory for my use case.
mqtt_config.broker.address.uri = "mqtts://137.135.83.217";
The debug logs are available here:
The text was updated successfully, but these errors were encountered: