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

need a Forced Exit of CMUX Mode (IDFGH-10551) #320

Closed
3 tasks done
diplfranzhoepfinger opened this issue Jul 3, 2023 · 9 comments · Fixed by #416
Closed
3 tasks done

need a Forced Exit of CMUX Mode (IDFGH-10551) #320

diplfranzhoepfinger opened this issue Jul 3, 2023 · 9 comments · Fixed by #416
Milestone

Comments

@diplfranzhoepfinger
Copy link
Contributor

diplfranzhoepfinger commented Jul 3, 2023

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

If we restart the Modem, and had not the Chance to exit CMUX in a proper way, we have no chance to exit Cmux on the ESP32 side, as esp-modem is waiting for the normative Response from the Modem, and the Modem is not answering, as it has been restarted.

so:

need a Forced Exit of CMUX Mode

Log: https://gist.github.com/diplfranzhoepfinger/835457ae629a05478a543b0408a6e5a2
Code: https://github.com/diplfranzhoepfinger/esp-protocols-tree-master-components-esp_modem-examples-simple_cmux_client/tree/feature/CMUX_FORCE

if the Modem is having a Problem during a CMUX Session,
and we do switch it off and on again,

then the following Situation occurs:

  • ESP32 is still in CMUX Mode
  • Modem is in Command Mode (and in 2-wire mode too)

if we now run through the normal exit sequence, this fails. 

esp-modem thinks this is wrong, and don't let us exit cmux Mode.

but we know that we must exit cmux mode (even without response from modem) as we started the modem freshly, and we know it is in command mode. 

so we wish to have a Transition to reset everything in esp-modem from the cmux perspective to be able to talk to the Modem again.

@github-actions github-actions bot changed the title need a Forced Exit of CMUX Mode need a Forced Exit of CMUX Mode (IDFGH-10551) Jul 3, 2023
@diplfranzhoepfinger
Copy link
Contributor Author

so we hacked something together,
but i fear this is not 100% the right way:

I would more like to have a Mode like: CMUX_MANUAL_EXIT_FORCED,
so we call it only when we know that we want to "force" esp-modem to leave cmux without checking the circumstances.

Log: https://gist.github.com/diplfranzhoepfinger/c7ab11ed17bde1920a7094c6288f1cc4

Code: https://github.com/diplfranzhoepfinger/esp-protocols-tree-master-components-esp_modem-examples-simple_cmux_client/tree/feature/CMUX_FORCE_Vasil

@diplfranzhoepfinger
Copy link
Contributor Author

we hacked further:

Log: https://gist.github.com/diplfranzhoepfinger/a36fd06a8b3ed9398deb52cc9fb774b0

Code: https://github.com/diplfranzhoepfinger/esp-protocols-tree-master-components-esp_modem-examples-simple_cmux_client/tree/feature/CMUX_FORCE_Vasil2

as expected, the Code is crashing, BUT, at least, we can start Cmux again and again get a IP Address. 

so @david-cermak i think the Problem is solvable, but needs expertise of the Internals.

@diplfranzhoepfinger
Copy link
Contributor Author

@david-cermak any response ?

@david-cermak
Copy link
Collaborator

Noted, I think it would be really useful to kind of reset to a default state on ESP32.

Could we use this "Unknown state" for that? For example if we know that we got somehow out of sync

  1. we switch the modem to the "unknown" (just need to allow this transition)
  2. from there, everything should be the same as after init

@diplfranzhoepfinger
Copy link
Contributor Author

cool idea. go forward with it.

@VasilNikolovRilabs
Copy link

Same issue on our side, we need a solution for ESP modem to allow a safe start of CMUX from any situation.

@HDLA-BG
Copy link

HDLA-BG commented Oct 17, 2023

Same issue here!

1 similar comment
@DOevermann
Copy link

Same issue here!

@david-cermak
Copy link
Collaborator

Created #416 to support the forced transitions.

As a workaround, you can destruct modem's DCE (to enter the UNDEF mode) and then switch to:

  1. CMUX_MANUAL_ENTER
  2. CMUX_MANUAL_EXIT

david-cermak added a commit to david-cermak/esp-protocols that referenced this issue Nov 7, 2023
david-cermak added a commit to david-cermak/esp-protocols that referenced this issue Dec 6, 2023
1.0.5
Major changes
- Added support for implementing user defined modules in standard C-API (Support for custom modules with C-API)
Bug Fixes
- Added test injecting unexpected replies (b220d1e, espressif#426)
- Fixed inconsistent state on data after OK (bf99f28, espressif#426)
- TLS example: Added restore session support in mbedtls-wrap (79d38e5)
- Fixed examples to show netif on ppp-changed event (a70b197)
- remove unused GNU Make based buildsystem files (d6b6f63)
- specify override_path in example manifest files (5b78da4)
- Added test-cases that exercise mode transitions (aff571d)
- Fixed mode transitions between any state and UNDEF (93cb2ca, espressif#320)
- Fixed API docs within doxygen comments (020b407)
- Support for custom modules with C-API (0254d50)
- Fix CRLF issue with esp_modem_c_api.cpp (2661b4d)
Updated
- ci(common): Created reusable action for host and coverage tests (9ad04de)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants