I Managed to solve it.
My final code is the following:
MAIN.CPP
#include “mbed.h”
#include <MQTTClientMbedOs.h>
#include "CellularContext.h"
#include "CellularInformation.h"
#include "CellularLog.h"
int main()
{
mbed_trace_init();
CellularInterface *net = CellularInterface::get_default_instance();
CellularDevice * dev = CellularDevice::get_default_instance();
ATHandler * devat = dev->get_at_handler();
dev->soft_power_on();
devat->cmd_start("AT+QCFG=\"iotopmode\"");
devat->cmd_stop_read_resp();
}
MBED_APP.JSON
"target_overrides": {
"*": {
"platform.memory-tracing-enabled": true,
"platform.stdio-baud-rate" : 115200,
"platform.stdio-convert-newlines" : true,
"platform.stdio-buffered-serial" : true,
"platform.stdio-flush-at-exit" : true,
"rtos.main-thread-stack-size" : 5120,
"events.shared-stacksize" : 2048,
"events.shared-eventsize" : 2048,
"mbed-trace.enable" : true
},
"DISCO_L475VG_IOT01A": {
"target.network-default-interface-type" : "CELLULAR",
"ppp.ipv4-enabled": false,
"ppp.ipv6-enabled": true,
"lwip.ipv4-enabled": true,
"lwip.ipv6-enabled": true,
"lwip.ethernet-enabled": false,
"lwip.ppp-enabled": false,
"lwip.tcp-enabled": true,
"nsapi.default-cellular-apn": "\"\"",
"nsapi.default-cellular-username": "\"\"",
"nsapi.default-cellular-password": "\"\"",
"cellular.debug-at": true,
"QUECTEL_BG96.provide-default": true,
"QUECTEL_BG96.tx": "D1",
"QUECTEL_BG96.rx": "D0",
"QUECTEL_BG96.pwr": "A5",
"QUECTEL_BG96.rst": "A4",
"QUECTEL_BG96.polarity": 1
}
},