Skip to content

Commit

Permalink
Cellular: Add flow control (IFC) in BG96 AT driver
Browse files Browse the repository at this point in the history
  • Loading branch information
Ari Parkkila committed Sep 16, 2019
1 parent 9673ac1 commit ec5dab8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
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

0 comments on commit ec5dab8

Please sign in to comment.