diff --git a/UNITTESTS/features/cellular/framework/AT/athandler/athandlertest.cpp b/UNITTESTS/features/cellular/framework/AT/athandler/athandlertest.cpp index d168c6a488..44a86e5e94 100644 --- a/UNITTESTS/features/cellular/framework/AT/athandler/athandlertest.cpp +++ b/UNITTESTS/features/cellular/framework/AT/athandler/athandlertest.cpp @@ -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(); diff --git a/features/cellular/framework/AT/ATHandler.cpp b/features/cellular/framework/AT/ATHandler.cpp index 1fab9d5e22..295967691b 100644 --- a/features/cellular/framework/AT/ATHandler.cpp +++ b/features/cellular/framework/AT/ATHandler.cpp @@ -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(); diff --git a/features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96.cpp b/features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96.cpp index b8222044f7..fe31a3920f 100644 --- a/features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96.cpp +++ b/features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96.cpp @@ -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; }