Skip to content

Commit fe52b96

Browse files
committed
patches: GEMALTO CINTERION fixes
1 parent c116cb1 commit fe52b96

9 files changed

+434
-0
lines changed
Lines changed: 57 additions & 0 deletions
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 248/256] 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+
Lines changed: 42 additions & 0 deletions
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 249/256] 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+
Lines changed: 32 additions & 0 deletions
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 250/256] 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+
Lines changed: 102 additions & 0 deletions
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 251/256] 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+
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
From 1082631c2a418ce76d003cccf247141f90433736 Mon Sep 17 00:00:00 2001
2+
From: pennam <m.pennasilico@arduino.cc>
3+
Date: Thu, 14 Nov 2024 15:57:44 +0100
4+
Subject: [PATCH 252/256] GEMALTO CINTERION: disable runtime model detection
5+
6+
cellular_properties must be configured in ctor to properly configure all network urcs
7+
---
8+
.../GEMALTO/CINTERION/GEMALTO_CINTERION.cpp | 39 ++++++-------------
9+
1 file changed, 11 insertions(+), 28 deletions(-)
10+
11+
diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp
12+
index 40e74ab98f..3754ad50ec 100644
13+
--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp
14+
+++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp
15+
@@ -29,6 +29,17 @@ GEMALTO_CINTERION::Module GEMALTO_CINTERION::_module;
16+
17+
GEMALTO_CINTERION::GEMALTO_CINTERION(FileHandle *fh) : AT_CellularDevice(fh)
18+
{
19+
+#if defined(MBED_CONF_GEMALTO_CINTERION_ELS61)
20+
+ init_module_els61();
21+
+#elif defined(MBED_CONF_GEMALTO_CINTERION_BGS2)
22+
+ init_module_bgs2();
23+
+#elif defined(MBED_CONF_GEMALTO_CINTERION_EMS31)
24+
+ init_module_ems31();
25+
+#elif defined(MBED_CONF_GEMALTO_CINTERION_EHS5E)
26+
+ init_module_ehs5e();
27+
+#else
28+
+ init_module_tx62();
29+
+#endif
30+
}
31+
32+
AT_CellularContext *GEMALTO_CINTERION::create_context_impl(ATHandler &at, const char *apn, bool cp_req, bool nonip_req)
33+
@@ -60,35 +71,7 @@ nsapi_error_t GEMALTO_CINTERION::init()
34+
if (err != NSAPI_ERROR_OK) {
35+
return err;
36+
}
37+
-
38+
- CellularInformation *information = open_information();
39+
- if (!information) {
40+
- return NSAPI_ERROR_NO_MEMORY;
41+
- }
42+
- char model[sizeof("EHS5-E") + 1]; // sizeof need to be long enough to hold just the model text
43+
- nsapi_error_t ret = information->get_model(model, sizeof(model));
44+
- close_information();
45+
- if (ret != NSAPI_ERROR_OK) {
46+
- tr_error("Cellular model not found!");
47+
- return NSAPI_ERROR_DEVICE_ERROR;
48+
- }
49+
- if (memcmp(model, "ELS61", sizeof("ELS61") - 1) == 0) {
50+
- init_module_els61();
51+
- } else if (memcmp(model, "BGS2", sizeof("BGS2") - 1) == 0) {
52+
- init_module_bgs2();
53+
- } else if (memcmp(model, "EMS31", sizeof("EMS31") - 1) == 0) {
54+
- init_module_ems31();
55+
- } else if (memcmp(model, "EHS5-E", sizeof("EHS5-E") - 1) == 0) {
56+
- init_module_ehs5e();
57+
- } else if (memcmp(model, "TX62", sizeof("TX62") - 1) == 0) {
58+
- init_module_tx62();
59+
- } else {
60+
- tr_error("Cinterion model unsupported %s", model);
61+
- return NSAPI_ERROR_UNSUPPORTED;
62+
- }
63+
- tr_info("Cinterion model %s (%d)", model, _module);
64+
set_at_urcs();
65+
-
66+
return NSAPI_ERROR_OK;
67+
}
68+
69+
--
70+
2.45.2
71+
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
From 09a4787109efd233aded2b960fcdfa10587eec9d Mon Sep 17 00:00:00 2001
2+
From: pennam <m.pennasilico@arduino.cc>
3+
Date: Thu, 14 Nov 2024 15:59:37 +0100
4+
Subject: [PATCH 253/256] GEMALTO CONTERION: add ping
5+
6+
---
7+
.../GEMALTO_CINTERION_CellularStack.cpp | 17 +++++++++++++++++
8+
.../CINTERION/GEMALTO_CINTERION_CellularStack.h | 1 +
9+
2 files changed, 18 insertions(+)
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 f96ae481f0..938cdbfef2 100644
13+
--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp
14+
+++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp
15+
@@ -224,6 +224,23 @@ void GEMALTO_CINTERION_CellularStack::PSMDisable() {
16+
}
17+
}
18+
19+
+int GEMALTO_CINTERION_CellularStack::ping(const char *host, int ttl)
20+
+{
21+
+ MBED_ASSERT(host);
22+
+
23+
+ _at.lock();
24+
+ _at.set_at_timeout(ttl + 1000);
25+
+ _at.cmd_start_stop("^SISX", "=", "%s%d%s%d%d", "Ping", _cid, host, 1, ttl);
26+
+ _at.resp_start("^SISX: \"Ping\",");
27+
+ _at.skip_param(3); //pingInfoType, conProfileId, ip-address
28+
+ int rTT = _at.read_int(); //roundTripTime
29+
+ _at.resp_stop();
30+
+ _at.clear_error();
31+
+ _at.restore_at_timeout();
32+
+ _at.unlock();
33+
+ return rTT;
34+
+}
35+
+
36+
nsapi_error_t GEMALTO_CINTERION_CellularStack::socket_stack_init()
37+
{
38+
_at.lock();
39+
diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.h b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.h
40+
index f89da8c314..159ea68aa9 100644
41+
--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.h
42+
+++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.h
43+
@@ -43,6 +43,7 @@ public:
44+
void stopGNSS();
45+
void PSMEnable();
46+
void PSMDisable();
47+
+ int ping(const char *host, int ttl);
48+
49+
protected:
50+
51+
--
52+
2.45.2
53+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
From 46b1511db274990eb52e89c31e3e26af01d48d38 Mon Sep 17 00:00:00 2001
2+
From: pennam <m.pennasilico@arduino.cc>
3+
Date: Thu, 14 Nov 2024 16:00:17 +0100
4+
Subject: [PATCH 254/256] GEMALTO CINTERION: fix gethostbyname()
5+
6+
Add missing _at.unlock()
7+
---
8+
.../GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp | 1 +
9+
1 file changed, 1 insertion(+)
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 938cdbfef2..8f7b44818a 100644
13+
--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp
14+
+++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp
15+
@@ -309,6 +309,7 @@ nsapi_error_t GEMALTO_CINTERION_CellularStack::gethostbyname(const char *host, S
16+
} else {
17+
//Null string received
18+
tr_info("Read %d bytes. Null string", size);
19+
+ _at.unlock();
20+
return NSAPI_ERROR_NO_ADDRESS;
21+
}
22+
}
23+
--
24+
2.45.2
25+

0 commit comments

Comments
 (0)