From 83b55af6cb4d8968c40cae839fb495af4c98a291 Mon Sep 17 00:00:00 2001 From: pennam Date: Tue, 15 Oct 2024 11:43:17 +0200 Subject: [PATCH 01/20] GSM: extend number of connection retries to 10, cut down maximum wait time to 8s --- libraries/GSM/src/GSM.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/GSM/src/GSM.h b/libraries/GSM/src/GSM.h index 0b724f284..44424ee4b 100644 --- a/libraries/GSM/src/GSM.h +++ b/libraries/GSM/src/GSM.h @@ -129,9 +129,9 @@ class GSMClass : public MbedSocketClass { bool _at_debug = false; /* Internal cellular state machine retries. Values are in seconds. - * This array also defines the maximum number of retries to 6 + * This array also defines the maximum number of retries to CELLULAR_RETRY_ARRAY_SIZE */ - const uint16_t _retry_timeout[6] = {1, 2, 4, 8, 16, 32}; + const uint16_t _retry_timeout[CELLULAR_RETRY_ARRAY_SIZE] = {1, 2, 4, 8, 8, 8, 8, 8, 8, 8}; static constexpr int RSSI_UNKNOWN = 99; static const char * const sim_state_str[]; From 91ffd8d76b03b4d499530a4bbc4c2f7d55147a65 Mon Sep 17 00:00:00 2001 From: pennam Date: Tue, 15 Oct 2024 12:41:08 +0200 Subject: [PATCH 02/20] GSM: remove isReady --- libraries/GSM/src/GSM.cpp | 20 -------------------- libraries/GSM/src/GSM.h | 1 - 2 files changed, 21 deletions(-) diff --git a/libraries/GSM/src/GSM.cpp b/libraries/GSM/src/GSM.cpp index cf5f5b975..786cd0ee6 100644 --- a/libraries/GSM/src/GSM.cpp +++ b/libraries/GSM/src/GSM.cpp @@ -66,11 +66,6 @@ int arduino::GSMClass::begin(const char* pin, const char* apn, const char* usern _device = _context->get_device(); _device->modem_debug_on(_at_debug); - if (!isReady()) { - DEBUG_ERROR("Cellular device not ready"); - return 0; - } - _device->set_cmux_status_flag(_cmuxGSMenable); _device->set_retry_timeout_array(_retry_timeout, sizeof(_retry_timeout) / sizeof(_retry_timeout[0])); _device->attach(mbed::callback(this, &GSMClass::onStatusChange)); @@ -170,22 +165,7 @@ void arduino::GSMClass::reset() { delay(1); } -bool arduino::GSMClass::isReady(const int timeout) { - if (!_device) { - DEBUG_ERROR("No device found"); - return false; - } - const unsigned int start = millis(); - while (_device->is_ready() != NSAPI_ERROR_OK) { - if (millis() - start > timeout) { - DEBUG_WARNING("Timeout waiting device ready"); - return false; - } - delay(100); - } - return true; -} arduino::GSMClass GSM; diff --git a/libraries/GSM/src/GSM.h b/libraries/GSM/src/GSM.h index 44424ee4b..33b31f8ce 100644 --- a/libraries/GSM/src/GSM.h +++ b/libraries/GSM/src/GSM.h @@ -147,7 +147,6 @@ class GSMClass : public MbedSocketClass { void onStatusChange(nsapi_event_t ev, intptr_t in); void reset(); - bool isReady(const int timeout = 5000); }; } From 249f84cb59ba4f058489f372c039f2789347000a Mon Sep 17 00:00:00 2001 From: pennam Date: Tue, 15 Oct 2024 12:43:27 +0200 Subject: [PATCH 03/20] GSM: add end() implementation --- libraries/GSM/src/GSM.cpp | 2 +- libraries/GSM/src/GSM.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/libraries/GSM/src/GSM.cpp b/libraries/GSM/src/GSM.cpp index 786cd0ee6..d172591f0 100644 --- a/libraries/GSM/src/GSM.cpp +++ b/libraries/GSM/src/GSM.cpp @@ -110,7 +110,7 @@ bool arduino::GSMClass::isCmuxEnable() { } void arduino::GSMClass::end() { - + _device->shutdown(); } int arduino::GSMClass::disconnect() { diff --git a/libraries/GSM/src/GSM.h b/libraries/GSM/src/GSM.h index 33b31f8ce..406b258be 100644 --- a/libraries/GSM/src/GSM.h +++ b/libraries/GSM/src/GSM.h @@ -95,6 +95,9 @@ class GSMClass : public MbedSocketClass { */ int disconnect(void); + /* + * Reset internal state machine in order to be ready to reconnect again. + */ void end(void); unsigned long getTime(); From a66c946fcc2fb6b8587a034b8c5c213873d014fe Mon Sep 17 00:00:00 2001 From: pennam Date: Tue, 15 Oct 2024 12:44:15 +0200 Subject: [PATCH 04/20] GSM: fix comments alignment --- libraries/GSM/src/GSM.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/libraries/GSM/src/GSM.h b/libraries/GSM/src/GSM.h index 406b258be..36549d0fb 100644 --- a/libraries/GSM/src/GSM.h +++ b/libraries/GSM/src/GSM.h @@ -75,24 +75,24 @@ class GSMClass : public MbedSocketClass { } } - /* Start GSM connection. - * Configure the credentials into the device. - * - * param pin: Pointer to the pin string. - * param apn: Pointer to the apn string. - * param username: Pointer to the username string. - * param password: Pointer to the password string. - * param rat: Radio Access Technology. - * - * return: 0 in case of success, negative number in case of failure - */ + /* + * Start GSM connection. Configure the credentials into the device. + * + * param pin: Pointer to the pin string. + * param apn: Pointer to the apn string. + * param username: Pointer to the username string. + * param password: Pointer to the password string. + * param rat: Radio Access Technology. + * + * return: 0 in case of success, negative number in case of failure + */ int begin(const char* pin, const char* apn, const char* username, const char* password, RadioAccessTechnologyType rat = CATNB, uint32_t band = BAND_20, bool restart = true); /* - * Disconnect from the network - * - * return: one value of wl_status_t enum - */ + * Disconnect from the network + * + * return: one value of wl_status_t enum + */ int disconnect(void); /* From e1b61e22591a882764c956d0e256b4d8280511f7 Mon Sep 17 00:00:00 2001 From: pennam Date: Tue, 15 Oct 2024 12:51:17 +0200 Subject: [PATCH 05/20] GSM: add setTimeout function --- libraries/GSM/src/GSM.cpp | 5 +++++ libraries/GSM/src/GSM.h | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/libraries/GSM/src/GSM.cpp b/libraries/GSM/src/GSM.cpp index d172591f0..18d280747 100644 --- a/libraries/GSM/src/GSM.cpp +++ b/libraries/GSM/src/GSM.cpp @@ -68,6 +68,7 @@ int arduino::GSMClass::begin(const char* pin, const char* apn, const char* usern _device->set_cmux_status_flag(_cmuxGSMenable); _device->set_retry_timeout_array(_retry_timeout, sizeof(_retry_timeout) / sizeof(_retry_timeout[0])); + _device->set_timeout(_timeout); _device->attach(mbed::callback(this, &GSMClass::onStatusChange)); _device->init(); @@ -101,6 +102,10 @@ int arduino::GSMClass::begin(const char* pin, const char* apn, const char* usern return connect_status == NSAPI_ERROR_OK ? 1 : 0; } +void arduino::GSMClass::setTimeout(unsigned long timeout) { + _timeout = timeout; +} + void arduino::GSMClass::enableCmux() { _cmuxGSMenable = true; } diff --git a/libraries/GSM/src/GSM.h b/libraries/GSM/src/GSM.h index 36549d0fb..f0cf1ff23 100644 --- a/libraries/GSM/src/GSM.h +++ b/libraries/GSM/src/GSM.h @@ -100,8 +100,12 @@ class GSMClass : public MbedSocketClass { */ void end(void); - unsigned long getTime(); + /* + * Change cellular state timeouts. Needs to be called before GSM.begin() + */ + void setTimeout(unsigned long timeout); + unsigned long getTime(); unsigned long getLocalTime(); bool setTime(unsigned long const epoch, int const timezone = 0); @@ -130,6 +134,7 @@ class GSMClass : public MbedSocketClass { mbed::CellularContext* _context = nullptr; mbed::CellularDevice* _device = nullptr; bool _at_debug = false; + unsigned long _timeout = 1000; /* Internal cellular state machine retries. Values are in seconds. * This array also defines the maximum number of retries to CELLULAR_RETRY_ARRAY_SIZE From 8b06fb3949e2aa5dfe973fdb0274864584634fab Mon Sep 17 00:00:00 2001 From: pennam Date: Wed, 16 Oct 2024 10:56:52 +0200 Subject: [PATCH 06/20] GSM: cleanup power on sequence and add comments --- libraries/GSM/src/GSM.cpp | 28 ++++++++++++++++++++++++---- libraries/GSM/src/GSM.h | 1 + 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/libraries/GSM/src/GSM.cpp b/libraries/GSM/src/GSM.cpp index 18d280747..a576801a5 100644 --- a/libraries/GSM/src/GSM.cpp +++ b/libraries/GSM/src/GSM.cpp @@ -46,10 +46,26 @@ mbed::CellularDevice *mbed::CellularDevice::get_default_instance() int arduino::GSMClass::begin(const char* pin, const char* apn, const char* username, const char* password, RadioAccessTechnologyType rat, uint32_t band, bool restart) { + /* Assume module is powered ON. Uncomment this line is you are using + * Edge Control without Arduino_ConnectionHandler + * #if defined (ARDUINO_EDGE_CONTROL) + * pinMode(ON_MKR2, OUTPUT); + * digitalWrite(ON_MKR2, HIGH); + * #endif + */ + + /* Ensure module is not under reset */ + pinMode(MBED_CONF_GEMALTO_CINTERION_RST, OUTPUT); + digitalWrite(MBED_CONF_GEMALTO_CINTERION_RST, LOW); + + /* Reset module if needed */ if (restart || isCmuxEnable()) { reset(); } + /* Create rising edge on pin ON */ + on(); + if (!_context) { _context = mbed::CellularContext::get_default_instance(); } @@ -59,9 +75,10 @@ int arduino::GSMClass::begin(const char* pin, const char* apn, const char* usern return 0; } - pinMode(MBED_CONF_GEMALTO_CINTERION_ON, INPUT_PULLDOWN); - +#if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M4) + /* This is needed to wakeup module if hw flow control is enabled */ static mbed::DigitalOut rts(MBED_CONF_GEMALTO_CINTERION_RTS, 0); +#endif _device = _context->get_device(); _device->modem_debug_on(_at_debug); @@ -159,10 +176,15 @@ NetworkInterface* arduino::GSMClass::getNetwork() { } void arduino::GSMClass::reset() { + /* Reset logic is inverted */ pinMode(MBED_CONF_GEMALTO_CINTERION_RST, OUTPUT); digitalWrite(MBED_CONF_GEMALTO_CINTERION_RST, HIGH); delay(800); digitalWrite(MBED_CONF_GEMALTO_CINTERION_RST, LOW); +} + +void arduino::GSMClass::on() { + /* Module needs a rising edge to power on */ pinMode(MBED_CONF_GEMALTO_CINTERION_ON, OUTPUT); digitalWrite(MBED_CONF_GEMALTO_CINTERION_ON, LOW); delay(1); @@ -171,6 +193,4 @@ void arduino::GSMClass::reset() { } - - arduino::GSMClass GSM; diff --git a/libraries/GSM/src/GSM.h b/libraries/GSM/src/GSM.h index f0cf1ff23..647e12bf0 100644 --- a/libraries/GSM/src/GSM.h +++ b/libraries/GSM/src/GSM.h @@ -155,6 +155,7 @@ class GSMClass : public MbedSocketClass { void onStatusChange(nsapi_event_t ev, intptr_t in); void reset(); + void on(); }; } From 69cc9c865be03426878289a85052225abcf00edf Mon Sep 17 00:00:00 2001 From: pennam Date: Thu, 31 Oct 2024 08:52:44 +0100 Subject: [PATCH 07/20] GSM: remove SYSSTART urc before shutdown --- libraries/GSM/src/GSM.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libraries/GSM/src/GSM.cpp b/libraries/GSM/src/GSM.cpp index a576801a5..3ebbf5108 100644 --- a/libraries/GSM/src/GSM.cpp +++ b/libraries/GSM/src/GSM.cpp @@ -132,7 +132,10 @@ bool arduino::GSMClass::isCmuxEnable() { } void arduino::GSMClass::end() { - _device->shutdown(); + if(_device) { + _device->shutdown(); + _device->get_at_handler()->set_urc_handler("^SYSSTART", nullptr); + } } int arduino::GSMClass::disconnect() { From e16a46cc928f12e8c922a327f8eed7335b915bcc Mon Sep 17 00:00:00 2001 From: pennam Date: Thu, 31 Oct 2024 08:53:25 +0100 Subject: [PATCH 08/20] GSM: don't disconnect if not connected --- libraries/GSM/src/GSM.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libraries/GSM/src/GSM.cpp b/libraries/GSM/src/GSM.cpp index 3ebbf5108..fc3841161 100644 --- a/libraries/GSM/src/GSM.cpp +++ b/libraries/GSM/src/GSM.cpp @@ -139,9 +139,14 @@ void arduino::GSMClass::end() { } int arduino::GSMClass::disconnect() { - if (_context) { + if (!_context) { + return 0; + } + + if (_context->is_connected()) { return _context->disconnect(); } + return 0; } From b149d28e1a11b5ffb23a57402963dad8c9476dcb Mon Sep 17 00:00:00 2001 From: pennam Date: Thu, 31 Oct 2024 08:54:19 +0100 Subject: [PATCH 09/20] GSMClient: retry write --- libraries/GSM/src/GSMClient.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/libraries/GSM/src/GSMClient.h b/libraries/GSM/src/GSMClient.h index f29292fb9..4e1b52a35 100644 --- a/libraries/GSM/src/GSMClient.h +++ b/libraries/GSM/src/GSMClient.h @@ -29,6 +29,24 @@ class GSMClient : public AClient { NetworkInterface *getNetwork() { return GSM.getNetwork(); } + + size_t write(uint8_t b) { + int ret = 0; + do { + ret = client->write(b); + delay(0); + } while (ret == 0 && status()); + return ret; + } + + size_t write(const uint8_t *buf, size_t size) { + int ret = 0; + do { + ret = client->write(buf, size); + delay(0); + } while (ret == 0 && status()); + return ret; + } }; } From 6f5d19e05de54c1980e7bb3fb0d54935dd2564da Mon Sep 17 00:00:00 2001 From: pennam Date: Thu, 31 Oct 2024 14:46:05 +0100 Subject: [PATCH 10/20] patches: GEMALTO CINTERION fixes for connection retries --- ...RION-cleanup-stack-before-connection.patch | 29 ++++++++++++++++ ...TO-CINTERION-close-socket-on-timeout.patch | 25 ++++++++++++++ ...ALTO-CINTERION-add-debug-for-urc_sis.patch | 33 +++++++++++++++++++ ...N-add-configuration-for-urcs-during-.patch | 33 +++++++++++++++++++ 4 files changed, 120 insertions(+) create mode 100644 patches/0244-GEMALTO-CINTERION-cleanup-stack-before-connection.patch create mode 100644 patches/0245-GEMALTO-CINTERION-close-socket-on-timeout.patch create mode 100644 patches/0246-GEMALTO-CINTERION-add-debug-for-urc_sis.patch create mode 100644 patches/0247-GEMALTO-CINTERION-add-configuration-for-urcs-during-.patch diff --git a/patches/0244-GEMALTO-CINTERION-cleanup-stack-before-connection.patch b/patches/0244-GEMALTO-CINTERION-cleanup-stack-before-connection.patch new file mode 100644 index 000000000..9f9634ac3 --- /dev/null +++ b/patches/0244-GEMALTO-CINTERION-cleanup-stack-before-connection.patch @@ -0,0 +1,29 @@ +From f40d4a9d65ee9163921271697d316c1061aca946 Mon Sep 17 00:00:00 2001 +From: pennam +Date: Thu, 31 Oct 2024 11:05:18 +0100 +Subject: [PATCH 244/247] GEMALTO CINTERION: cleanup stack before connection + + Allows to re-connect after a disconnection +--- + .../GEMALTO/CINTERION/GEMALTO_CINTERION_CellularContext.cpp | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularContext.cpp b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularContext.cpp +index 78955c599e..76c788cdaf 100644 +--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularContext.cpp ++++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularContext.cpp +@@ -35,6 +35,11 @@ nsapi_error_t GEMALTO_CINTERION_CellularContext::connect(const char *sim_pin, co + { + nsapi_error_t error = NSAPI_ERROR_OK; + ++ if (_stack) { ++ delete _stack; ++ _stack = NULL; ++ } ++ + set_sim_pin(sim_pin); + set_credentials(apn, uname, pwd); + +-- +2.45.2 + diff --git a/patches/0245-GEMALTO-CINTERION-close-socket-on-timeout.patch b/patches/0245-GEMALTO-CINTERION-close-socket-on-timeout.patch new file mode 100644 index 000000000..dbb627e22 --- /dev/null +++ b/patches/0245-GEMALTO-CINTERION-close-socket-on-timeout.patch @@ -0,0 +1,25 @@ +From 4b6c6ad0554c88c369fc4e2e5ed543d52117aa3f Mon Sep 17 00:00:00 2001 +From: pennam +Date: Thu, 31 Oct 2024 12:00:51 +0100 +Subject: [PATCH 245/247] GEMALTO CINTERION: close socket on timeout + +--- + .../GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp +index ac2a54282a..41a01859e7 100644 +--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp ++++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp +@@ -59,7 +59,7 @@ void GEMALTO_CINTERION_CellularStack::urc_sis() + } + if (urc_code == 0) { + int urc_info_id = _at.read_int(); +- if (urc_info_id == 48) { ++ if (urc_info_id == 48 || urc_info_id == 20) { + tr_info("Socket closed %d", sock_id); + sock->closed = true; + if (sock->_cb) { +-- +2.45.2 + diff --git a/patches/0246-GEMALTO-CINTERION-add-debug-for-urc_sis.patch b/patches/0246-GEMALTO-CINTERION-add-debug-for-urc_sis.patch new file mode 100644 index 000000000..cac7826db --- /dev/null +++ b/patches/0246-GEMALTO-CINTERION-add-debug-for-urc_sis.patch @@ -0,0 +1,33 @@ +From 84e682a7f4c0c05dded7f12817f78c1cc9a66cfe Mon Sep 17 00:00:00 2001 +From: pennam +Date: Thu, 31 Oct 2024 12:01:47 +0100 +Subject: [PATCH 246/247] GEMALTO CINTERION: add debug for urc_sis + +--- + .../GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp +index 41a01859e7..9a3f22dc3c 100644 +--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp ++++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp +@@ -47,6 +47,8 @@ void GEMALTO_CINTERION_CellularStack::urc_sis() + int sock_id = _at.read_int(); + int urc_code = _at.read_int(); + CellularSocket *sock = find_socket(sock_id); ++ ++ tr_info("urc_sis socket id %d urc code %d\n\r", sock_id, urc_code); + if (sock) { + // Currently only UDP is supported so there is need to handle only some error codes here, + // and others are detected on sendto/recvfrom responses. +@@ -59,6 +61,7 @@ void GEMALTO_CINTERION_CellularStack::urc_sis() + } + if (urc_code == 0) { + int urc_info_id = _at.read_int(); ++ tr_info("urcInfoId %d\n\r", urc_info_id); + if (urc_info_id == 48 || urc_info_id == 20) { + tr_info("Socket closed %d", sock_id); + sock->closed = true; +-- +2.45.2 + diff --git a/patches/0247-GEMALTO-CINTERION-add-configuration-for-urcs-during-.patch b/patches/0247-GEMALTO-CINTERION-add-configuration-for-urcs-during-.patch new file mode 100644 index 000000000..04298ac6e --- /dev/null +++ b/patches/0247-GEMALTO-CINTERION-add-configuration-for-urcs-during-.patch @@ -0,0 +1,33 @@ +From 5cc2a1998d37bad69a0b4e75b7d6f7b92e95935c Mon Sep 17 00:00:00 2001 +From: pennam +Date: Thu, 31 Oct 2024 12:03:00 +0100 +Subject: [PATCH 247/247] GEMALTO CINTERION: add configuration for urcs during + read + +--- + .../CINTERION/GEMALTO_CINTERION_CellularStack.cpp | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp +index 9a3f22dc3c..a96cb2b360 100644 +--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp ++++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp +@@ -527,8 +527,13 @@ sisw_retry: + return (_at.get_last_error() == NSAPI_ERROR_OK) ? accept_len : NSAPI_ERROR_DEVICE_ERROR; + } + +-#define DISABLE_URCs _at.at_cmd_discard("^SCFG", "=", "%s%s","Tcp/WithURCs","off") +-#define RESTORE_URCs_AND_RETURN(ret) do { _at.at_cmd_discard("^SCFG", "=", "%s%s","Tcp/WithURCs","on"); return ret; } while(0) ++#if defined GEMALTO_CINTERION_DISABLE_URC_READING ++ #define DISABLE_URCs _at.at_cmd_discard("^SCFG", "=", "%s%s","Tcp/WithURCs","off") ++ #define RESTORE_URCs_AND_RETURN(ret) do { _at.at_cmd_discard("^SCFG", "=", "%s%s","Tcp/WithURCs","on"); return ret; } while(0) ++#else ++ #define DISABLE_URCs ++ #define RESTORE_URCs_AND_RETURN(ret) do { return ret; } while(0) ++#endif + + nsapi_size_or_error_t GEMALTO_CINTERION_CellularStack::socket_recvfrom_impl(CellularSocket *socket, SocketAddress *address, + void *buffer, nsapi_size_t size) +-- +2.45.2 + From 131fc4194214dc41a8b5ab6452e817f24f27314b Mon Sep 17 00:00:00 2001 From: pennam Date: Thu, 14 Nov 2024 16:11:00 +0100 Subject: [PATCH 11/20] GSM: change restart flag default value to false --- libraries/GSM/src/GSM.cpp | 4 +++- libraries/GSM/src/GSM.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libraries/GSM/src/GSM.cpp b/libraries/GSM/src/GSM.cpp index fc3841161..9127021be 100644 --- a/libraries/GSM/src/GSM.cpp +++ b/libraries/GSM/src/GSM.cpp @@ -59,7 +59,9 @@ int arduino::GSMClass::begin(const char* pin, const char* apn, const char* usern digitalWrite(MBED_CONF_GEMALTO_CINTERION_RST, LOW); /* Reset module if needed */ - if (restart || isCmuxEnable()) { + const bool emergencyReset = restart || isCmuxEnable(); + DEBUG_INFO("Emergency reset %s", emergencyReset ? "enabled" : "disabled"); + if (emergencyReset) { reset(); } diff --git a/libraries/GSM/src/GSM.h b/libraries/GSM/src/GSM.h index 647e12bf0..6dea69aed 100644 --- a/libraries/GSM/src/GSM.h +++ b/libraries/GSM/src/GSM.h @@ -86,7 +86,7 @@ class GSMClass : public MbedSocketClass { * * return: 0 in case of success, negative number in case of failure */ - int begin(const char* pin, const char* apn, const char* username, const char* password, RadioAccessTechnologyType rat = CATNB, uint32_t band = BAND_20, bool restart = true); + int begin(const char* pin, const char* apn, const char* username, const char* password, RadioAccessTechnologyType rat = CATNB, uint32_t band = BAND_20, bool restart = false); /* * Disconnect from the network From 6bbf68d473be69d7db8ccd1fb3764a05e0d5cc7d Mon Sep 17 00:00:00 2001 From: pennam Date: Thu, 14 Nov 2024 16:11:33 +0100 Subject: [PATCH 12/20] GSM: add debug print about cmux status --- libraries/GSM/src/GSM.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/GSM/src/GSM.cpp b/libraries/GSM/src/GSM.cpp index 9127021be..b06d7e480 100644 --- a/libraries/GSM/src/GSM.cpp +++ b/libraries/GSM/src/GSM.cpp @@ -85,6 +85,7 @@ int arduino::GSMClass::begin(const char* pin, const char* apn, const char* usern _device = _context->get_device(); _device->modem_debug_on(_at_debug); + DEBUG_INFO("CMUX %s", _cmuxGSMenable ? "enabled" : "disabled"); _device->set_cmux_status_flag(_cmuxGSMenable); _device->set_retry_timeout_array(_retry_timeout, sizeof(_retry_timeout) / sizeof(_retry_timeout[0])); _device->set_timeout(_timeout); From 5b9662eb8048c0acdca6d07047cb0209704a2b76 Mon Sep 17 00:00:00 2001 From: pennam Date: Thu, 14 Nov 2024 16:16:29 +0100 Subject: [PATCH 13/20] GSM: squashme do not disable SYSTART urc --- libraries/GSM/src/GSM.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/libraries/GSM/src/GSM.cpp b/libraries/GSM/src/GSM.cpp index b06d7e480..683c6d762 100644 --- a/libraries/GSM/src/GSM.cpp +++ b/libraries/GSM/src/GSM.cpp @@ -137,7 +137,6 @@ bool arduino::GSMClass::isCmuxEnable() { void arduino::GSMClass::end() { if(_device) { _device->shutdown(); - _device->get_at_handler()->set_urc_handler("^SYSSTART", nullptr); } } From 056acba4e1f4031b6b35bc2527381b84fd6ac956 Mon Sep 17 00:00:00 2001 From: pennam Date: Thu, 14 Nov 2024 16:17:00 +0100 Subject: [PATCH 14/20] GSM: add ping --- libraries/GSM/src/GSM.cpp | 30 ++++++++++++++++++++++++++++++ libraries/GSM/src/GSM.h | 3 +++ 2 files changed, 33 insertions(+) diff --git a/libraries/GSM/src/GSM.cpp b/libraries/GSM/src/GSM.cpp index 683c6d762..480c06bbb 100644 --- a/libraries/GSM/src/GSM.cpp +++ b/libraries/GSM/src/GSM.cpp @@ -140,6 +140,36 @@ void arduino::GSMClass::end() { } } +int arduino::GSMClass::ping(const char* hostname, int ttl) { + + mbed::GEMALTO_CINTERION_CellularStack* stack = (mbed::GEMALTO_CINTERION_CellularStack*)_context->get_stack(); + if (!stack) { + return 0; + } + return stack->ping(hostname, ttl); +} + +int arduino::GSMClass::ping(const String &hostname, int ttl) +{ + return ping(hostname.c_str(), ttl); +} + +int arduino::GSMClass::ping(IPAddress ip, int ttl) +{ + String host; + host.reserve(15); + + host += ip[0]; + host += '.'; + host += ip[1]; + host += '.'; + host += ip[2]; + host += '.'; + host += ip[3]; + + return ping(host, ttl); +} + int arduino::GSMClass::disconnect() { if (!_context) { return 0; diff --git a/libraries/GSM/src/GSM.h b/libraries/GSM/src/GSM.h index 6dea69aed..aaea837ff 100644 --- a/libraries/GSM/src/GSM.h +++ b/libraries/GSM/src/GSM.h @@ -115,6 +115,9 @@ class GSMClass : public MbedSocketClass { void trace(Stream& stream); void setTraceLevel(int trace_level, bool timestamp = false, bool at_trace = false); #endif + int ping(const char* hostname, int ttl = 5000); + int ping(const String& hostname, int ttl = 5000); + int ping(IPAddress host, int ttl = 5000); bool isConnected(); friend class GSMClient; From 3f7b4f07dbafd605aadf6ae7d4a38961c2014f69 Mon Sep 17 00:00:00 2001 From: pennam Date: Fri, 15 Nov 2024 11:59:16 +0100 Subject: [PATCH 15/20] GSMClient GSMSSLClient: squashme retry write Additional retries on SSLCLient are needed for mqtt over tls --- libraries/GSM/src/GSMClient.h | 2 ++ libraries/GSM/src/GSMSSLClient.h | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/libraries/GSM/src/GSMClient.h b/libraries/GSM/src/GSMClient.h index 4e1b52a35..cf7d49af5 100644 --- a/libraries/GSM/src/GSMClient.h +++ b/libraries/GSM/src/GSMClient.h @@ -26,10 +26,12 @@ namespace arduino { class GSMClient : public AClient { +private: NetworkInterface *getNetwork() { return GSM.getNetwork(); } +public: size_t write(uint8_t b) { int ret = 0; do { diff --git a/libraries/GSM/src/GSMSSLClient.h b/libraries/GSM/src/GSMSSLClient.h index cc7d3c194..add77b900 100644 --- a/libraries/GSM/src/GSMSSLClient.h +++ b/libraries/GSM/src/GSMSSLClient.h @@ -32,6 +32,25 @@ class GSMSSLClient : public arduino::ASslClient { NetworkInterface *getNetwork() { return GSM.getNetwork(); } + +public: + size_t write(uint8_t b) { + int ret = 0; + do { + ret = client->write(b); + delay(0); + } while (ret == 0 && status()); + return ret; + } + + size_t write(const uint8_t *buf, size_t size) { + int ret = 0; + do { + ret = client->write(buf, size); + delay(0); + } while (ret == 0 && status()); + return ret; + } }; } From c116cb13e48cf544bc4585b26eea1db9beb6a4ec Mon Sep 17 00:00:00 2001 From: pennam Date: Fri, 15 Nov 2024 12:01:17 +0100 Subject: [PATCH 16/20] GSM: squashme fix ping return value --- libraries/GSM/src/GSM.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/GSM/src/GSM.cpp b/libraries/GSM/src/GSM.cpp index 480c06bbb..22aa1a4f3 100644 --- a/libraries/GSM/src/GSM.cpp +++ b/libraries/GSM/src/GSM.cpp @@ -144,7 +144,7 @@ int arduino::GSMClass::ping(const char* hostname, int ttl) { mbed::GEMALTO_CINTERION_CellularStack* stack = (mbed::GEMALTO_CINTERION_CellularStack*)_context->get_stack(); if (!stack) { - return 0; + return -1; } return stack->ping(hostname, ttl); } From fe52b96cb84034a277543e3bd53320bb5c153fee Mon Sep 17 00:00:00 2001 From: pennam Date: Fri, 15 Nov 2024 12:04:39 +0100 Subject: [PATCH 17/20] patches: GEMALTO CINTERION fixes --- ...TO-CINTERION-fix-enable-cmux-command.patch | 57 ++++++++++ ...CINTERION-override-shutdown-function.patch | 42 ++++++++ ...N-use-default-timeout-to-close-socke.patch | 32 ++++++ ...ON-add-soft_power_off-and-soft_reset.patch | 102 ++++++++++++++++++ ...RION-disable-runtime-model-detection.patch | 71 ++++++++++++ patches/0253-GEMALTO-CONTERION-add-ping.patch | 53 +++++++++ ...-GEMALTO-CINTERION-fix-gethostbyname.patch | 25 +++++ ...hine-wait-and-retry-if-signal-qualit.patch | 26 +++++ ...N-fix-RECV-urc-while-reading-cornerc.patch | 26 +++++ 9 files changed, 434 insertions(+) create mode 100644 patches/0248-GEMALTO-CINTERION-fix-enable-cmux-command.patch create mode 100644 patches/0249-GEMALTO-CINTERION-override-shutdown-function.patch create mode 100644 patches/0250-GEMALTO-CINTERION-use-default-timeout-to-close-socke.patch create mode 100644 patches/0251-GEMALTO-CINTERION-add-soft_power_off-and-soft_reset.patch create mode 100644 patches/0252-GEMALTO-CINTERION-disable-runtime-model-detection.patch create mode 100644 patches/0253-GEMALTO-CONTERION-add-ping.patch create mode 100644 patches/0254-GEMALTO-CINTERION-fix-gethostbyname.patch create mode 100644 patches/0255-CellularStateMachine-wait-and-retry-if-signal-qualit.patch create mode 100644 patches/0256-GEMALTO-CINTERION-fix-RECV-urc-while-reading-cornerc.patch diff --git a/patches/0248-GEMALTO-CINTERION-fix-enable-cmux-command.patch b/patches/0248-GEMALTO-CINTERION-fix-enable-cmux-command.patch new file mode 100644 index 000000000..edabb4e6d --- /dev/null +++ b/patches/0248-GEMALTO-CINTERION-fix-enable-cmux-command.patch @@ -0,0 +1,57 @@ +From a76136121ab8066a1ee4afab9254552752b96a5d Mon Sep 17 00:00:00 2001 +From: pennam +Date: Wed, 13 Nov 2024 08:28:13 +0100 +Subject: [PATCH 248/256] GEMALTO CINTERION: fix enable cmux command + +--- + .../cellular/source/framework/AT/AT_CellularDevice.cpp | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/connectivity/cellular/source/framework/AT/AT_CellularDevice.cpp b/connectivity/cellular/source/framework/AT/AT_CellularDevice.cpp +index 08229ba49b..3eccc4a5c0 100644 +--- a/connectivity/cellular/source/framework/AT/AT_CellularDevice.cpp ++++ b/connectivity/cellular/source/framework/AT/AT_CellularDevice.cpp +@@ -50,6 +50,7 @@ AT_CellularDevice::AT_CellularDevice(FileHandle *fh, char *delim): + _context_list(0), + _default_timeout(DEFAULT_AT_TIMEOUT), + _modem_debug_on(false), ++ _cmux_status(false), + _property_array(NULL) + { + MBED_ASSERT(fh); +@@ -243,10 +244,10 @@ nsapi_error_t AT_CellularDevice::get_sim_state(SimState &state) + + nsapi_error_t AT_CellularDevice::enable_cmux() + { +-setup_at_handler(); +- ++ setup_at_handler(); + _at.lock(); + for (int retry = 1; retry <= 3; retry++) { ++ is_ready(); + _at.clear_error(); + _at.flush(); + _at.at_cmd_discard("E0", ""); +@@ -259,10 +260,9 @@ setup_at_handler(); + tr_debug("Wait 100ms to init modem"); + rtos::ThisThread::sleep_for(100ms); // let modem have time to get ready + } +- return _at.unlock_return_error(); ++ return _at.unlock_return_error(); + } + +- + bool AT_CellularDevice::is_cmux_enabled() + { + return _cmux_status; +@@ -272,6 +272,7 @@ void AT_CellularDevice::set_cmux_status_flag(bool cmux_status) + { + _cmux_status = cmux_status; + } ++ + nsapi_error_t AT_CellularDevice::set_pin(const char *sim_pin) + { + // if SIM is already in ready state then settings the PIN +-- +2.45.2 + diff --git a/patches/0249-GEMALTO-CINTERION-override-shutdown-function.patch b/patches/0249-GEMALTO-CINTERION-override-shutdown-function.patch new file mode 100644 index 000000000..4b2723225 --- /dev/null +++ b/patches/0249-GEMALTO-CINTERION-override-shutdown-function.patch @@ -0,0 +1,42 @@ +From 13bc587f70e1c4f9f61650cfd7c8ebc538bdcf09 Mon Sep 17 00:00:00 2001 +From: pennam +Date: Wed, 13 Nov 2024 08:29:14 +0100 +Subject: [PATCH 249/256] GEMALTO CINTERION: override shutdown function + +--- + .../cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp | 6 ++++++ + .../drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.h | 1 + + 2 files changed, 7 insertions(+) + +diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp +index 1f82199106..c00c1880e4 100644 +--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp ++++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp +@@ -92,6 +92,12 @@ nsapi_error_t GEMALTO_CINTERION::init() + return NSAPI_ERROR_OK; + } + ++nsapi_error_t GEMALTO_CINTERION::shutdown() ++{ ++ CellularDevice::shutdown(); ++ return NSAPI_ERROR_OK; ++} ++ + GEMALTO_CINTERION::Module GEMALTO_CINTERION::get_module() + { + return _module; +diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.h b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.h +index 21d5888383..e77078cb49 100644 +--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.h ++++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.h +@@ -55,6 +55,7 @@ protected: // AT_CellularDevice + + protected: + virtual nsapi_error_t init(); ++ virtual nsapi_error_t shutdown(); + + private: + static Module _module; +-- +2.45.2 + diff --git a/patches/0250-GEMALTO-CINTERION-use-default-timeout-to-close-socke.patch b/patches/0250-GEMALTO-CINTERION-use-default-timeout-to-close-socke.patch new file mode 100644 index 000000000..0109a929b --- /dev/null +++ b/patches/0250-GEMALTO-CINTERION-use-default-timeout-to-close-socke.patch @@ -0,0 +1,32 @@ +From 62867abe6811f785373cae9e9b5cfe41774b846b Mon Sep 17 00:00:00 2001 +From: pennam +Date: Wed, 13 Nov 2024 08:30:47 +0100 +Subject: [PATCH 250/256] GEMALTO CINTERION: use default timeout to close + sockets + +--- + .../GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp +index a96cb2b360..f96ae481f0 100644 +--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp ++++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp +@@ -252,14 +252,10 @@ nsapi_error_t GEMALTO_CINTERION_CellularStack::socket_close_impl(int sock_id) + { + tr_debug("Cinterion close %d", sock_id); + +- _at.set_at_timeout(FAILURE_TIMEOUT); +- + _at.at_cmd_discard("^SISC", "=", "%d", sock_id); + + _at.clear_error(); // clear SISS even though SISC fails + +- _at.restore_at_timeout(); +- + return _at.get_last_error(); + } + +-- +2.45.2 + diff --git a/patches/0251-GEMALTO-CINTERION-add-soft_power_off-and-soft_reset.patch b/patches/0251-GEMALTO-CINTERION-add-soft_power_off-and-soft_reset.patch new file mode 100644 index 000000000..b6267af93 --- /dev/null +++ b/patches/0251-GEMALTO-CINTERION-add-soft_power_off-and-soft_reset.patch @@ -0,0 +1,102 @@ +From 7c789f289225ef631952f0ddb8ac46d2d1de9191 Mon Sep 17 00:00:00 2001 +From: pennam +Date: Thu, 14 Nov 2024 15:57:07 +0100 +Subject: [PATCH 251/256] GEMALTO CINTERION: add soft_power_off() and + soft_reset() + +--- + .../include/cellular/framework/API/CellularDevice.h | 11 +++++++++++ + .../include/cellular/framework/AT/AT_CellularDevice.h | 2 ++ + .../source/framework/AT/AT_CellularDevice.cpp | 5 +++++ + .../cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp | 10 ++++++++++ + .../cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.h | 2 ++ + 5 files changed, 30 insertions(+) + +diff --git a/connectivity/cellular/include/cellular/framework/API/CellularDevice.h b/connectivity/cellular/include/cellular/framework/API/CellularDevice.h +index 0c8d1a2db2..69455e1567 100644 +--- a/connectivity/cellular/include/cellular/framework/API/CellularDevice.h ++++ b/connectivity/cellular/include/cellular/framework/API/CellularDevice.h +@@ -201,6 +201,17 @@ public: //Pure virtual functions + */ + virtual nsapi_error_t soft_power_off() = 0; + ++ /** Resets the modem via AT command ++ * ++ * @remark CellularStateMachine disconnect or destruct does not reset the modem, ++ * but you need to do that yourself. ++ * ++ * @pre You must call shutdown to prepare the modem for reset. ++ * ++ * @return NSAPI_ERROR_OK on success ++ */ ++ virtual nsapi_error_t soft_reset() = 0; ++ + /** Open the SIM card by setting the pin code for SIM. + * + * @param sim_pin PIN for the SIM card +diff --git a/connectivity/cellular/include/cellular/framework/AT/AT_CellularDevice.h b/connectivity/cellular/include/cellular/framework/AT/AT_CellularDevice.h +index fa011a0968..0006b6c391 100755 +--- a/connectivity/cellular/include/cellular/framework/AT/AT_CellularDevice.h ++++ b/connectivity/cellular/include/cellular/framework/AT/AT_CellularDevice.h +@@ -80,6 +80,8 @@ public: + + virtual nsapi_error_t soft_power_off(); + ++ virtual nsapi_error_t soft_reset(); ++ + virtual nsapi_error_t set_pin(const char *sim_pin); + + virtual nsapi_error_t get_sim_state(SimState &state); +diff --git a/connectivity/cellular/source/framework/AT/AT_CellularDevice.cpp b/connectivity/cellular/source/framework/AT/AT_CellularDevice.cpp +index 3eccc4a5c0..d7dae05aa2 100644 +--- a/connectivity/cellular/source/framework/AT/AT_CellularDevice.cpp ++++ b/connectivity/cellular/source/framework/AT/AT_CellularDevice.cpp +@@ -187,6 +187,11 @@ nsapi_error_t AT_CellularDevice::soft_power_off() + return NSAPI_ERROR_OK; + } + ++nsapi_error_t AT_CellularDevice::soft_reset() ++{ ++ return NSAPI_ERROR_OK; ++} ++ + ATHandler *AT_CellularDevice::get_at_handler() + { + return &_at; +diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp +index c00c1880e4..40e74ab98f 100644 +--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp ++++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp +@@ -98,6 +98,16 @@ nsapi_error_t GEMALTO_CINTERION::shutdown() + return NSAPI_ERROR_OK; + } + ++nsapi_error_t GEMALTO_CINTERION::soft_power_off() ++{ ++ return _at.at_cmd_discard("^SMSO=", "fast"); ++} ++ ++nsapi_error_t GEMALTO_CINTERION::soft_reset() ++{ ++ return _at.at_cmd_discard("+CFUN", "=1,1"); ++} ++ + GEMALTO_CINTERION::Module GEMALTO_CINTERION::get_module() + { + return _module; +diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.h b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.h +index e77078cb49..edc980209e 100644 +--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.h ++++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.h +@@ -56,6 +56,8 @@ protected: // AT_CellularDevice + protected: + virtual nsapi_error_t init(); + virtual nsapi_error_t shutdown(); ++ virtual nsapi_error_t soft_power_off(); ++ virtual nsapi_error_t soft_reset(); + + private: + static Module _module; +-- +2.45.2 + diff --git a/patches/0252-GEMALTO-CINTERION-disable-runtime-model-detection.patch b/patches/0252-GEMALTO-CINTERION-disable-runtime-model-detection.patch new file mode 100644 index 000000000..70601c144 --- /dev/null +++ b/patches/0252-GEMALTO-CINTERION-disable-runtime-model-detection.patch @@ -0,0 +1,71 @@ +From 1082631c2a418ce76d003cccf247141f90433736 Mon Sep 17 00:00:00 2001 +From: pennam +Date: Thu, 14 Nov 2024 15:57:44 +0100 +Subject: [PATCH 252/256] GEMALTO CINTERION: disable runtime model detection + + cellular_properties must be configured in ctor to properly configure all network urcs +--- + .../GEMALTO/CINTERION/GEMALTO_CINTERION.cpp | 39 ++++++------------- + 1 file changed, 11 insertions(+), 28 deletions(-) + +diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp +index 40e74ab98f..3754ad50ec 100644 +--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp ++++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp +@@ -29,6 +29,17 @@ GEMALTO_CINTERION::Module GEMALTO_CINTERION::_module; + + GEMALTO_CINTERION::GEMALTO_CINTERION(FileHandle *fh) : AT_CellularDevice(fh) + { ++#if defined(MBED_CONF_GEMALTO_CINTERION_ELS61) ++ init_module_els61(); ++#elif defined(MBED_CONF_GEMALTO_CINTERION_BGS2) ++ init_module_bgs2(); ++#elif defined(MBED_CONF_GEMALTO_CINTERION_EMS31) ++ init_module_ems31(); ++#elif defined(MBED_CONF_GEMALTO_CINTERION_EHS5E) ++ init_module_ehs5e(); ++#else ++ init_module_tx62(); ++#endif + } + + AT_CellularContext *GEMALTO_CINTERION::create_context_impl(ATHandler &at, const char *apn, bool cp_req, bool nonip_req) +@@ -60,35 +71,7 @@ nsapi_error_t GEMALTO_CINTERION::init() + if (err != NSAPI_ERROR_OK) { + return err; + } +- +- CellularInformation *information = open_information(); +- if (!information) { +- return NSAPI_ERROR_NO_MEMORY; +- } +- char model[sizeof("EHS5-E") + 1]; // sizeof need to be long enough to hold just the model text +- nsapi_error_t ret = information->get_model(model, sizeof(model)); +- close_information(); +- if (ret != NSAPI_ERROR_OK) { +- tr_error("Cellular model not found!"); +- return NSAPI_ERROR_DEVICE_ERROR; +- } +- if (memcmp(model, "ELS61", sizeof("ELS61") - 1) == 0) { +- init_module_els61(); +- } else if (memcmp(model, "BGS2", sizeof("BGS2") - 1) == 0) { +- init_module_bgs2(); +- } else if (memcmp(model, "EMS31", sizeof("EMS31") - 1) == 0) { +- init_module_ems31(); +- } else if (memcmp(model, "EHS5-E", sizeof("EHS5-E") - 1) == 0) { +- init_module_ehs5e(); +- } else if (memcmp(model, "TX62", sizeof("TX62") - 1) == 0) { +- init_module_tx62(); +- } else { +- tr_error("Cinterion model unsupported %s", model); +- return NSAPI_ERROR_UNSUPPORTED; +- } +- tr_info("Cinterion model %s (%d)", model, _module); + set_at_urcs(); +- + return NSAPI_ERROR_OK; + } + +-- +2.45.2 + diff --git a/patches/0253-GEMALTO-CONTERION-add-ping.patch b/patches/0253-GEMALTO-CONTERION-add-ping.patch new file mode 100644 index 000000000..1ad1c820e --- /dev/null +++ b/patches/0253-GEMALTO-CONTERION-add-ping.patch @@ -0,0 +1,53 @@ +From 09a4787109efd233aded2b960fcdfa10587eec9d Mon Sep 17 00:00:00 2001 +From: pennam +Date: Thu, 14 Nov 2024 15:59:37 +0100 +Subject: [PATCH 253/256] GEMALTO CONTERION: add ping + +--- + .../GEMALTO_CINTERION_CellularStack.cpp | 17 +++++++++++++++++ + .../CINTERION/GEMALTO_CINTERION_CellularStack.h | 1 + + 2 files changed, 18 insertions(+) + +diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp +index f96ae481f0..938cdbfef2 100644 +--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp ++++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp +@@ -224,6 +224,23 @@ void GEMALTO_CINTERION_CellularStack::PSMDisable() { + } + } + ++int GEMALTO_CINTERION_CellularStack::ping(const char *host, int ttl) ++{ ++ MBED_ASSERT(host); ++ ++ _at.lock(); ++ _at.set_at_timeout(ttl + 1000); ++ _at.cmd_start_stop("^SISX", "=", "%s%d%s%d%d", "Ping", _cid, host, 1, ttl); ++ _at.resp_start("^SISX: \"Ping\","); ++ _at.skip_param(3); //pingInfoType, conProfileId, ip-address ++ int rTT = _at.read_int(); //roundTripTime ++ _at.resp_stop(); ++ _at.clear_error(); ++ _at.restore_at_timeout(); ++ _at.unlock(); ++ return rTT; ++} ++ + nsapi_error_t GEMALTO_CINTERION_CellularStack::socket_stack_init() + { + _at.lock(); +diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.h b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.h +index f89da8c314..159ea68aa9 100644 +--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.h ++++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.h +@@ -43,6 +43,7 @@ public: + void stopGNSS(); + void PSMEnable(); + void PSMDisable(); ++ int ping(const char *host, int ttl); + + protected: + +-- +2.45.2 + diff --git a/patches/0254-GEMALTO-CINTERION-fix-gethostbyname.patch b/patches/0254-GEMALTO-CINTERION-fix-gethostbyname.patch new file mode 100644 index 000000000..7be231807 --- /dev/null +++ b/patches/0254-GEMALTO-CINTERION-fix-gethostbyname.patch @@ -0,0 +1,25 @@ +From 46b1511db274990eb52e89c31e3e26af01d48d38 Mon Sep 17 00:00:00 2001 +From: pennam +Date: Thu, 14 Nov 2024 16:00:17 +0100 +Subject: [PATCH 254/256] GEMALTO CINTERION: fix gethostbyname() + + Add missing _at.unlock() +--- + .../GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp +index 938cdbfef2..8f7b44818a 100644 +--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp ++++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp +@@ -309,6 +309,7 @@ nsapi_error_t GEMALTO_CINTERION_CellularStack::gethostbyname(const char *host, S + } else { + //Null string received + tr_info("Read %d bytes. Null string", size); ++ _at.unlock(); + return NSAPI_ERROR_NO_ADDRESS; + } + } +-- +2.45.2 + diff --git a/patches/0255-CellularStateMachine-wait-and-retry-if-signal-qualit.patch b/patches/0255-CellularStateMachine-wait-and-retry-if-signal-qualit.patch new file mode 100644 index 000000000..1b4b6530a --- /dev/null +++ b/patches/0255-CellularStateMachine-wait-and-retry-if-signal-qualit.patch @@ -0,0 +1,26 @@ +From fd40e55bb7b121a0485bec2159672673b6c9bbf4 Mon Sep 17 00:00:00 2001 +From: pennam +Date: Thu, 14 Nov 2024 16:03:10 +0100 +Subject: [PATCH 255/256] CellularStateMachine: wait and retry if signal + quality is unknown + +--- + .../cellular/source/framework/device/CellularStateMachine.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/connectivity/cellular/source/framework/device/CellularStateMachine.cpp b/connectivity/cellular/source/framework/device/CellularStateMachine.cpp +index 37416ca72e..a87c9e0d02 100644 +--- a/connectivity/cellular/source/framework/device/CellularStateMachine.cpp ++++ b/connectivity/cellular/source/framework/device/CellularStateMachine.cpp +@@ -458,7 +458,7 @@ void CellularStateMachine::state_signal_quality() + { + _cb_data.error = _network.get_signal_quality(_signal_quality.rssi, &_signal_quality.ber); + +- if (_cb_data.error != NSAPI_ERROR_OK) { ++ if ((_cb_data.error != NSAPI_ERROR_OK) || (_signal_quality.rssi == CellularNetwork::SignalQuality::SignalQualityUnknown)) { + retry_state_or_fail(); + } else { + _cb_data.data = &_signal_quality; +-- +2.45.2 + diff --git a/patches/0256-GEMALTO-CINTERION-fix-RECV-urc-while-reading-cornerc.patch b/patches/0256-GEMALTO-CINTERION-fix-RECV-urc-while-reading-cornerc.patch new file mode 100644 index 000000000..d0ebcb51f --- /dev/null +++ b/patches/0256-GEMALTO-CINTERION-fix-RECV-urc-while-reading-cornerc.patch @@ -0,0 +1,26 @@ +From b1dabe5a8983493bab170e2d8b8f2a1ba40e4199 Mon Sep 17 00:00:00 2001 +From: pennam +Date: Fri, 15 Nov 2024 11:37:52 +0100 +Subject: [PATCH 256/256] GEMALTO CINTERION fix RECV urc while reading + cornercase + +--- + .../GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp +index 8f7b44818a..d164f85eb2 100644 +--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp ++++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp +@@ -598,6 +598,8 @@ sisr_retry: + if (len == 0) { + tr_debug("Socket %d no data", socket->id); + _at.resp_stop(); ++ _at.process_oob(); ++ socket->pending_bytes = 0; + RESTORE_URCs_AND_RETURN(NSAPI_ERROR_WOULD_BLOCK); + } + if (len == -1) { +-- +2.45.2 + From cdf2b39862a7617b9a3fd31b5225f8f17f121bac Mon Sep 17 00:00:00 2001 From: pennam Date: Fri, 15 Nov 2024 12:40:54 +0100 Subject: [PATCH 18/20] GSM: add software reset and power off --- libraries/GSM/src/GSM.cpp | 16 ++++++++++++++-- libraries/GSM/src/GSM.h | 12 +++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/libraries/GSM/src/GSM.cpp b/libraries/GSM/src/GSM.cpp index 22aa1a4f3..513b7d0dc 100644 --- a/libraries/GSM/src/GSM.cpp +++ b/libraries/GSM/src/GSM.cpp @@ -62,7 +62,7 @@ int arduino::GSMClass::begin(const char* pin, const char* apn, const char* usern const bool emergencyReset = restart || isCmuxEnable(); DEBUG_INFO("Emergency reset %s", emergencyReset ? "enabled" : "disabled"); if (emergencyReset) { - reset(); + hardwareReset(); } /* Create rising edge on pin ON */ @@ -140,6 +140,18 @@ void arduino::GSMClass::end() { } } +void arduino::GSMClass::reset() { + if(_device) { + _device->soft_reset(); + } +} + +void arduino::GSMClass::off() { + if(_device) { + _device->soft_power_off(); + } +} + int arduino::GSMClass::ping(const char* hostname, int ttl) { mbed::GEMALTO_CINTERION_CellularStack* stack = (mbed::GEMALTO_CINTERION_CellularStack*)_context->get_stack(); @@ -215,7 +227,7 @@ NetworkInterface* arduino::GSMClass::getNetwork() { return _context; } -void arduino::GSMClass::reset() { +void arduino::GSMClass::hardwareReset() { /* Reset logic is inverted */ pinMode(MBED_CONF_GEMALTO_CINTERION_RST, OUTPUT); digitalWrite(MBED_CONF_GEMALTO_CINTERION_RST, HIGH); diff --git a/libraries/GSM/src/GSM.h b/libraries/GSM/src/GSM.h index aaea837ff..9f19cd3e0 100644 --- a/libraries/GSM/src/GSM.h +++ b/libraries/GSM/src/GSM.h @@ -100,6 +100,16 @@ class GSMClass : public MbedSocketClass { */ void end(void); + /* + * Send AT+CFUN=1,1 command to trigger a software reset. To be called only after end(); + */ + void reset(); + + /* + * Send AT^SMSO="fast command to power off the modem. To be called only after end(); + */ + void off(); + /* * Change cellular state timeouts. Needs to be called before GSM.begin() */ @@ -157,7 +167,7 @@ class GSMClass : public MbedSocketClass { static const char * getRegistrationStateString(const mbed::CellularNetwork::RegistrationStatus state); void onStatusChange(nsapi_event_t ev, intptr_t in); - void reset(); + void hardwareReset(); void on(); }; From 7039fb925d91efca218e23ceff5de6b81810d956 Mon Sep 17 00:00:00 2001 From: pennam Date: Wed, 26 Mar 2025 15:33:54 +0100 Subject: [PATCH 19/20] patches: fix order --- ...248-GEMALTO-CINTERION-cleanup-stack-before-connection.patch} | 2 +- ...tch => 0249-GEMALTO-CINTERION-close-socket-on-timeout.patch} | 2 +- ...patch => 0250-GEMALTO-CINTERION-add-debug-for-urc_sis.patch} | 2 +- ...-GEMALTO-CINTERION-add-configuration-for-urcs-during-.patch} | 2 +- ...tch => 0252-GEMALTO-CINTERION-fix-enable-cmux-command.patch} | 2 +- ... => 0253-GEMALTO-CINTERION-override-shutdown-function.patch} | 2 +- ...-GEMALTO-CINTERION-use-default-timeout-to-close-socke.patch} | 2 +- ...5-GEMALTO-CINTERION-add-soft_power_off-and-soft_reset.patch} | 2 +- ...256-GEMALTO-CINTERION-disable-runtime-model-detection.patch} | 2 +- ...ION-add-ping.patch => 0257-GEMALTO-CONTERION-add-ping.patch} | 2 +- ...ame.patch => 0258-GEMALTO-CINTERION-fix-gethostbyname.patch} | 2 +- ...-CellularStateMachine-wait-and-retry-if-signal-qualit.patch} | 2 +- ...-GEMALTO-CINTERION-fix-RECV-urc-while-reading-cornerc.patch} | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) rename patches/{0244-GEMALTO-CINTERION-cleanup-stack-before-connection.patch => 0248-GEMALTO-CINTERION-cleanup-stack-before-connection.patch} (93%) rename patches/{0245-GEMALTO-CINTERION-close-socket-on-timeout.patch => 0249-GEMALTO-CINTERION-close-socket-on-timeout.patch} (93%) rename patches/{0246-GEMALTO-CINTERION-add-debug-for-urc_sis.patch => 0250-GEMALTO-CINTERION-add-debug-for-urc_sis.patch} (95%) rename patches/{0247-GEMALTO-CINTERION-add-configuration-for-urcs-during-.patch => 0251-GEMALTO-CINTERION-add-configuration-for-urcs-during-.patch} (95%) rename patches/{0248-GEMALTO-CINTERION-fix-enable-cmux-command.patch => 0252-GEMALTO-CINTERION-fix-enable-cmux-command.patch} (96%) rename patches/{0249-GEMALTO-CINTERION-override-shutdown-function.patch => 0253-GEMALTO-CINTERION-override-shutdown-function.patch} (95%) rename patches/{0250-GEMALTO-CINTERION-use-default-timeout-to-close-socke.patch => 0254-GEMALTO-CINTERION-use-default-timeout-to-close-socke.patch} (93%) rename patches/{0251-GEMALTO-CINTERION-add-soft_power_off-and-soft_reset.patch => 0255-GEMALTO-CINTERION-add-soft_power_off-and-soft_reset.patch} (98%) rename patches/{0252-GEMALTO-CINTERION-disable-runtime-model-detection.patch => 0256-GEMALTO-CINTERION-disable-runtime-model-detection.patch} (97%) rename patches/{0253-GEMALTO-CONTERION-add-ping.patch => 0257-GEMALTO-CONTERION-add-ping.patch} (97%) rename patches/{0254-GEMALTO-CINTERION-fix-gethostbyname.patch => 0258-GEMALTO-CINTERION-fix-gethostbyname.patch} (93%) rename patches/{0255-CellularStateMachine-wait-and-retry-if-signal-qualit.patch => 0259-CellularStateMachine-wait-and-retry-if-signal-qualit.patch} (93%) rename patches/{0256-GEMALTO-CINTERION-fix-RECV-urc-while-reading-cornerc.patch => 0260-GEMALTO-CINTERION-fix-RECV-urc-while-reading-cornerc.patch} (93%) diff --git a/patches/0244-GEMALTO-CINTERION-cleanup-stack-before-connection.patch b/patches/0248-GEMALTO-CINTERION-cleanup-stack-before-connection.patch similarity index 93% rename from patches/0244-GEMALTO-CINTERION-cleanup-stack-before-connection.patch rename to patches/0248-GEMALTO-CINTERION-cleanup-stack-before-connection.patch index 9f9634ac3..d9cb9e31c 100644 --- a/patches/0244-GEMALTO-CINTERION-cleanup-stack-before-connection.patch +++ b/patches/0248-GEMALTO-CINTERION-cleanup-stack-before-connection.patch @@ -1,7 +1,7 @@ From f40d4a9d65ee9163921271697d316c1061aca946 Mon Sep 17 00:00:00 2001 From: pennam Date: Thu, 31 Oct 2024 11:05:18 +0100 -Subject: [PATCH 244/247] GEMALTO CINTERION: cleanup stack before connection +Subject: [PATCH] GEMALTO CINTERION: cleanup stack before connection Allows to re-connect after a disconnection --- diff --git a/patches/0245-GEMALTO-CINTERION-close-socket-on-timeout.patch b/patches/0249-GEMALTO-CINTERION-close-socket-on-timeout.patch similarity index 93% rename from patches/0245-GEMALTO-CINTERION-close-socket-on-timeout.patch rename to patches/0249-GEMALTO-CINTERION-close-socket-on-timeout.patch index dbb627e22..1fbb4021a 100644 --- a/patches/0245-GEMALTO-CINTERION-close-socket-on-timeout.patch +++ b/patches/0249-GEMALTO-CINTERION-close-socket-on-timeout.patch @@ -1,7 +1,7 @@ From 4b6c6ad0554c88c369fc4e2e5ed543d52117aa3f Mon Sep 17 00:00:00 2001 From: pennam Date: Thu, 31 Oct 2024 12:00:51 +0100 -Subject: [PATCH 245/247] GEMALTO CINTERION: close socket on timeout +Subject: [PATCH] GEMALTO CINTERION: close socket on timeout --- .../GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp | 2 +- diff --git a/patches/0246-GEMALTO-CINTERION-add-debug-for-urc_sis.patch b/patches/0250-GEMALTO-CINTERION-add-debug-for-urc_sis.patch similarity index 95% rename from patches/0246-GEMALTO-CINTERION-add-debug-for-urc_sis.patch rename to patches/0250-GEMALTO-CINTERION-add-debug-for-urc_sis.patch index cac7826db..4c41b0918 100644 --- a/patches/0246-GEMALTO-CINTERION-add-debug-for-urc_sis.patch +++ b/patches/0250-GEMALTO-CINTERION-add-debug-for-urc_sis.patch @@ -1,7 +1,7 @@ From 84e682a7f4c0c05dded7f12817f78c1cc9a66cfe Mon Sep 17 00:00:00 2001 From: pennam Date: Thu, 31 Oct 2024 12:01:47 +0100 -Subject: [PATCH 246/247] GEMALTO CINTERION: add debug for urc_sis +Subject: [PATCH] GEMALTO CINTERION: add debug for urc_sis --- .../GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp | 3 +++ diff --git a/patches/0247-GEMALTO-CINTERION-add-configuration-for-urcs-during-.patch b/patches/0251-GEMALTO-CINTERION-add-configuration-for-urcs-during-.patch similarity index 95% rename from patches/0247-GEMALTO-CINTERION-add-configuration-for-urcs-during-.patch rename to patches/0251-GEMALTO-CINTERION-add-configuration-for-urcs-during-.patch index 04298ac6e..290452457 100644 --- a/patches/0247-GEMALTO-CINTERION-add-configuration-for-urcs-during-.patch +++ b/patches/0251-GEMALTO-CINTERION-add-configuration-for-urcs-during-.patch @@ -1,7 +1,7 @@ From 5cc2a1998d37bad69a0b4e75b7d6f7b92e95935c Mon Sep 17 00:00:00 2001 From: pennam Date: Thu, 31 Oct 2024 12:03:00 +0100 -Subject: [PATCH 247/247] GEMALTO CINTERION: add configuration for urcs during +Subject: [PATCH] GEMALTO CINTERION: add configuration for urcs during read --- diff --git a/patches/0248-GEMALTO-CINTERION-fix-enable-cmux-command.patch b/patches/0252-GEMALTO-CINTERION-fix-enable-cmux-command.patch similarity index 96% rename from patches/0248-GEMALTO-CINTERION-fix-enable-cmux-command.patch rename to patches/0252-GEMALTO-CINTERION-fix-enable-cmux-command.patch index edabb4e6d..711836c5d 100644 --- a/patches/0248-GEMALTO-CINTERION-fix-enable-cmux-command.patch +++ b/patches/0252-GEMALTO-CINTERION-fix-enable-cmux-command.patch @@ -1,7 +1,7 @@ From a76136121ab8066a1ee4afab9254552752b96a5d Mon Sep 17 00:00:00 2001 From: pennam Date: Wed, 13 Nov 2024 08:28:13 +0100 -Subject: [PATCH 248/256] GEMALTO CINTERION: fix enable cmux command +Subject: [PATCH] GEMALTO CINTERION: fix enable cmux command --- .../cellular/source/framework/AT/AT_CellularDevice.cpp | 9 +++++---- diff --git a/patches/0249-GEMALTO-CINTERION-override-shutdown-function.patch b/patches/0253-GEMALTO-CINTERION-override-shutdown-function.patch similarity index 95% rename from patches/0249-GEMALTO-CINTERION-override-shutdown-function.patch rename to patches/0253-GEMALTO-CINTERION-override-shutdown-function.patch index 4b2723225..e100a7b01 100644 --- a/patches/0249-GEMALTO-CINTERION-override-shutdown-function.patch +++ b/patches/0253-GEMALTO-CINTERION-override-shutdown-function.patch @@ -1,7 +1,7 @@ From 13bc587f70e1c4f9f61650cfd7c8ebc538bdcf09 Mon Sep 17 00:00:00 2001 From: pennam Date: Wed, 13 Nov 2024 08:29:14 +0100 -Subject: [PATCH 249/256] GEMALTO CINTERION: override shutdown function +Subject: [PATCH] GEMALTO CINTERION: override shutdown function --- .../cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp | 6 ++++++ diff --git a/patches/0250-GEMALTO-CINTERION-use-default-timeout-to-close-socke.patch b/patches/0254-GEMALTO-CINTERION-use-default-timeout-to-close-socke.patch similarity index 93% rename from patches/0250-GEMALTO-CINTERION-use-default-timeout-to-close-socke.patch rename to patches/0254-GEMALTO-CINTERION-use-default-timeout-to-close-socke.patch index 0109a929b..86975735d 100644 --- a/patches/0250-GEMALTO-CINTERION-use-default-timeout-to-close-socke.patch +++ b/patches/0254-GEMALTO-CINTERION-use-default-timeout-to-close-socke.patch @@ -1,7 +1,7 @@ From 62867abe6811f785373cae9e9b5cfe41774b846b Mon Sep 17 00:00:00 2001 From: pennam Date: Wed, 13 Nov 2024 08:30:47 +0100 -Subject: [PATCH 250/256] GEMALTO CINTERION: use default timeout to close +Subject: [PATCH] GEMALTO CINTERION: use default timeout to close sockets --- diff --git a/patches/0251-GEMALTO-CINTERION-add-soft_power_off-and-soft_reset.patch b/patches/0255-GEMALTO-CINTERION-add-soft_power_off-and-soft_reset.patch similarity index 98% rename from patches/0251-GEMALTO-CINTERION-add-soft_power_off-and-soft_reset.patch rename to patches/0255-GEMALTO-CINTERION-add-soft_power_off-and-soft_reset.patch index b6267af93..82bd81c15 100644 --- a/patches/0251-GEMALTO-CINTERION-add-soft_power_off-and-soft_reset.patch +++ b/patches/0255-GEMALTO-CINTERION-add-soft_power_off-and-soft_reset.patch @@ -1,7 +1,7 @@ From 7c789f289225ef631952f0ddb8ac46d2d1de9191 Mon Sep 17 00:00:00 2001 From: pennam Date: Thu, 14 Nov 2024 15:57:07 +0100 -Subject: [PATCH 251/256] GEMALTO CINTERION: add soft_power_off() and +Subject: [PATCH] GEMALTO CINTERION: add soft_power_off() and soft_reset() --- diff --git a/patches/0252-GEMALTO-CINTERION-disable-runtime-model-detection.patch b/patches/0256-GEMALTO-CINTERION-disable-runtime-model-detection.patch similarity index 97% rename from patches/0252-GEMALTO-CINTERION-disable-runtime-model-detection.patch rename to patches/0256-GEMALTO-CINTERION-disable-runtime-model-detection.patch index 70601c144..886e626f3 100644 --- a/patches/0252-GEMALTO-CINTERION-disable-runtime-model-detection.patch +++ b/patches/0256-GEMALTO-CINTERION-disable-runtime-model-detection.patch @@ -1,7 +1,7 @@ From 1082631c2a418ce76d003cccf247141f90433736 Mon Sep 17 00:00:00 2001 From: pennam Date: Thu, 14 Nov 2024 15:57:44 +0100 -Subject: [PATCH 252/256] GEMALTO CINTERION: disable runtime model detection +Subject: [PATCH] GEMALTO CINTERION: disable runtime model detection cellular_properties must be configured in ctor to properly configure all network urcs --- diff --git a/patches/0253-GEMALTO-CONTERION-add-ping.patch b/patches/0257-GEMALTO-CONTERION-add-ping.patch similarity index 97% rename from patches/0253-GEMALTO-CONTERION-add-ping.patch rename to patches/0257-GEMALTO-CONTERION-add-ping.patch index 1ad1c820e..de6012bdc 100644 --- a/patches/0253-GEMALTO-CONTERION-add-ping.patch +++ b/patches/0257-GEMALTO-CONTERION-add-ping.patch @@ -1,7 +1,7 @@ From 09a4787109efd233aded2b960fcdfa10587eec9d Mon Sep 17 00:00:00 2001 From: pennam Date: Thu, 14 Nov 2024 15:59:37 +0100 -Subject: [PATCH 253/256] GEMALTO CONTERION: add ping +Subject: [PATCH] GEMALTO CONTERION: add ping --- .../GEMALTO_CINTERION_CellularStack.cpp | 17 +++++++++++++++++ diff --git a/patches/0254-GEMALTO-CINTERION-fix-gethostbyname.patch b/patches/0258-GEMALTO-CINTERION-fix-gethostbyname.patch similarity index 93% rename from patches/0254-GEMALTO-CINTERION-fix-gethostbyname.patch rename to patches/0258-GEMALTO-CINTERION-fix-gethostbyname.patch index 7be231807..730a4c690 100644 --- a/patches/0254-GEMALTO-CINTERION-fix-gethostbyname.patch +++ b/patches/0258-GEMALTO-CINTERION-fix-gethostbyname.patch @@ -1,7 +1,7 @@ From 46b1511db274990eb52e89c31e3e26af01d48d38 Mon Sep 17 00:00:00 2001 From: pennam Date: Thu, 14 Nov 2024 16:00:17 +0100 -Subject: [PATCH 254/256] GEMALTO CINTERION: fix gethostbyname() +Subject: [PATCH] GEMALTO CINTERION: fix gethostbyname() Add missing _at.unlock() --- diff --git a/patches/0255-CellularStateMachine-wait-and-retry-if-signal-qualit.patch b/patches/0259-CellularStateMachine-wait-and-retry-if-signal-qualit.patch similarity index 93% rename from patches/0255-CellularStateMachine-wait-and-retry-if-signal-qualit.patch rename to patches/0259-CellularStateMachine-wait-and-retry-if-signal-qualit.patch index 1b4b6530a..ebe18ff8c 100644 --- a/patches/0255-CellularStateMachine-wait-and-retry-if-signal-qualit.patch +++ b/patches/0259-CellularStateMachine-wait-and-retry-if-signal-qualit.patch @@ -1,7 +1,7 @@ From fd40e55bb7b121a0485bec2159672673b6c9bbf4 Mon Sep 17 00:00:00 2001 From: pennam Date: Thu, 14 Nov 2024 16:03:10 +0100 -Subject: [PATCH 255/256] CellularStateMachine: wait and retry if signal +Subject: [PATCH] CellularStateMachine: wait and retry if signal quality is unknown --- diff --git a/patches/0256-GEMALTO-CINTERION-fix-RECV-urc-while-reading-cornerc.patch b/patches/0260-GEMALTO-CINTERION-fix-RECV-urc-while-reading-cornerc.patch similarity index 93% rename from patches/0256-GEMALTO-CINTERION-fix-RECV-urc-while-reading-cornerc.patch rename to patches/0260-GEMALTO-CINTERION-fix-RECV-urc-while-reading-cornerc.patch index d0ebcb51f..6a9a09835 100644 --- a/patches/0256-GEMALTO-CINTERION-fix-RECV-urc-while-reading-cornerc.patch +++ b/patches/0260-GEMALTO-CINTERION-fix-RECV-urc-while-reading-cornerc.patch @@ -1,7 +1,7 @@ From b1dabe5a8983493bab170e2d8b8f2a1ba40e4199 Mon Sep 17 00:00:00 2001 From: pennam Date: Fri, 15 Nov 2024 11:37:52 +0100 -Subject: [PATCH 256/256] GEMALTO CINTERION fix RECV urc while reading +Subject: [PATCH] GEMALTO CINTERION fix RECV urc while reading cornercase --- From fca572f43c556cac62450fe6e87fc4cbf837de38 Mon Sep 17 00:00:00 2001 From: pennam Date: Wed, 26 Mar 2025 15:36:45 +0100 Subject: [PATCH 20/20] patches: add sleep after socket write --- ...ERION-add-1ms-sleep-in-socket-sendto.patch | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 patches/0261-GEMALTO-CINTERION-add-1ms-sleep-in-socket-sendto.patch diff --git a/patches/0261-GEMALTO-CINTERION-add-1ms-sleep-in-socket-sendto.patch b/patches/0261-GEMALTO-CINTERION-add-1ms-sleep-in-socket-sendto.patch new file mode 100644 index 000000000..41f843488 --- /dev/null +++ b/patches/0261-GEMALTO-CINTERION-add-1ms-sleep-in-socket-sendto.patch @@ -0,0 +1,33 @@ +From ec7cc4e660b366364d8b11e4ee6480c41141ff04 Mon Sep 17 00:00:00 2001 +From: pennam +Date: Wed, 26 Mar 2025 15:08:40 +0100 +Subject: [PATCH] GEMALTO CINTERION: add 1ms sleep in socket sendto + +--- + .../GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp +index d164f85eb2..898f81cf66 100644 +--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp ++++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp +@@ -19,6 +19,7 @@ + #include "GEMALTO_CINTERION_CellularStack.h" + #include "GEMALTO_CINTERION.h" + #include "CellularLog.h" ++#include "platform/mbed_thread.h" + #include "rtos.h" + + using namespace std::chrono_literals; +@@ -538,6 +539,8 @@ sisw_retry: + socket->tx_ready = false; + } + ++ thread_sleep_for(1); // wait for modem to process the data; ++ + return (_at.get_last_error() == NSAPI_ERROR_OK) ? accept_len : NSAPI_ERROR_DEVICE_ERROR; + } + +-- +2.47.2 +