Merge pull request #11490 from AriParkkila/cell-bg96-ifc

Cellular: Add flow control (IFC) in BG96 AT driver
pull/11523/head
Martin Kojtal 2019-09-19 10:25:47 +02:00 committed by GitHub
commit 185e380233
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 9 deletions

View File

@ -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();

View File

@ -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();

View File

@ -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;
}