diff --git a/features/cellular/framework/AT/AT_CellularBase.h b/features/cellular/framework/AT/AT_CellularBase.h index bcbc809f18..e5098e1f28 100644 --- a/features/cellular/framework/AT/AT_CellularBase.h +++ b/features/cellular/framework/AT/AT_CellularBase.h @@ -50,6 +50,7 @@ public: */ enum SupportedFeature { AT_CGSN_WITH_TYPE, // AT+CGSN without type is likely always supported similar to AT+GSN + AT_CGDATA, // alternative is to support only ATD*99***<cid># SUPPORTED_FEATURE_END_MARK // must be last element in the array of features }; static void set_unsupported_features(const SupportedFeature *unsupported_features); diff --git a/features/cellular/framework/AT/AT_CellularNetwork.cpp b/features/cellular/framework/AT/AT_CellularNetwork.cpp index 22dc766b1d..1d142d2120 100644 --- a/features/cellular/framework/AT/AT_CellularNetwork.cpp +++ b/features/cellular/framework/AT/AT_CellularNetwork.cpp @@ -381,8 +381,15 @@ nsapi_error_t AT_CellularNetwork::open_data_channel() { #if NSAPI_PPP_AVAILABLE tr_info("Open data channel in PPP mode"); - _at.cmd_start("AT+CGDATA=\"PPP\","); - _at.write_int(_cid); + if (is_supported(AT_CGDATA)) { + _at.cmd_start("AT+CGDATA=\"PPP\","); + _at.write_int(_cid); + } else { + MBED_ASSERT(_cid >= 0 && _cid <= 99); + char cmd_buf[sizeof("ATD*99***xx#")]; + std::sprintf(cmd_buf, "ATD*99***%d#", _cid); + _at.cmd_start(cmd_buf); + } _at.cmd_stop(); _at.resp_start("CONNECT", true);