Skip to content

Commit 5816be9

Browse files
committed
patches: GEMALTO CINTERION fixes for connection retries
1 parent d95d934 commit 5816be9

14 files changed

+587
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
From f40d4a9d65ee9163921271697d316c1061aca946 Mon Sep 17 00:00:00 2001
2+
From: pennam <m.pennasilico@arduino.cc>
3+
Date: Thu, 31 Oct 2024 11:05:18 +0100
4+
Subject: [PATCH] GEMALTO CINTERION: cleanup stack before connection
5+
6+
Allows to re-connect after a disconnection
7+
---
8+
.../GEMALTO/CINTERION/GEMALTO_CINTERION_CellularContext.cpp | 5 +++++
9+
1 file changed, 5 insertions(+)
10+
11+
diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularContext.cpp b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularContext.cpp
12+
index 78955c599e..76c788cdaf 100644
13+
--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularContext.cpp
14+
+++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularContext.cpp
15+
@@ -35,6 +35,11 @@ nsapi_error_t GEMALTO_CINTERION_CellularContext::connect(const char *sim_pin, co
16+
{
17+
nsapi_error_t error = NSAPI_ERROR_OK;
18+
19+
+ if (_stack) {
20+
+ delete _stack;
21+
+ _stack = NULL;
22+
+ }
23+
+
24+
set_sim_pin(sim_pin);
25+
set_credentials(apn, uname, pwd);
26+
27+
--
28+
2.45.2
29+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
From 4b6c6ad0554c88c369fc4e2e5ed543d52117aa3f Mon Sep 17 00:00:00 2001
2+
From: pennam <m.pennasilico@arduino.cc>
3+
Date: Thu, 31 Oct 2024 12:00:51 +0100
4+
Subject: [PATCH] GEMALTO CINTERION: close socket on timeout
5+
6+
---
7+
.../GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp | 2 +-
8+
1 file changed, 1 insertion(+), 1 deletion(-)
9+
10+
diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp
11+
index ac2a54282a..41a01859e7 100644
12+
--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp
13+
+++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp
14+
@@ -59,7 +59,7 @@ void GEMALTO_CINTERION_CellularStack::urc_sis()
15+
}
16+
if (urc_code == 0) {
17+
int urc_info_id = _at.read_int();
18+
- if (urc_info_id == 48) {
19+
+ if (urc_info_id == 48 || urc_info_id == 20) {
20+
tr_info("Socket closed %d", sock_id);
21+
sock->closed = true;
22+
if (sock->_cb) {
23+
--
24+
2.45.2
25+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
From 84e682a7f4c0c05dded7f12817f78c1cc9a66cfe Mon Sep 17 00:00:00 2001
2+
From: pennam <m.pennasilico@arduino.cc>
3+
Date: Thu, 31 Oct 2024 12:01:47 +0100
4+
Subject: [PATCH] GEMALTO CINTERION: add debug for urc_sis
5+
6+
---
7+
.../GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp | 3 +++
8+
1 file changed, 3 insertions(+)
9+
10+
diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp
11+
index 41a01859e7..9a3f22dc3c 100644
12+
--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp
13+
+++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp
14+
@@ -47,6 +47,8 @@ void GEMALTO_CINTERION_CellularStack::urc_sis()
15+
int sock_id = _at.read_int();
16+
int urc_code = _at.read_int();
17+
CellularSocket *sock = find_socket(sock_id);
18+
+
19+
+ tr_info("urc_sis socket id %d urc code %d\n\r", sock_id, urc_code);
20+
if (sock) {
21+
// Currently only UDP is supported so there is need to handle only some error codes here,
22+
// and others are detected on sendto/recvfrom responses.
23+
@@ -59,6 +61,7 @@ void GEMALTO_CINTERION_CellularStack::urc_sis()
24+
}
25+
if (urc_code == 0) {
26+
int urc_info_id = _at.read_int();
27+
+ tr_info("urcInfoId %d\n\r", urc_info_id);
28+
if (urc_info_id == 48 || urc_info_id == 20) {
29+
tr_info("Socket closed %d", sock_id);
30+
sock->closed = true;
31+
--
32+
2.45.2
33+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
From 5cc2a1998d37bad69a0b4e75b7d6f7b92e95935c Mon Sep 17 00:00:00 2001
2+
From: pennam <m.pennasilico@arduino.cc>
3+
Date: Thu, 31 Oct 2024 12:03:00 +0100
4+
Subject: [PATCH] GEMALTO CINTERION: add configuration for urcs during
5+
read
6+
7+
---
8+
.../CINTERION/GEMALTO_CINTERION_CellularStack.cpp | 9 +++++++--
9+
1 file changed, 7 insertions(+), 2 deletions(-)
10+
11+
diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp
12+
index 9a3f22dc3c..a96cb2b360 100644
13+
--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp
14+
+++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp
15+
@@ -527,8 +527,13 @@ sisw_retry:
16+
return (_at.get_last_error() == NSAPI_ERROR_OK) ? accept_len : NSAPI_ERROR_DEVICE_ERROR;
17+
}
18+
19+
-#define DISABLE_URCs _at.at_cmd_discard("^SCFG", "=", "%s%s","Tcp/WithURCs","off")
20+
-#define RESTORE_URCs_AND_RETURN(ret) do { _at.at_cmd_discard("^SCFG", "=", "%s%s","Tcp/WithURCs","on"); return ret; } while(0)
21+
+#if defined GEMALTO_CINTERION_DISABLE_URC_READING
22+
+ #define DISABLE_URCs _at.at_cmd_discard("^SCFG", "=", "%s%s","Tcp/WithURCs","off")
23+
+ #define RESTORE_URCs_AND_RETURN(ret) do { _at.at_cmd_discard("^SCFG", "=", "%s%s","Tcp/WithURCs","on"); return ret; } while(0)
24+
+#else
25+
+ #define DISABLE_URCs
26+
+ #define RESTORE_URCs_AND_RETURN(ret) do { return ret; } while(0)
27+
+#endif
28+
29+
nsapi_size_or_error_t GEMALTO_CINTERION_CellularStack::socket_recvfrom_impl(CellularSocket *socket, SocketAddress *address,
30+
void *buffer, nsapi_size_t size)
31+
--
32+
2.45.2
33+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
From a76136121ab8066a1ee4afab9254552752b96a5d Mon Sep 17 00:00:00 2001
2+
From: pennam <m.pennasilico@arduino.cc>
3+
Date: Wed, 13 Nov 2024 08:28:13 +0100
4+
Subject: [PATCH] GEMALTO CINTERION: fix enable cmux command
5+
6+
---
7+
.../cellular/source/framework/AT/AT_CellularDevice.cpp | 9 +++++----
8+
1 file changed, 5 insertions(+), 4 deletions(-)
9+
10+
diff --git a/connectivity/cellular/source/framework/AT/AT_CellularDevice.cpp b/connectivity/cellular/source/framework/AT/AT_CellularDevice.cpp
11+
index 08229ba49b..3eccc4a5c0 100644
12+
--- a/connectivity/cellular/source/framework/AT/AT_CellularDevice.cpp
13+
+++ b/connectivity/cellular/source/framework/AT/AT_CellularDevice.cpp
14+
@@ -50,6 +50,7 @@ AT_CellularDevice::AT_CellularDevice(FileHandle *fh, char *delim):
15+
_context_list(0),
16+
_default_timeout(DEFAULT_AT_TIMEOUT),
17+
_modem_debug_on(false),
18+
+ _cmux_status(false),
19+
_property_array(NULL)
20+
{
21+
MBED_ASSERT(fh);
22+
@@ -243,10 +244,10 @@ nsapi_error_t AT_CellularDevice::get_sim_state(SimState &state)
23+
24+
nsapi_error_t AT_CellularDevice::enable_cmux()
25+
{
26+
-setup_at_handler();
27+
-
28+
+ setup_at_handler();
29+
_at.lock();
30+
for (int retry = 1; retry <= 3; retry++) {
31+
+ is_ready();
32+
_at.clear_error();
33+
_at.flush();
34+
_at.at_cmd_discard("E0", "");
35+
@@ -259,10 +260,9 @@ setup_at_handler();
36+
tr_debug("Wait 100ms to init modem");
37+
rtos::ThisThread::sleep_for(100ms); // let modem have time to get ready
38+
}
39+
- return _at.unlock_return_error();
40+
+ return _at.unlock_return_error();
41+
}
42+
43+
-
44+
bool AT_CellularDevice::is_cmux_enabled()
45+
{
46+
return _cmux_status;
47+
@@ -272,6 +272,7 @@ void AT_CellularDevice::set_cmux_status_flag(bool cmux_status)
48+
{
49+
_cmux_status = cmux_status;
50+
}
51+
+
52+
nsapi_error_t AT_CellularDevice::set_pin(const char *sim_pin)
53+
{
54+
// if SIM is already in ready state then settings the PIN
55+
--
56+
2.45.2
57+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
From 13bc587f70e1c4f9f61650cfd7c8ebc538bdcf09 Mon Sep 17 00:00:00 2001
2+
From: pennam <m.pennasilico@arduino.cc>
3+
Date: Wed, 13 Nov 2024 08:29:14 +0100
4+
Subject: [PATCH] GEMALTO CINTERION: override shutdown function
5+
6+
---
7+
.../cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp | 6 ++++++
8+
.../drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.h | 1 +
9+
2 files changed, 7 insertions(+)
10+
11+
diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp
12+
index 1f82199106..c00c1880e4 100644
13+
--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp
14+
+++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp
15+
@@ -92,6 +92,12 @@ nsapi_error_t GEMALTO_CINTERION::init()
16+
return NSAPI_ERROR_OK;
17+
}
18+
19+
+nsapi_error_t GEMALTO_CINTERION::shutdown()
20+
+{
21+
+ CellularDevice::shutdown();
22+
+ return NSAPI_ERROR_OK;
23+
+}
24+
+
25+
GEMALTO_CINTERION::Module GEMALTO_CINTERION::get_module()
26+
{
27+
return _module;
28+
diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.h b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.h
29+
index 21d5888383..e77078cb49 100644
30+
--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.h
31+
+++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.h
32+
@@ -55,6 +55,7 @@ protected: // AT_CellularDevice
33+
34+
protected:
35+
virtual nsapi_error_t init();
36+
+ virtual nsapi_error_t shutdown();
37+
38+
private:
39+
static Module _module;
40+
--
41+
2.45.2
42+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
From 62867abe6811f785373cae9e9b5cfe41774b846b Mon Sep 17 00:00:00 2001
2+
From: pennam <m.pennasilico@arduino.cc>
3+
Date: Wed, 13 Nov 2024 08:30:47 +0100
4+
Subject: [PATCH] GEMALTO CINTERION: use default timeout to close
5+
sockets
6+
7+
---
8+
.../GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp | 4 ----
9+
1 file changed, 4 deletions(-)
10+
11+
diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp
12+
index a96cb2b360..f96ae481f0 100644
13+
--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp
14+
+++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp
15+
@@ -252,14 +252,10 @@ nsapi_error_t GEMALTO_CINTERION_CellularStack::socket_close_impl(int sock_id)
16+
{
17+
tr_debug("Cinterion close %d", sock_id);
18+
19+
- _at.set_at_timeout(FAILURE_TIMEOUT);
20+
-
21+
_at.at_cmd_discard("^SISC", "=", "%d", sock_id);
22+
23+
_at.clear_error(); // clear SISS even though SISC fails
24+
25+
- _at.restore_at_timeout();
26+
-
27+
return _at.get_last_error();
28+
}
29+
30+
--
31+
2.45.2
32+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
From 7c789f289225ef631952f0ddb8ac46d2d1de9191 Mon Sep 17 00:00:00 2001
2+
From: pennam <m.pennasilico@arduino.cc>
3+
Date: Thu, 14 Nov 2024 15:57:07 +0100
4+
Subject: [PATCH] GEMALTO CINTERION: add soft_power_off() and
5+
soft_reset()
6+
7+
---
8+
.../include/cellular/framework/API/CellularDevice.h | 11 +++++++++++
9+
.../include/cellular/framework/AT/AT_CellularDevice.h | 2 ++
10+
.../source/framework/AT/AT_CellularDevice.cpp | 5 +++++
11+
.../cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp | 10 ++++++++++
12+
.../cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.h | 2 ++
13+
5 files changed, 30 insertions(+)
14+
15+
diff --git a/connectivity/cellular/include/cellular/framework/API/CellularDevice.h b/connectivity/cellular/include/cellular/framework/API/CellularDevice.h
16+
index 0c8d1a2db2..69455e1567 100644
17+
--- a/connectivity/cellular/include/cellular/framework/API/CellularDevice.h
18+
+++ b/connectivity/cellular/include/cellular/framework/API/CellularDevice.h
19+
@@ -201,6 +201,17 @@ public: //Pure virtual functions
20+
*/
21+
virtual nsapi_error_t soft_power_off() = 0;
22+
23+
+ /** Resets the modem via AT command
24+
+ *
25+
+ * @remark CellularStateMachine disconnect or destruct does not reset the modem,
26+
+ * but you need to do that yourself.
27+
+ *
28+
+ * @pre You must call shutdown to prepare the modem for reset.
29+
+ *
30+
+ * @return NSAPI_ERROR_OK on success
31+
+ */
32+
+ virtual nsapi_error_t soft_reset() = 0;
33+
+
34+
/** Open the SIM card by setting the pin code for SIM.
35+
*
36+
* @param sim_pin PIN for the SIM card
37+
diff --git a/connectivity/cellular/include/cellular/framework/AT/AT_CellularDevice.h b/connectivity/cellular/include/cellular/framework/AT/AT_CellularDevice.h
38+
index fa011a0968..0006b6c391 100755
39+
--- a/connectivity/cellular/include/cellular/framework/AT/AT_CellularDevice.h
40+
+++ b/connectivity/cellular/include/cellular/framework/AT/AT_CellularDevice.h
41+
@@ -80,6 +80,8 @@ public:
42+
43+
virtual nsapi_error_t soft_power_off();
44+
45+
+ virtual nsapi_error_t soft_reset();
46+
+
47+
virtual nsapi_error_t set_pin(const char *sim_pin);
48+
49+
virtual nsapi_error_t get_sim_state(SimState &state);
50+
diff --git a/connectivity/cellular/source/framework/AT/AT_CellularDevice.cpp b/connectivity/cellular/source/framework/AT/AT_CellularDevice.cpp
51+
index 3eccc4a5c0..d7dae05aa2 100644
52+
--- a/connectivity/cellular/source/framework/AT/AT_CellularDevice.cpp
53+
+++ b/connectivity/cellular/source/framework/AT/AT_CellularDevice.cpp
54+
@@ -187,6 +187,11 @@ nsapi_error_t AT_CellularDevice::soft_power_off()
55+
return NSAPI_ERROR_OK;
56+
}
57+
58+
+nsapi_error_t AT_CellularDevice::soft_reset()
59+
+{
60+
+ return NSAPI_ERROR_OK;
61+
+}
62+
+
63+
ATHandler *AT_CellularDevice::get_at_handler()
64+
{
65+
return &_at;
66+
diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp
67+
index c00c1880e4..40e74ab98f 100644
68+
--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp
69+
+++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp
70+
@@ -98,6 +98,16 @@ nsapi_error_t GEMALTO_CINTERION::shutdown()
71+
return NSAPI_ERROR_OK;
72+
}
73+
74+
+nsapi_error_t GEMALTO_CINTERION::soft_power_off()
75+
+{
76+
+ return _at.at_cmd_discard("^SMSO=", "fast");
77+
+}
78+
+
79+
+nsapi_error_t GEMALTO_CINTERION::soft_reset()
80+
+{
81+
+ return _at.at_cmd_discard("+CFUN", "=1,1");
82+
+}
83+
+
84+
GEMALTO_CINTERION::Module GEMALTO_CINTERION::get_module()
85+
{
86+
return _module;
87+
diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.h b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.h
88+
index e77078cb49..edc980209e 100644
89+
--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.h
90+
+++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.h
91+
@@ -56,6 +56,8 @@ protected: // AT_CellularDevice
92+
protected:
93+
virtual nsapi_error_t init();
94+
virtual nsapi_error_t shutdown();
95+
+ virtual nsapi_error_t soft_power_off();
96+
+ virtual nsapi_error_t soft_reset();
97+
98+
private:
99+
static Module _module;
100+
--
101+
2.45.2
102+

0 commit comments

Comments
 (0)