modem_cellular: Add support for the Telit ME310G1 LTE modem

Add support for the Telit ME310G1 LTE modem which is very similar to
the ME910G1. Re-use the ME910G1's AT command scripts but rename
them to mex10_xx and define a shutdown script (AT#SHDN).

Signed-off-by: Niklas Gürtler <niklas.guertler@e-obs.de>
This commit is contained in:
Niklas Gürtler 2024-10-16 17:12:01 +02:00 committed by Carles Cufí
parent bfeb8c807a
commit 50dbd8ba5a
2 changed files with 49 additions and 15 deletions

View file

@ -16,9 +16,9 @@ config MODEM_CELLULAR
depends on (DT_HAS_QUECTEL_BG95_ENABLED || \ depends on (DT_HAS_QUECTEL_BG95_ENABLED || \
DT_HAS_SIMCOM_SIM7080_ENABLED || DT_HAS_U_BLOX_SARA_R4_ENABLED || \ DT_HAS_SIMCOM_SIM7080_ENABLED || DT_HAS_U_BLOX_SARA_R4_ENABLED || \
DT_HAS_U_BLOX_SARA_R5_ENABLED || DT_HAS_SWIR_HL7800_ENABLED || \ DT_HAS_U_BLOX_SARA_R5_ENABLED || DT_HAS_SWIR_HL7800_ENABLED || \
DT_HAS_TELIT_ME910G1_ENABLED || DT_HAS_QUECTEL_EG25_G_ENABLED || \ DT_HAS_TELIT_ME910G1_ENABLED || DT_HAS_TELIT_ME310G1_ENABLED || \
DT_HAS_NORDIC_NRF91_SLM_ENABLED || DT_HAS_SQN_GM02S_ENABLED || \ DT_HAS_QUECTEL_EG25_G_ENABLED || DT_HAS_NORDIC_NRF91_SLM_ENABLED || \
DT_HAS_U_BLOX_LARA_R6_ENABLED) DT_HAS_SQN_GM02S_ENABLED || DT_HAS_U_BLOX_LARA_R6_ENABLED)
help help
This driver uses the generic 3gpp AT commands, along This driver uses the generic 3gpp AT commands, along
with the standard protocols CMUX and PPP, to configure with the standard protocols CMUX and PPP, to configure

View file

@ -2173,8 +2173,8 @@ MODEM_CHAT_SCRIPT_DEFINE(swir_hl7800_dial_chat_script, swir_hl7800_dial_chat_scr
dial_abort_matches, modem_cellular_chat_callback_handler, 10); dial_abort_matches, modem_cellular_chat_callback_handler, 10);
#endif #endif
#if DT_HAS_COMPAT_STATUS_OKAY(telit_me910g1) #if DT_HAS_COMPAT_STATUS_OKAY(telit_me910g1) || DT_HAS_COMPAT_STATUS_OKAY(telit_me310g1)
MODEM_CHAT_SCRIPT_CMDS_DEFINE(telit_me910g1_init_chat_script_cmds, MODEM_CHAT_SCRIPT_CMDS_DEFINE(telit_mex10g1_init_chat_script_cmds,
MODEM_CHAT_SCRIPT_CMD_RESP_NONE("AT", 100), MODEM_CHAT_SCRIPT_CMD_RESP_NONE("AT", 100),
MODEM_CHAT_SCRIPT_CMD_RESP_NONE("AT", 100), MODEM_CHAT_SCRIPT_CMD_RESP_NONE("AT", 100),
MODEM_CHAT_SCRIPT_CMD_RESP_NONE("AT", 100), MODEM_CHAT_SCRIPT_CMD_RESP_NONE("AT", 100),
@ -2212,24 +2212,35 @@ MODEM_CHAT_SCRIPT_CMDS_DEFINE(telit_me910g1_init_chat_script_cmds,
MODEM_CHAT_SCRIPT_CMD_RESP_NONE("AT+CMUX=0,0,5,127,10,3,30,10,2", MODEM_CHAT_SCRIPT_CMD_RESP_NONE("AT+CMUX=0,0,5,127,10,3,30,10,2",
300)); 300));
MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_init_chat_script, telit_me910g1_init_chat_script_cmds, MODEM_CHAT_SCRIPT_DEFINE(telit_mex10g1_init_chat_script, telit_mex10g1_init_chat_script_cmds,
abort_matches, modem_cellular_chat_callback_handler, 10); abort_matches, modem_cellular_chat_callback_handler, 10);
MODEM_CHAT_SCRIPT_CMDS_DEFINE(telit_me910g1_dial_chat_script_cmds, MODEM_CHAT_SCRIPT_CMDS_DEFINE(telit_mex10g1_dial_chat_script_cmds,
MODEM_CHAT_SCRIPT_CMD_RESP("AT", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP("AT", ok_match),
MODEM_CHAT_SCRIPT_CMD_RESP_NONE("ATD*99***1#", 0)); MODEM_CHAT_SCRIPT_CMD_RESP_NONE("ATD*99***1#", 0));
MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_dial_chat_script, telit_me910g1_dial_chat_script_cmds, MODEM_CHAT_SCRIPT_DEFINE(telit_mex10g1_dial_chat_script, telit_mex10g1_dial_chat_script_cmds,
dial_abort_matches, modem_cellular_chat_callback_handler, 10); dial_abort_matches, modem_cellular_chat_callback_handler, 10);
MODEM_CHAT_SCRIPT_CMDS_DEFINE(telit_me910g1_periodic_chat_script_cmds, MODEM_CHAT_SCRIPT_CMDS_DEFINE(telit_mex10g1_periodic_chat_script_cmds,
MODEM_CHAT_SCRIPT_CMD_RESP("AT+CREG?", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP("AT+CREG?", ok_match),
MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGREG?", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGREG?", ok_match),
MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG?", ok_match)); MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG?", ok_match));
MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_CHAT_SCRIPT_DEFINE(telit_mex10g1_periodic_chat_script,
telit_me910g1_periodic_chat_script_cmds, abort_matches, telit_mex10g1_periodic_chat_script_cmds, abort_matches,
modem_cellular_chat_callback_handler, 4); modem_cellular_chat_callback_handler, 4);
#endif
#if DT_HAS_COMPAT_STATUS_OKAY(telit_me310g1)
MODEM_CHAT_SCRIPT_CMDS_DEFINE(telit_me310g1_shutdown_chat_script_cmds,
MODEM_CHAT_SCRIPT_CMD_RESP("AT#SHDN", ok_match));
MODEM_CHAT_SCRIPT_DEFINE(telit_me310g1_shutdown_chat_script,
telit_me310g1_shutdown_chat_script_cmds, abort_matches,
modem_cellular_chat_callback_handler, 15);
#endif #endif
#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf91_slm) #if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf91_slm)
@ -2505,7 +2516,7 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script,
&u_blox_lara_r6_init_chat_script, \ &u_blox_lara_r6_init_chat_script, \
&u_blox_lara_r6_dial_chat_script, \ &u_blox_lara_r6_dial_chat_script, \
&u_blox_lara_r6_periodic_chat_script, \ &u_blox_lara_r6_periodic_chat_script, \
NULL ) NULL)
#define MODEM_CELLULAR_DEVICE_SWIR_HL7800(inst) \ #define MODEM_CELLULAR_DEVICE_SWIR_HL7800(inst) \
MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \
@ -2540,11 +2551,30 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script,
\ \
MODEM_CELLULAR_DEFINE_INSTANCE(inst, 5050, 250, 15000, 5000, false, \ MODEM_CELLULAR_DEFINE_INSTANCE(inst, 5050, 250, 15000, 5000, false, \
NULL, \ NULL, \
&telit_me910g1_init_chat_script, \ &telit_mex10g1_init_chat_script, \
&telit_me910g1_dial_chat_script, \ &telit_mex10g1_dial_chat_script, \
&telit_me910g1_periodic_chat_script, \ &telit_mex10g1_periodic_chat_script, \
NULL) NULL)
#define MODEM_CELLULAR_DEVICE_TELIT_ME310G1(inst) \
MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \
\
static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \
.chat_delimiter = "\r", \
.chat_filter = "\n", \
.ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \
}; \
\
MODEM_CELLULAR_DEFINE_AND_INIT_USER_PIPES(inst, \
(user_pipe_0, 3)) \
\
MODEM_CELLULAR_DEFINE_INSTANCE(inst, 5050, 0 /* unused */, 1000, 15000, false, \
NULL, \
&telit_mex10g1_init_chat_script, \
&telit_mex10g1_dial_chat_script, \
&telit_mex10g1_periodic_chat_script, \
&telit_me310g1_shutdown_chat_script)
#define MODEM_CELLULAR_DEVICE_NORDIC_NRF91_SLM(inst) \ #define MODEM_CELLULAR_DEVICE_NORDIC_NRF91_SLM(inst) \
MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 1500); \ MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 1500); \
\ \
@ -2613,6 +2643,10 @@ DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_SWIR_HL7800)
DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_TELIT_ME910G1) DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_TELIT_ME910G1)
#undef DT_DRV_COMPAT #undef DT_DRV_COMPAT
#define DT_DRV_COMPAT telit_me310g1
DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_TELIT_ME310G1)
#undef DT_DRV_COMPAT
#define DT_DRV_COMPAT nordic_nrf91_slm #define DT_DRV_COMPAT nordic_nrf91_slm
DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_NORDIC_NRF91_SLM) DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_NORDIC_NRF91_SLM)
#undef DT_DRV_COMPAT #undef DT_DRV_COMPAT