Skip to content

Commit 365d61e

Browse files
authored
Merge pull request #7304 from cedrickkukela-cd/MTS_DRAGONFLY_L471QG_pull_request_feature_changes
Add MTS dragonfly, MTS dragonfly l471
2 parents 3df898d + 9f9a858 commit 365d61e

35 files changed

+23356
-8
lines changed

features/cellular/TESTS/api/cellular_network/main.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ static void test_activate_context()
200200
static void test_connect()
201201
{
202202
TEST_ASSERT(nw->connect() == NSAPI_ERROR_OK);
203+
char count = 0;
204+
while ((nw->get_connection_status() != NSAPI_STATUS_GLOBAL_UP) && (count++ < 60)) {
205+
wait(1);
206+
}
203207
nsapi_connection_status_t st = nw->get_connection_status();
204208
TEST_ASSERT(st == NSAPI_STATUS_GLOBAL_UP);
205209
}
@@ -223,7 +227,7 @@ static void test_other()
223227
// can't test values as they are optional
224228
nsapi_error_t err = nw->get_rate_control(reports, timeUnit, uplinkRate);
225229
TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_DEVICE_ERROR);
226-
if (strcmp(devi, "QUECTEL_BG96") != 0 && strcmp(devi, "TELIT_HE910") != 0) { // QUECTEL_BG96 does not give any specific reason for device error
230+
if (strcmp(devi, "QUECTEL_BG96") != 0 && strcmp(devi, "TELIT_HE910") != 0 && strcmp(devi, "SARA4_PPP") != 0) { // QUECTEL_BG96 does not give any specific reason for device error
227231
if (err == NSAPI_ERROR_DEVICE_ERROR) {
228232
TEST_ASSERT(((AT_CellularNetwork *)nw)->get_device_error().errCode == 100 && // 100 == unknown command for modem
229233
((AT_CellularNetwork *)nw)->get_device_error().errType == 3); // 3 == CME error from the modem
@@ -234,7 +238,7 @@ static void test_other()
234238
err = nw->get_apn_backoff_timer(uplinkRate);
235239
TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_DEVICE_ERROR || err == NSAPI_ERROR_PARAMETER);
236240
if (err == NSAPI_ERROR_DEVICE_ERROR) {
237-
if (strcmp(devi, "QUECTEL_BG96") != 0 && strcmp(devi, "TELIT_HE910") != 0) { // QUECTEL_BG96 does not give any specific reason for device error
241+
if (strcmp(devi, "QUECTEL_BG96") != 0 && strcmp(devi, "TELIT_HE910") != 0 && strcmp(devi, "SARA4_PPP") != 0) { // QUECTEL_BG96 does not give any specific reason for device error
238242
TEST_ASSERT(((AT_CellularNetwork *)nw)->get_device_error().errCode == 100 && // 100 == unknown command for modem
239243
((AT_CellularNetwork *)nw)->get_device_error().errType == 3); // 3 == CME error from the modem
240244
}
@@ -320,7 +324,7 @@ static void test_other()
320324

321325
TEST_ASSERT(nw->set_blocking(true) == NSAPI_ERROR_OK);
322326

323-
if (strcmp(devi, "QUECTEL_BG96") != 0) {
327+
if (strcmp(devi, "QUECTEL_BG96") != 0 && strcmp(devi, "SARA4_PPP") != 0) {
324328
// QUECTEL_BG96 timeouts with this one, tested with 3 minute timeout
325329
CellularNetwork::operator_names_list op_names;
326330
err = nw->get_operator_names(op_names);
@@ -344,7 +348,7 @@ static void test_other()
344348
TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_DEVICE_ERROR);
345349
if (err == NSAPI_ERROR_DEVICE_ERROR) {
346350
// if device error then we must check was that really device error or that modem/network does not support the commands
347-
if (!(strcmp(devi, "TELIT_HE910") == 0 || strcmp(devi, "QUECTEL_BG96") == 0)) {
351+
if (!(strcmp(devi, "TELIT_HE910") == 0 || strcmp(devi, "QUECTEL_BG96") == 0 || strcmp(devi, "SARA4_PPP") == 0)) {
348352
TEST_ASSERT((((AT_CellularNetwork *)nw)->get_device_error().errType == 3) && // 3 == CME error from the modem
349353
((((AT_CellularNetwork *)nw)->get_device_error().errCode == 100) || // 100 == unknown command for modem
350354
(((AT_CellularNetwork *)nw)->get_device_error().errCode == 50))); // 50 == incorrect parameters // seen in wise_1570 for not supported commands
@@ -358,7 +362,7 @@ static void test_other()
358362
TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_DEVICE_ERROR);
359363
if (err == NSAPI_ERROR_DEVICE_ERROR) {
360364
// if device error then we must check was that really device error or that modem/network does not support the commands
361-
if (!(strcmp(devi, "TELIT_HE910") == 0 || strcmp(devi, "QUECTEL_BG96") == 0)) {
365+
if (!(strcmp(devi, "TELIT_HE910") == 0 || strcmp(devi, "QUECTEL_BG96") == 0 || strcmp(devi, "SARA4_PPP") == 0)) {
362366
TEST_ASSERT((((AT_CellularNetwork *)nw)->get_device_error().errType == 3) && // 3 == CME error from the modem
363367
((((AT_CellularNetwork *)nw)->get_device_error().errCode == 100) || // 100 == unknown command for modem
364368
(((AT_CellularNetwork *)nw)->get_device_error().errCode == 50))); // 50 == incorrect parameters // seen in wise_1570 for not supported commands
@@ -371,6 +375,8 @@ static void test_disconnect()
371375
nsapi_connection_status_t st = nw->get_connection_status();
372376
TEST_ASSERT(st == NSAPI_STATUS_GLOBAL_UP);
373377
TEST_ASSERT(nw->disconnect() == NSAPI_ERROR_OK);
378+
// wait to process URC's, received after disconnect
379+
rtos::Thread::wait(500);
374380
}
375381

376382
static void test_detach()
@@ -384,7 +390,7 @@ static void test_detach()
384390

385391
TEST_ASSERT(nw->detach() == NSAPI_ERROR_OK);
386392
// wait to process URC's, received after detach
387-
rtos::Thread::wait(50);
393+
rtos::Thread::wait(500);
388394
st = nw->get_connection_status();
389395
TEST_ASSERT(st == NSAPI_STATUS_DISCONNECTED);
390396
}

features/cellular/TESTS/api/cellular_power/main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737

3838
#include "mbed.h"
3939

40+
#include "AT_CellularPower.h"
4041
#include "CellularDevice.h"
4142
#include "../../cellular_tests_common.h"
4243
#include CELLULAR_STRINGIFY(CELLULAR_DEVICE.h)

features/cellular/framework/common/CellularTargets.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ namespace mbed {
3737
#endif
3838
#elif TARGET_UBLOX_C027
3939
#define CELLULAR_DEVICE UBLOX_PPP
40-
#else
40+
#elif TARGET_MTS_DRAGONFLY_L471QG
41+
#define CELLULAR_DEVICE SARA4_PPP
42+
//#else
4143
//#error Cellular target not defined, see cellular/targets.h
4244
//#define CELLULAR_TARGET <target-modem>
4345
//#define MDMTXD <pin-name>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright (c) 2017, Arm Limited and affiliates.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
#include "SARA4_PPP.h"
19+
#include "SARA4_PPP_CellularNetwork.h"
20+
#include "SARA4_PPP_CellularPower.h"
21+
22+
using namespace mbed;
23+
using namespace events;
24+
25+
static const AT_CellularBase::SupportedFeature unsupported_features[] = {
26+
AT_CellularBase::AT_CGSN_WITH_TYPE,
27+
AT_CellularBase::AT_CGDATA,
28+
AT_CellularBase::SUPPORTED_FEATURE_END_MARK
29+
};
30+
31+
SARA4_PPP::SARA4_PPP(EventQueue &queue) : AT_CellularDevice(queue)
32+
{
33+
AT_CellularBase::set_unsupported_features(unsupported_features);
34+
}
35+
36+
SARA4_PPP::~SARA4_PPP()
37+
{
38+
}
39+
40+
AT_CellularNetwork *SARA4_PPP::open_network_impl(ATHandler &at)
41+
{
42+
return new SARA4_PPP_CellularNetwork(at);
43+
}
44+
45+
AT_CellularPower *SARA4_PPP::open_power_impl(ATHandler &at)
46+
{
47+
return new SARA4_PPP_CellularPower(at);
48+
}
49+
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright (c) 2017, Arm Limited and affiliates.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
#ifndef SARA4_PPP_H_
19+
#define SARA4_PPP_H_
20+
21+
#include "AT_CellularDevice.h"
22+
23+
namespace mbed {
24+
25+
class SARA4_PPP : public AT_CellularDevice {
26+
27+
public:
28+
SARA4_PPP(events::EventQueue &queue);
29+
virtual ~SARA4_PPP();
30+
31+
public: // CellularDevice
32+
virtual AT_CellularNetwork *open_network_impl(ATHandler &at);
33+
virtual AT_CellularPower *open_power_impl(ATHandler &at);
34+
};
35+
36+
} // namespace mbed
37+
38+
#endif // SARA4_PPP_H_
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Copyright (c) 2017, Arm Limited and affiliates.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
#include "SARA4_PPP_CellularNetwork.h"
19+
20+
using namespace mbed;
21+
22+
SARA4_PPP_CellularNetwork::SARA4_PPP_CellularNetwork(ATHandler &atHandler) : AT_CellularNetwork(atHandler)
23+
{
24+
}
25+
26+
SARA4_PPP_CellularNetwork::~SARA4_PPP_CellularNetwork()
27+
{
28+
}
29+
30+
bool SARA4_PPP_CellularNetwork::get_modem_stack_type(nsapi_ip_stack_t requested_stack)
31+
{
32+
return requested_stack == IPV4_STACK ? true : false;
33+
}
34+
35+
AT_CellularNetwork::RegistrationMode SARA4_PPP_CellularNetwork::has_registration(RegistrationType reg_type)
36+
{
37+
return (reg_type == C_REG || reg_type == C_GREG) ? RegistrationModeLAC : RegistrationModeDisable;
38+
}
39+
40+
nsapi_error_t SARA4_PPP_CellularNetwork::set_access_technology_impl(RadioAccessTechnology opRat)
41+
{
42+
_op_act = RAT_CATM1;
43+
return NSAPI_ERROR_OK;
44+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright (c) 2017, Arm Limited and affiliates.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
#ifndef SARA4_PPP_CELLULAR_NETWORK_H_
19+
#define SARA4_PPP_CELLULAR_NETWORK_H_
20+
21+
#include "AT_CellularNetwork.h"
22+
23+
namespace mbed {
24+
25+
class SARA4_PPP_CellularNetwork : public AT_CellularNetwork {
26+
public:
27+
SARA4_PPP_CellularNetwork(ATHandler &atHandler);
28+
virtual ~SARA4_PPP_CellularNetwork();
29+
30+
protected:
31+
virtual bool get_modem_stack_type(nsapi_ip_stack_t requested_stack);
32+
33+
virtual RegistrationMode has_registration(RegistrationType rat);
34+
35+
virtual nsapi_error_t set_access_technology_impl(RadioAccessTechnology opRat);
36+
};
37+
38+
} // namespace mbed
39+
40+
#endif // SARA4_PPP_CELLULAR_NETWORK_H_
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright (c) 2017, Arm Limited and affiliates.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
#include "SARA4_PPP_CellularPower.h"
19+
20+
#include "onboard_modem_api.h"
21+
22+
using namespace mbed;
23+
24+
SARA4_PPP_CellularPower::SARA4_PPP_CellularPower(ATHandler &atHandler) : AT_CellularPower(atHandler)
25+
{
26+
27+
}
28+
29+
SARA4_PPP_CellularPower::~SARA4_PPP_CellularPower()
30+
{
31+
32+
}
33+
34+
nsapi_error_t SARA4_PPP_CellularPower::on()
35+
{
36+
#if MODEM_ON_BOARD
37+
::onboard_modem_init();
38+
::onboard_modem_power_up();
39+
#endif
40+
return NSAPI_ERROR_OK;
41+
}
42+
43+
nsapi_error_t SARA4_PPP_CellularPower::off()
44+
{
45+
#if MODEM_ON_BOARD
46+
::onboard_modem_power_down();
47+
#endif
48+
return NSAPI_ERROR_OK;
49+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright (c) 2017, Arm Limited and affiliates.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
#ifndef SARA4_PPP_CELLULARPOWER_H_
19+
#define SARA4_PPP_CELLULARPOWER_H_
20+
21+
#include "AT_CellularPower.h"
22+
23+
namespace mbed {
24+
25+
class SARA4_PPP_CellularPower : public AT_CellularPower {
26+
public:
27+
SARA4_PPP_CellularPower(ATHandler &atHandler);
28+
virtual ~SARA4_PPP_CellularPower();
29+
30+
public: //from CellularPower
31+
32+
virtual nsapi_error_t on();
33+
34+
virtual nsapi_error_t off();
35+
};
36+
37+
} // namespace mbed
38+
39+
#endif // SARA4_PPP_CELLULARPOWER_H_

0 commit comments

Comments
 (0)