Comments (9)
@bbinet Yes, this seems to be a bug, as when the device fails to switch mode, the mode should go to Unknown:
if (!device->set_mode(modem_mode::COMMAND_MODE)) {
mode = modem_mode::UNDEF:
return false;
}
I can also see that switching modes could be improved, this haven't been thoroughly tested with many devices, but in general it misses some retry mechanism when sending the escape sequence of +++
.
Moreover, if you're using the C-API, it doesn't seem to return this failure, so even users couldn't implement a retry.
Will address these 3 problems.
from esp-protocols.
Thank you @david-cermak.
Also do you know why device->set_mode(modem_mode::COMMAND_MODE)
always fail for me whereas the mode actually seem to have correctly been changed to command mode as I'm able to send AT commands successfully.
from esp-protocols.
Also do you know why device->set_mode(modem_mode::COMMAND_MODE) always fail
Does it always fail?
My guess is that your device perhaps needs more time to respond, or a delay before sending the command or something similar. Switching modes is very tricky and very much depends on the actual device. I haven't tried working with the BG95-M3
device. (according to the docs on +++
command: we should retry after 1 second period, until we succeed...)
from esp-protocols.
I'm not sure about always but I don't remember of a successful switch from data to command mode.
Does it work for a BG96 module?
I can test with longer timeout, but as I'm not used to C++, can you indicate where is the implementation of the device->set_mode()
method for the BG96 device?
from esp-protocols.
Yes, it works for BG96
The command to exit (escape) PPP mode is implemented here
esp-protocols/components/esp_modem/src/esp_modem_command_library.cpp
Lines 287 to 293 in 7346ed9
from esp-protocols.
@david-cermak when I try to log return value at
I get
command_result::TIMEOUT
.
This is weird as if I connect a serial port directly to my bg95-m3 modem, and I manually send command +++
to switch mode from data to command, I immediately get the response "NO CARRIER", so I should not have a timeout when communicating with the bg95 module through esp_modem.
from esp-protocols.
I've tried to add some additional logs to understand why I get a timeout, and in the mean time I've connected the RX line of an additional serial port to the TX line of the bg95 module to act as a sniffer to see its response in realtime.
I've added the following logs:
- "set_read_cb" after line 40:
esp-protocols/components/esp_modem/src/esp_modem_dte.cpp
Lines 40 to 41 in 2a4e684
- "command_term->write" after line 57:
esp-protocols/components/esp_modem/src/esp_modem_dte.cpp
Lines 57 to 58 in 2a4e684
Then when I switch the mode from data to command, I only see the log "command_term->write", but not "set_read_cb", whereas I can see the "NO CARRIER" response on my additional serial sniffer.
Any idea why the set_read_cb
callback is not called?
from esp-protocols.
Any idea why the set_read_cb callback is not called?
Does your serial sniffer show the newline characters (\r\n
) after the NO CARRIER
response? That could be the reason why the lambda doesn't get called. I'll try to reproduce it.
from esp-protocols.
@david-cermak I confirm that your PR #52 fixes this issue on modem BG95-M3: I can now successfully switch from data to command mode.
Thank you!
from esp-protocols.
Related Issues (20)
- When using esp_modem components, cdc_acm: Incorrect number of bytes transferred error occasionally occurs after networking to the Internet (IDFGH-12227) HOT 1
- [BUG] mDNS stops working with heavy UDP load (IDFGH-12307) HOT 2
- mDNS results in esp_netif_lwip log spam (IDFGH-12320) HOT 1
- Freezing of the ESP, triggering the WDT! (ESP-MODEM) (IDFGH-12332) HOT 3
- Response Issue in CMUX Mode (IDFGH-12431) HOT 15
- little help in getting esp_modem and LiliGo-TSIM7080-S3 to work (IDFGH-12454) HOT 3
- esp-modem next step : ppp auth ? (IDFGH-12496) HOT 5
- esp-modem: AT command response truncated sometimes when in CMUX mode (IDFGH-12526) HOT 3
- mdns: ethernet link flap doesn't restart mdns if DHCP in use. (IDFGH-12563) HOT 2
- esp-netif_lwip-ppp: Connection lost, Modem Disconnect from PPP Server (IDFGH-12618) HOT 5
- Choosing The Right Mode For SIMCOM or Any Modem... (AT or DialUP) (IDFGH-12638) HOT 10
- problems with modem_tcp_client and Telit LE910Cx modem (IDFGH-12643) HOT 1
- esp_mqtt_cxx not set last will (IDFGH-12648)
- Kconfig in modem_example limits the UART pins till 31 - should be higher to support s3 (IDFGH-12700) HOT 1
- LwIP PPP connection close and no authentication (IDFGH-12720) HOT 3
- esp_modem freezes when flow control is enabled and module is unresponsive (IDFGH-12739) HOT 1
- C++ example please (IDFGH-12752) HOT 2
- EPPP Reverse link to provide Access Point (IDFGH-12759) HOT 12
- esp_wifi_remote: key-pair generated by generate_test_certs.py not work in example (IDFGH-12801) HOT 10
- Fix code scanning alert - expected '(' for function-style cast or type construction [clang-diagnostic-error] (IDFGH-12824)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esp-protocols.