diff --git a/features/cellular/framework/AT/ATHandler.cpp b/features/cellular/framework/AT/ATHandler.cpp index b82176f229..dbd9672e1b 100644 --- a/features/cellular/framework/AT/ATHandler.cpp +++ b/features/cellular/framework/AT/ATHandler.cpp @@ -32,7 +32,7 @@ using namespace events; #include "CellularLog.h" // this is intentionally TRACE_LEVEL_INFO -#if MBED_TRACE_MAX_LEVEL <= TRACE_LEVEL_INFO +#if MBED_TRACE_MAX_LEVEL >= TRACE_LEVEL_INFO #define at_debug(format, ...) do { if (_debug_on) debug(format, ## __VA_ARGS__); } while (0) #else #define at_debug(...) diff --git a/features/cellular/framework/AT/AT_CellularStack.cpp b/features/cellular/framework/AT/AT_CellularStack.cpp index 0a03528600..6fd0f123e4 100644 --- a/features/cellular/framework/AT/AT_CellularStack.cpp +++ b/features/cellular/framework/AT/AT_CellularStack.cpp @@ -169,10 +169,13 @@ nsapi_error_t AT_CellularStack::socket_bind(nsapi_socket_t handle, const SocketA if (!socket) { return NSAPI_ERROR_DEVICE_ERROR; } - socket->localAddress = addr; - if (socket->localAddress.get_port() == 0) { - socket->localAddress.set_port(get_dynamic_ip_port()); + if (addr) { + socket->localAddress.set_addr(addr.get_addr()); + } + + if (addr.get_port()) { + socket->localAddress.set_port(addr.get_port()); } _at.lock(); diff --git a/features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95_CellularStack.cpp b/features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95_CellularStack.cpp index c9e63c8331..bf4d208e4c 100644 --- a/features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95_CellularStack.cpp +++ b/features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95_CellularStack.cpp @@ -167,7 +167,7 @@ nsapi_size_or_error_t QUECTEL_BC95_CellularStack::socket_recvfrom_impl(CellularS nsapi_size_or_error_t recv_len=0; int port; char ip_address[NSAPI_IP_SIZE]; - char hexstr[BC95_MAX_PACKET_SIZE*2 + 1] = {0}; + char hexstr[BC95_MAX_PACKET_SIZE*2 + 1]; _at.cmd_start("AT+NSORF="); _at.write_int(socket->id);