-
Notifications
You must be signed in to change notification settings - Fork 135
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
fix(esp-modem): Extend CMUX mode to support manual transitions #169
fix(esp-modem): Extend CMUX mode to support manual transitions #169
Conversation
david-cermak
commented
Oct 25, 2022
- Adds manual transitions to CMUX
- Adds C-API that allows for user defined AT command with own callback
0f00368
to
28de345
Compare
28de345
to
1f0e863
Compare
a6fc861
to
53cc06f
Compare
53cc06f
to
2180ab1
Compare
https://github.com/espressif/esp-protocols/actions/runs/3515038680/jobs/5890591395 @david-cermak why is this failing ? also to where does it download ? has Espressif a own build-Server, where some ESP Boards are connected, where they download the code and run it? |
This is an unrelated error. Yes, we have a self-hosted runner, but that's used only for test execution on target. Build tests and host test are executed on GitHub runners. |
so, did a first Test:
Goal is after Exit CMUX Mode enter CMUX Mode again. |
but this brings up:
|
now try:
and
this does work !
|
Could you please try to send |
will do. kepp you posted ! |
so, ATH\r is the command "hang_up" test like this: /* Close multiplexed command/data mode */
#if CONFIG_EXAMPLE_CLOSE_CMUX_AT_END == 1
report(dce->set_mode(esp_modem::modem_mode::COMMAND_MODE));
//Could you please try to send ATH\r command after exiting the (auto) CMUX? This usually helps (some devices) with restarting the data mode.
vTaskDelay( 500 / portTICK_PERIOD_MS );
dce->hang_up();
vTaskDelay( 500 / portTICK_PERIOD_MS );
#endif
report(dce->set_mode(esp_modem::modem_mode::CMUX_MODE)); |
Still Error:
|
i will try with extended logging. |
1 similar comment
i will try with extended logging. |
the Error is again "NO CARRIER" |
good thing: we already get the Disconnect Events we were so hard waiting for: -->
|
can you give some more information how it is thought ? Enter CMUX: report(dce->set_mode(esp_modem::modem_mode::CMUX_MANUAL_MODE)); /*!< Enter CMUX mode manually -- just creates two virtual terminals */
report(dce->set_mode(esp_modem::modem_mode::CMUX_MANUAL_COMMAND)); // Primary Terminal to Command
report(dce->set_mode(esp_modem::modem_mode::CMUX_MANUAL_SWAP)); // swap
report(dce->set_mode(esp_modem::modem_mode::CMUX_MANUAL_DATA)); // second Terminal to Data
report(dce->set_mode(esp_modem::modem_mode::CMUX_MANUAL_SWAP)); // swap again so we have Command Terminal in Front Exit only Data Mode on one Channel: /* Close multiplexed command/data mode */
#if CONFIG_EXAMPLE_CLOSE_CMUX_AT_END == 1
report(dce->set_mode(esp_modem::modem_mode::CMUX_MANUAL_SWAP));
report(dce->set_mode(esp_modem::modem_mode::CMUX_MANUAL_COMMAND)); //second Channel to Command
//Could you please try to send ATH\r command after exiting the (auto) CMUX? This usually helps (some devices) with restarting the data mode.
vTaskDelay( 500 / portTICK_PERIOD_MS );
switch (dce->hang_up())
{
case command_result::OK: /*!< The command completed successfully */
std::cout << "hang_up OK" << std::endl;
break;
case command_result::FAIL: /*!< The command explicitly failed */
std::cout << "hang_up fail" << std::endl;
break;
case command_result::TIMEOUT: /*!< The device didn't respond in the specified timeline */
std::cout << "hang_up timeout" << std::endl;
break;
}
vTaskDelay( 500 / portTICK_PERIOD_MS );
#endif
report(dce->set_mode(esp_modem::modem_mode::CMUX_MANUAL_DATA)); // second Channel to Data again
report(dce->set_mode(esp_modem::modem_mode::CMUX_MANUAL_SWAP)); // swap again so we have Command Terminal in Front |
By analyzing your code, i see once you enter Data Mode in MANUAL CMUX, you automatically swap Terminals. |
SUCCESS !!! got it: report(dce->set_mode(esp_modem::modem_mode::CMUX_MANUAL_MODE)); /*!< Enter CMUX mode manually -- just creates two virtual terminals */
report(dce->set_mode(esp_modem::modem_mode::CMUX_MANUAL_DATA)); // second Terminal to Data (Swap is implicit) /* Close multiplexed command/data mode */
#if CONFIG_EXAMPLE_CLOSE_CMUX_AT_END == 1
report(dce->set_mode(esp_modem::modem_mode::CMUX_MANUAL_COMMAND)); //second Channel to Command
//Could you please try to send ATH\r command after exiting the (auto) CMUX? This usually helps (some devices) with restarting the data mode.
vTaskDelay( 500 / portTICK_PERIOD_MS );
switch (dce->hang_up())
{
case command_result::OK: /*!< The command completed successfully */
std::cout << "hang_up OK" << std::endl;
break;
case command_result::FAIL: /*!< The command explicitly failed */
std::cout << "hang_up fail" << std::endl;
break;
case command_result::TIMEOUT: /*!< The device didn't respond in the specified timeline */
std::cout << "hang_up timeout" << std::endl;
break;
}
vTaskDelay( 500 / portTICK_PERIOD_MS );
#endif
report(dce->set_mode(esp_modem::modem_mode::CMUX_MANUAL_DATA)); // second Channel to Data again
}
|
so, this ways seems running:
|
from a fresh boot:
|
even nicer:
with
and:
|
Thanks for the review @euripedesrocha ! |
@diplfranzhoepfinger Hi Franz!
Suggest using the console example to checkout the mode transitions, created additional states, such as Thanks for the thorough testing, btw. It seems that the tricky part is the exit of the CMUX mode and apparently it behaves differently on different devices, e.g. on 7600 it also hangs-up (destroys the carrier); in your device though it looks like it's not able to re-establish the connection for some reason. Also noticed some inconsistencies with other devices, like |
BUT: do we need really to exit CMUX ? i did not test, i only switched the Channel to DATA and back to console, and this works perfect. i will veryfy with my SIM7070 and some GPS Receive. Thanks, |
C APIs for CMUX manual transitions are not working. |