Skip to content
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

Is there a way to send AT commands while keeping the connection, without using CMUX? (IDFGH-14106) #699

Closed
3 tasks done
doragasu opened this issue Nov 20, 2024 · 4 comments · Fixed by #700
Closed
3 tasks done
Assignees
Labels
Status: Opened Issue is new

Comments

@doragasu
Copy link

doragasu commented Nov 20, 2024

Answers checklist.

  • I have read the documentation for esp-protocols components and the issue is not addressed there.
  • I have updated my esp-protocols branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

I'm using a Quectel MC60 modem. In CMUX mode, I can get Internet connectivity and simultaneously send AT commands (I need to periodically get signal quality). The problem is that now I am optimizing power consumption, and the modem refuses to enter sleep mode if CMUX is active, so I am forced to use DATA mode.

While in DATA mode, sending commands to the modem does not work, and if I momentarily try switching to COMMAND mode, the connection is immediately dropped. When many years ago I made my own modem drivers, I was able to momentarily switch to command mode (using the "+++" escape sequence), send the AT command, and return to DATA mode without interrupting the connection. Is this possible in any way?

TL;DR: Is there a way to get the signal quality (or send any other AT command) when using DATA mode, without interrupting the connectivity?

@espressif-bot espressif-bot added the Status: Opened Issue is new label Nov 20, 2024
@github-actions github-actions bot changed the title Is there a way to send AT commands while keeping the connection, without using CMUX? Is there a way to send AT commands while keeping the connection, without using CMUX? (IDFGH-14106) Nov 20, 2024
david-cermak added a commit to david-cermak/esp-protocols that referenced this issue Nov 21, 2024
@david-cermak
Copy link
Collaborator

esp_modem doesn't support it ATM, but I find it quite helpful (also used it to perform OTA in the past).
I've put up a sketch PR: #700, which allows you to pause a network connection and bring up the AT interface.

@doragasu
Copy link
Author

Thanks!

With that patch, invoking pause(true) also switches to command mode, right? Or should I manually switch after the pause?

@david-cermak
Copy link
Collaborator

With that patch, invoking pause(true) also switches to command mode, right? Or should I manually switch after the pause?

It sends the corresponding AT commands, yes, but the mode stays the same.

To test it, you need to switch to the data mode first. Then:

  • dce->pause(true);
  • dce->send_some_at(...);
  • dce->pause(false);
    and the network should be still functional (mode stays the same modem_mode::DATA_MODE).
    (network data are discarded so it may happen that the connection get's dropped or disconnected in the meantime, e.g. if you're using TPC keepalive or MQTT pings...)

@doragasu
Copy link
Author

doragasu commented Nov 21, 2024

I see, thanks.

About the discarded network data, I suppose data from the ESP host to the modem is discarded (but I could maybe workaround that with a lock), and data from the modem to the ESP will be buffered by the modem until I unpause (so when using TCP, no data loss should occur).

david-cermak added a commit to david-cermak/esp-protocols that referenced this issue Nov 29, 2024
david-cermak added a commit to david-cermak/esp-protocols that referenced this issue Dec 4, 2024
david-cermak added a commit to david-cermak/esp-protocols that referenced this issue Dec 4, 2024
david-cermak added a commit to david-cermak/esp-protocols that referenced this issue Dec 5, 2024
david-cermak added a commit to david-cermak/esp-protocols that referenced this issue Dec 10, 2024
1.3.0
Features
- Add mode detection to the example (18f196f)
- Support for pausing network in C-API (1db83cd)
- Add support for pausing netif (247f168, espressif#699)
Bug Fixes
- Minor cleanup of pppos example (5e92990)
- Fix PPP mode detection to accept LCP/conf (c989c6a)
- Refine mode switch data->command (8b6ea33, espressif#692)
- Detect serial ports properly (0cb59ff)
- Fix CMUX enter to ignore URC before transition (1284f66, espressif#669)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Opened Issue is new
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants