C030-R412m: Cellular device program

Hi!

I have tested different code examples but without success. So, some questions came out.

  1. What are all parameters that I can set to my target in mbed_app.json? How are this parameters used?
  2. How can I initialize my cellular interface without PSM?

Here a non-working example:

File mbed_app.json

{
    "target_overrides": {
        "UBLOX_C030_R412M": {
            "target.network-default-interface-type": "CELLULAR"
        }
    }
}

File main.cpp

#include "UbloxATCellularInterfaceExt.h"
#include "mbed.h"

#define APN         NULL
#define USERNAME    NULL
#define PASSWORD    NULL

int main() {
    UbloxATCellularInterfaceExt *interface = new UbloxATCellularInterfaceExt(
        /*MDMTXD, MDMRXD,
        MBED_CONF_UBLOX_CELL_BAUD_RATE,
        true*/);

    UbloxATCellularInterfaceExt::Error *err;
    UbloxATCellularInterfaceExt::CellLocData data;

    if (interface->init()) {
        interface->disable_power_saving_mode();
        interface->set_mno_profile(UbloxATCellularInterface::VODAFONE);
        interface->set_modem_rat(UbloxCellularBase::RAT::LTE_CATNB1, UbloxCellularBase::RAT::GPRS_EGPRS);
        interface->set_credentials(APN, USERNAME, PASSWORD);
        printf("Registered, connecting to the packet network...\n");
        for (int x = 0; interface->connect() != 0; x++) {
            if (x > 0) {
                printf("Retrying (have you checked that an antenna is plugged in and your APN is correct?)...\n");
            }
        }
    } else {
        printf("Unable to initialise the interface.\n");
    }
}

In my opinion function interface->init just do to much if I want to configure some things first. And simple modem power up etc. functions are protected. So, what is here the best practice to get more control over the interface?

Hello,

You can found some info in Configuration - Reference | Mbed OS 5 Documentation.
There are some configuration files and according to their default values are created macros in mbed_config.h (currently it is visible only with offline tools in the build folder) before compilation and so on. The mbed_app.json can overide these default values.

Here is an example in the context of your current job.
In the MbedOs is targets.json file what hold default settings about all supported targets. Also your target is here, and how you can see on the line 4999 the default network interface is Ethernet and because of that you need to override it in mbed_app.json like you posted above.

I have no experiences with cellular so I probably not help you.
You can try the example form documentation Cellular API - APIs | Mbed OS 5 Documentation what point to this example or examples by u-blox | Mbed.

BR, Jan

1 Like

Thank you so much Jan!

It is very hard for a newbie to find all this relevant files and to understand why, what and where this configurations are relevant. Many examples on Mbed Ublox don’t work out of the box. Much is poorly documented, which makes the work immensely difficult. But what the heck, maybe it will get better. :laughing: