Skip to content

Commit 823993e

Browse files
author
Ari Parkkila
committed
Cellular: Add flow control (IFC) in BG96 AT driver
1 parent 9673ac1 commit 823993e

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

UNITTESTS/features/cellular/framework/AT/athandler/athandlertest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1368,7 +1368,7 @@ TEST_F(TestATHandler, test_ATHandler_sync)
13681368
EXPECT_EQ(false, at.sync(100));
13691369

13701370
fh1.size_value = 8;
1371-
char table[] = "OK\r\n\0";
1371+
char table[] = "+CMEE: 1\r\nOK\r\n\0";
13721372
filehandle_stub_table = table;
13731373

13741374
at.flush();

features/cellular/framework/AT/ATHandler.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1574,7 +1574,13 @@ bool ATHandler::sync(int timeout_ms)
15741574
// especially a common response like OK could be response to previous request.
15751575
clear_error();
15761576
_start_time = rtos::Kernel::get_ms_count();
1577-
at_cmd_discard("+CMEE", "?");
1577+
cmd_start("AT+CMEE?");
1578+
cmd_stop();
1579+
resp_start();
1580+
set_stop_tag("+CMEE:");
1581+
consume_to_stop_tag();
1582+
set_stop_tag(OK);
1583+
consume_to_stop_tag();
15781584
if (!_last_err) {
15791585
_at_timeout = timeout;
15801586
unlock();

features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,22 @@ nsapi_error_t QUECTEL_BG96::soft_power_on()
102102
if (_pwr.is_connected()) {
103103
tr_info("QUECTEL_BG96::soft_power_on");
104104
// check if modem was powered on already
105-
if (wake_up()) {
106-
return NSAPI_ERROR_OK;
107-
}
108-
if (!wake_up(true)) {
109-
tr_error("Modem not responding");
110-
soft_power_off();
111-
return NSAPI_ERROR_DEVICE_ERROR;
105+
if (!wake_up()) {
106+
if (!wake_up(true)) {
107+
tr_error("Modem not responding");
108+
soft_power_off();
109+
return NSAPI_ERROR_DEVICE_ERROR;
110+
}
112111
}
113112
}
114113

114+
#if defined (MBED_CONF_QUECTEL_BG96_RTS) && defined(MBED_CONF_QUECTEL_BG96_CTS)
115+
if (_at->at_cmd_discard("+IFC", "=", "%d%d", 2, 2) != NSAPI_ERROR_OK) {
116+
tr_warn("Set flow control failed");
117+
return NSAPI_ERROR_DEVICE_ERROR;
118+
}
119+
#endif
120+
115121
return NSAPI_ERROR_OK;
116122
}
117123

0 commit comments

Comments
 (0)