diff --git a/features/cellular/framework/AT/AT_CellularDevice.cpp b/features/cellular/framework/AT/AT_CellularDevice.cpp index 0d005418c7..5c3c536c8b 100644 --- a/features/cellular/framework/AT/AT_CellularDevice.cpp +++ b/features/cellular/framework/AT/AT_CellularDevice.cpp @@ -598,7 +598,10 @@ nsapi_error_t AT_CellularDevice::clear() nsapi_error_t AT_CellularDevice::set_baud_rate(int baud_rate) { - nsapi_error_t error = set_baud_rate_impl(baud_rate); + nsapi_error_t error; + +#if (DEVICE_SERIAL && DEVICE_INTERRUPTIN) + error = set_baud_rate_impl(baud_rate); if (error) { tr_warning("Baudrate was not changed to desired value: %d", baud_rate); @@ -609,6 +612,12 @@ nsapi_error_t AT_CellularDevice::set_baud_rate(int baud_rate) // Give some time before starting using the UART with the new baud rate rtos::ThisThread::sleep_for(3000); +#else + // Currently ATHandler only supports BufferedSerial based communication and + // if serial is disabled, baud rate cannot be set + tr_warn("set_baud_rate: Serial not supported"); + error = NSAPI_ERROR_UNSUPPORTED; +#endif return error; } diff --git a/features/cellular/framework/device/ATHandler.cpp b/features/cellular/framework/device/ATHandler.cpp index fccfe90134..0bb914c7a7 100644 --- a/features/cellular/framework/device/ATHandler.cpp +++ b/features/cellular/framework/device/ATHandler.cpp @@ -1545,6 +1545,9 @@ void ATHandler::write_hex_string(const char *str, size_t size) void ATHandler::set_baud(int baud_rate) { +#if (DEVICE_SERIAL && DEVICE_INTERRUPTIN) static_cast(_fileHandle)->set_baud(baud_rate); +#else + tr_error("Device does not support BufferedSerial"); +#endif } -