Having your new LTE based Challenger/Connectivity board connect to the LTE network can sometimes be a bit challenging. While the 1nce sim card, most of the times, will automatically connect to the best provider it some times don’t. When this happens it can be a bit frustrating to trouble shoot the problem while using any one of the libraries that provide a high level API.
Having the possibility to simply send AT commands and observe the response can make life easier.
Below is a simple sketch that sets the system up and the waits for AT commands that is sent to the modem and the response is fed back to the terminal.
/*
Simple test program to test access to the LTE modem on the Challenger RP2040 LTE board
*/
#include "Connectivity.h"
#define TERM Serial
#define DEBUG Serial1
#define SYSTEM_MNO_PROF 100
#define DEFAULT_PS_ENABLED 0
char buf[4096];
int led_state = LOW;
void send(const char *cmd);
// the setup function runs once when you press reset or power the board
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, led_state);
pinMode(18, OUTPUT);
digitalWrite(18, HIGH);
TERM.begin(115200); // Terminal
while (!TERM)
delay(10);
TERM.println("Connectivity RP2040 LTE/WiFi/BLE test program !");
TERM.println("Waiting for modem to start..");
// Power on modem
SARA_SERIAL_PORT.begin(115200);
if (!iLabsConnectivity.doModemPowerOn()) {
TERM.println("Failed to start the modem properly !");
while(1);
} else {
TERM.println("Modem started !");
delay(1000);
}
}
// the loop function runs over and over again forever
void loop() {
static uint32_t to = millis();
if(TERM.available()) { // Transfer all available characters from the terminal to the modem
SARA_SERIAL_PORT.write(TERM.read());
}
if(SARA_SERIAL_PORT.available()) { // Transfer all available characters from the modem to the terminal
char ch = SARA_SERIAL_PORT.read();
TERM.write(ch);
}
if (millis() - to > 500) {
to = millis();
if (led_state == LOW) {
digitalWrite(LED_BUILTIN, HIGH);
led_state = HIGH;
} else {
digitalWrite(LED_BUILTIN, LOW);
led_state = LOW;
}
}
}
Here are some simple things to try out to try to determine what the cause of the connection problem is.
- The first thing we will do is to enable connection reports from the modem so that we are informed when we are connected. This done by issuing the following command:
AT+CEREG=2
Now we will get an unsolicited message from the modem each time the network registration status changes.
Here’s an example on how this can look:
+CEREG: 5,”271C”,”1FD9916″,7 - Now, make sure you can get a list of the different providers available in your area.
Type the following AT commands:
AT+COPS=?
This commands will take quite some time to complete but will eventually return with a list similar to the one below.
+COPS: (1,”TELIA S”,”TELIA”,”24001″,7),(1,”Telenor SE”,”TelenorS”,”24008″,7),(1,”TELIA S”,”TELIA”,”24001″,0),(2,”Tele2″,”Tele2 SE”,”24007″,7),,(0,1,2,3,4),(0,1,2)
Now we know that there are at least someone out there. - Now we can try to connect to one of the reported networks.
AT+COPS=4,2,”24008″
If you are using a SIM card from 1NCE you can probably select either operator as 1NCE are cooperating with most network providers. If the call fails make sure to check that the selected provider is supported by 1NCE. - When using a 1NCE SIM card it can also be necessary to set the APN to point to their infrastructure. This is done by issuing the following command.
AT+CGDCONT=1,”IP”,”iot.1nce.net”
You can query the connection by issuing AT+CGDCONT? which should return something like this:
+CGDCONT: 1,”IP”,”iot.1nce.net”,”10.X.X.X”,0,0,0,0,0,0
Of course with a proper IP address in place of the X’s.
Those are some things that you can do to debug your connection. If nothing helps please visit our forum for more information and help.
0 Comments for “How to debug connection problems with uBlox SARA modules.”