Skip to content

Cellular: Add flow control (IFC) in BG96 AT driver #11490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1368,7 +1368,7 @@ TEST_F(TestATHandler, test_ATHandler_sync)
EXPECT_EQ(false, at.sync(100));

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

at.flush();
Expand Down
8 changes: 7 additions & 1 deletion features/cellular/framework/AT/ATHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1574,7 +1574,13 @@ bool ATHandler::sync(int timeout_ms)
// especially a common response like OK could be response to previous request.
clear_error();
_start_time = rtos::Kernel::get_ms_count();
at_cmd_discard("+CMEE", "?");
cmd_start("AT+CMEE?");
cmd_stop();
resp_start();
set_stop_tag("+CMEE:");
consume_to_stop_tag();
set_stop_tag(OK);
consume_to_stop_tag();
if (!_last_err) {
_at_timeout = timeout;
unlock();
Expand Down
20 changes: 13 additions & 7 deletions features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,22 @@ nsapi_error_t QUECTEL_BG96::soft_power_on()
if (_pwr.is_connected()) {
tr_info("QUECTEL_BG96::soft_power_on");
// check if modem was powered on already
if (wake_up()) {
return NSAPI_ERROR_OK;
}
if (!wake_up(true)) {
tr_error("Modem not responding");
soft_power_off();
return NSAPI_ERROR_DEVICE_ERROR;
if (!wake_up()) {
if (!wake_up(true)) {
tr_error("Modem not responding");
soft_power_off();
return NSAPI_ERROR_DEVICE_ERROR;
}
}
}

#if defined (MBED_CONF_QUECTEL_BG96_RTS) && defined(MBED_CONF_QUECTEL_BG96_CTS)
if (_at->at_cmd_discard("+IFC", "=", "%d%d", 2, 2) != NSAPI_ERROR_OK) {
tr_warn("Set flow control failed");
return NSAPI_ERROR_DEVICE_ERROR;
}
#endif

return NSAPI_ERROR_OK;
}

Expand Down