Code functions vs. AT commands (Arduino MKR 1500)

Is there a document describing which AT commands the various code functions are using to control the modems ? e.g. syntax Syntax "getCurrentCarrier()" = AT+COPS?

each Modem would have its specific AT commands, even depends on the firmware version of your modem... but most would support a common set

You can probably see the command in the library (picked a random one, indeed [color=purple] AT+COPS?"[/color])

Hi J-M-L

Thank you... So I might be able to use

"modem.writeModemCommand("AT+COPS?", 2000);"

instead of

String GSM3ShieldV1ScanNetworks::getCurrentCarrier()

I am basically looking for a syntax to AT command translater :slight_smile:

There is no specific mapping between function names and AT commands. That is because both don't really have a relation. Functions in a library may be used to send specific AT commands, but they can be named whatever the author has thought of when implementing it.

modem.getCarrier();
modem.getFrequency();
modem.getModulationFreq();
modem.getCarrierInHertz();

All of these function might send the same AT command to the device. You'll only know if you open up the modem library you are using and find out yourself.

Voglhofer:
So I might be able to use
"modem.writeModemCommand("AT+COPS?", 2000);"
instead of
String GSM3ShieldV1ScanNetworks::getCurrentCarrier()

if writeModemCommand() is made public

Voglhofer:
I am basically looking for a syntax to AT command translater :slight_smile:

that's what AT reference manual are for... what you find in libraries are general functions that send an AT command and then parse the answer they get back to see if all went OK and capture information (well for the good libraries)

HI

Thank you for the answers.

I might not completely understand your answers, or I might explain my challenge incorrect.

The Arduino MKR 1500 is using UBLOX Sara R4 modem for radio network communication.

I can easily get documentation for the AT Commands used for the UBLOX modem... but which syntax (e.g getCurrentCarrier()) within the Arduino coding are using which AT commands (AT+COPS?) is not so easy to find.

I will use the "NB nb(1); // 1 = debug mode - shows AT commands." to identify the AT commands.

Voglhofer:
The Arduino MKR 1500 is using UBLOX Sara R4 modem for radio network communication.

OK so you are not using a "basic" GSM shield extension. (failed to notice that in your title)

The Arduino MKR NB 1500 is quite a capable device using UBLOX SARA-R410M-02B. You can find its specific AT manual here which is alined with 3GPP standards and adds some u-blox AT command proprietary extensions.

You would use a specific MKRNB library when you compile for that device to connect to the internet over a NarrowBand IoT or LTE Cat M1 network

If you want to see what AT commands are being used, you need to explore the source code for this

For example, for your question regarding getCurrentCarrier(), you would look in this source code, this is the ultimate documentation --> [color=purple]AT+COPS?[/color]

String NBScanner::getCurrentCarrier()
{
  String response;

  MODEM.send("AT+COPS?");
  if (MODEM.waitForResponse(180000, &response) == 1) {
    int firstQuoteIndex = response.indexOf('"');
    int lastQuoteIndex = response.lastIndexOf('"');

    if (firstQuoteIndex != -1 && lastQuoteIndex != -1 && firstQuoteIndex != lastQuoteIndex) {
      return response.substring(firstQuoteIndex + 1, lastQuoteIndex);
    }
  }

Hi J-M-L

Thank you.

I am currently using the UBLOX AT commands for another project, thats why I would prefer to use these for the MKR1500.

Do you know if its possible only use AT commands for the MKR 1500 and hereby awoid using syntac ?

==> E.g. MODEM.send("AT+COPS?");

And then it might be possible to print the related syntax and get the syntax knowlege from here.

I will try to create a sketch only using MODEM.sendf()

e.g.

Serial.print("Disconnecting from network: ");
MODEM.sendf("AT+COPS=2");
MODEM.waitForResponse(2000);
Serial.println("done.");

You can “borrow” code from the library to properly send AT commands and parse results. As the send method is public, if you get hold of the modem object then you can indeed send commmands