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

drivers:modem: introducing config for cereg/creg for gsm #63769

Closed

Conversation

mtahirbutt
Copy link
Contributor

@mtahirbutt mtahirbutt commented Oct 10, 2023

As some tests with our 4G modems shown that AT+CREG? does not work as expected with the modems. Therefore, the modem does not get internet connection as the modem expects AT+CREG=0,5 for successful PPP connection but this is never accomplished as some modems do not return AT+CREG=0,5 on successful connection to an operator rather AT+CEREG? is the right AT command to use for such modems. Therefore, a new CONFIG is added to use AT+CEREG? for such modems.
The user can select AT+CREG? or AT+CEREG? according to the type the modem supports.
This PR fixes #63917

@rerickson1
Copy link
Member

Please fix code compliance related issues.

@mtahirbutt
Copy link
Contributor Author

Please fix code compliance r

Please fix code compliance related issues.

thanks sir for the comment, will address tomorrow. thanks for your patience.

@emil-lindq
Copy link

Just a comment, since this is a this or that, maybe this Kconfig symbol should be a choice symbol? In that case please remember to name the choice so a default choice can be selected in some overriding Kconfig.

Copy link
Member

@ycsin ycsin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be possible to use the COND_CODE1? I just thought that it might look cleaner

Copy link
Member

@ycsin ycsin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case please remember to name the choice so a default choice can be selected in some overriding Kconfig.

+1

@mtahirbutt
Copy link
Contributor Author

In that case please remember to name the choice so a default choice can be selected in some overriding Kconfig.

thanks for the remarks, actually different manufacterers have shown different results although all of them are 4G, still I can think about it and work on it if that seems more intuitive to use in modem_gsm_type choice. thanks

@mtahirbutt mtahirbutt force-pushed the gsm-modem-cereg branch 6 times, most recently from cd2bebc to ee84182 Compare October 13, 2023 10:25
This contribution addresses the support for various types of modems in
gsm driver. As some 4G modems have failed to return correct output
from AT+CREG?, so AT+CEREG? is the right AT command in such situation.
This commit provides the possibility for user to select one type of
AT command. This PR fixes zephyrproject-rtos#63917

Signed-off-by: Tahir Akram <mtahirbutt@hotmail.com>
@mtahirbutt
Copy link
Contributor Author

In that case please remember to name the choice so a default choice can be selected in some overriding Kconfig.

thanks for the remarks, actually different manufacterers have shown different results although all of them are 4G, still I can think about it and work on it if that seems more intuitive to use in modem_gsm_type choice. thanks

Please review the changes. I have introduced a choice now. I have also worked with main branch, also thinking of creating a new PR with main branch. As Backport error is occuring here as I already created the issue and mention "Fix #1234"
Thanks.

@ycsin
Copy link
Member

ycsin commented Oct 16, 2023

I have also worked with main branch, also thinking of creating a new PR with main branch

I dont think you can push something into a released branch like this, you will have to push things into the main branch` and do a proper backport from there

Copy link
Member

@ycsin ycsin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please create another PR against main

Use particular type of AT command for registration status.

config MODEM_GSM_SELECT_CREG
bool "CREG command"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be a string type with "CREG" as the default value

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I tried but zephyr is not allowing me to use string as a type of choice. i do not find any example either. is there any?

Copy link
Member

@ycsin ycsin Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, didn't know that, sorry, how about

config MODEM_GSM_STATUS_COMMAND
  string "Status command"
  default "CREG" if MODEM_GSM_STATUS_CMD_USE_CREG
  default "CEREG" if MODEM_GSM_STATUS_CMD_USE_CEREG

?

I found some similar things here: zephyrproject/modules/hal/espressif/components/esptool_py/Kconfig.projbuild

In any case, you should really create another PR against main for better documentation of this development

Use this if the modem works only with AT+CREG?.

config MODEM_GSM_SELECT_CEREG
bool "CEREG command"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this, with "CEREG" as default value

@@ -36,6 +36,24 @@ config MODEM_GSM_QUECTEL

endchoice

choice MODEM_GSM_STATUS_COMMAND_TYPE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then this can just be

Suggested change
choice MODEM_GSM_STATUS_COMMAND_TYPE
choice MODEM_GSM_STATUS_COMMAND

static const struct modem_cmd check_net_reg_cmd =
#if defined(CONFIG_MODEM_GSM_SELECT_CEREG)
MODEM_CMD("+CEREG: ", on_cmd_net_reg_sts, 2U, ",");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then you can do this in one liner by concatenating:
"+" "CONFIG_MODEM_GSM_STATUS_COMMAND"

drivers/modem/gsm_ppp.c Show resolved Hide resolved
@mtahirbutt
Copy link
Contributor Author

I have also worked with main branch, also thinking of creating a new PR with main branch

I dont think you can push something into a released branch like this, you will have to push things into the main branch` and do a proper backport from there

Please check the new PR #64025. All requested changes addressed. I will close this PR after a while. thanks.

@rerickson1
Copy link
Member

Moved to a new PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants