M410 LTE Antenna Detection - AT command

This would be cool to have to determine if the antenna was installed correctly for production.

It’s possible that some of these commands will be added to system firmware in future, but there’s nothing preventing your from using Cellular.command now. I don’t see any reason why that command shouldn’t work with Cellular.command. I’d try it and see if it works.

@rickkas7

int callbackAntenna(int type, const char* buf, int len, char* response) {
  Serial.println(".......buf_begin......");
  Serial.println(buf);
  Serial.println(".......buf_end......");
      if (sscanf(buf, "\r\n+UANTR: 0,%[^\r]", response) == 1);

    return WAIT;
}

Serial.println("Detecting Antenna: ");
          char response[200] = "";
          //int code = Cellular.command(callbackAntenna, response, 10000, "AT+UANTR=0\r\n");
          if (RESP_OK == Cellular.command(callbackAntenna, response, 10000, "AT+UANTR=0\r\n")) {
            Serial.printlnf("Antenna = %s\r\n", response);
          } else {
            Serial.println("error");
          }

This is the output, so the -1 indicates an open circuit although I have an antenna installed.

But there is an output of 4. Do you know what this number is or where its coming from? Each time I call this function the number 4 changes at each call between numbers 0 and 15.

Also do you know why the buf is printing out twice (between buf begin and buf end)?

Detecting Antenna: 
.......buf_begin......

+UANTR: 0,-1
4
.......buf_end......
.......buf_begin......

OK
TR: 0,-1
4
.......buf_end......
Antenna = 0,-1

Oh, wait, there’s going to be a different problem. This won’t work with the stock antenna.

The FXUB63 does not have a diagnostic resistor. There are specific models like this one that do, but most don’t.

The buf passed to the callback is not null terminated - it’s specified by length so the extra bytes are typically data that was left in the buffer from earlier.

3 Likes