Hi all,
I also had some problems with the example sketches. I found some challenges with my APN and band configurations by using SerialSARAPassthrough example sketch. I edited the sketch a bit by adding some useful AT commands. Below you can find my debugging tool ->
/*
DebugATCommandsSARA sketch
This sketch is modified from SerialSARAPassthrough.
The sketch allows you to send 15 basic AT commands from the USB CDC serial port
of the MKR NB 1500 board to the onboard ublox SARA-R410 celluar module.
If you want to add more commands the list of supported AT commands are found here:
https://www.u-blox.com/sites/default/files/u-blox-CEL_ATCommands_%28UBX-13002752%29.pdf
Circuit:
- MKR NB 1500 board
- Antenna
- 1500 mAh or higher lipo battery connected recommended
- USB seems to have enough power (tested with my PC)
- SIM card
Make sure the Serial Monitor's line ending is set to "Both NL and CR"
create 26 February 2019
Tomi Sarajisto
*/
// baud rate used for both Serial ports
unsigned long baud = 115200;
char command;
void setup() {
// reset the ublox module
pinMode(SARA_RESETN, OUTPUT);
digitalWrite(SARA_RESETN, HIGH);
delay(100);
digitalWrite(SARA_RESETN, LOW);
Serial.begin(baud);
SerialSARA.begin(baud);
}
void loop() {
if (Serial.available()) {
command = Serial.read();
switch (command)
{
case '0':
Serial.println("m: Set verbose error resultcodes");
SerialSARA.println("AT+CMEE=2");
break;
case '1':
Serial.println("1: Check IMEI");
SerialSARA.println("AT+GSN");
break;
case '2':
Serial.println("2: Check IMSI");
SerialSARA.println("AT+CIMI");
break;
case '3':
Serial.println("3: Check RAT type config");
SerialSARA.println("AT+URAT?");
break;
case '4':
Serial.println("4: Check band configuration");
SerialSARA.println("AT+UBANDMASK?");
break;
case '5':
Serial.println("5: Check signal");
SerialSARA.println("AT+CSQ");
break;
case '6':
Serial.println("6: Check APN configuration");
SerialSARA.println("AT+CGDCONT?");
break;
case '7':
Serial.println("0: Check network");
SerialSARA.println("AT+COPS?");
break;
case '8':
Serial.println("a: Check all available networks (takes long time)");
SerialSARA.println("AT+COPS=?");
break;
case '9':
Serial.println("j: Define PDP context");
SerialSARA.println("AT+CGDCONT=1,\"IP\",\"lpwa.telia.iot\"");
break;
case 'a':
Serial.println("k: Activate PDP context 1");
SerialSARA.println("AT+CGACT=1,1");
break;
case 'b':
Serial.println("i: Show address of the PDP contexts");
SerialSARA.println("AT+CGPADDR");
break;
case 'c':
Serial.println("n: Open UDP socket");
SerialSARA.println("AT+USOCR=17");
break;
case 'd':
Serial.println("o: Send packet to Ublox's echo server ");
SerialSARA.println("AT+USOST=0,\"echo.u-blox.com\",13,16,\"16 bytes of data\"");
break;
case 'e':
Serial.println("p: Read data from UDP socket");
SerialSARA.println("AT+USORF=0,26");
break;
case 'f':
Serial.println("g: Display current configuration");
SerialSARA.println("AT&V");
break;
// add your own AT commands
}
}
if (SerialSARA.available()) {
Serial.write(SerialSARA.read());
}
}
Below you can see my configurations ->
13:28:34.754 -> 1: Check IMEI
13:28:34.754 -> AT+GSN
13:28:34.754 -> 35275...... //edited
13:28:34.754 ->
13:28:34.754 -> OK
13:28:35.569 -> 2: Check IMSI
13:28:35.569 -> AT+CIMI
13:28:35.569 -> 23820..... //edited
13:28:35.569 ->
13:28:35.569 -> OK
13:28:36.346 -> 3: Check RAT type config
13:28:36.346 -> AT+URAT?
13:28:36.346 -> +URAT: 8
13:28:36.346 ->
13:28:36.346 -> OK
13:28:37.432 -> 4: Check band configuration
13:28:37.432 -> AT+UBANDMASK?
13:28:37.432 -> +UBANDMASK: 0,132,1,132
13:28:37.466 ->
13:28:37.466 -> OK
13:28:38.217 -> 5: Check signal
13:28:38.217 -> AT+CSQ
13:28:38.217 -> +CSQ: 16,99
13:28:38.217 ->
13:28:38.217 -> OK
13:28:38.895 -> 6: Check APN configuration
13:28:38.928 -> AT+CGDCONT?
13:28:38.928 -> +CGDCONT: 1,"IP","lpwa.telia.iot","10.81.161.177",0,0,0,0
13:28:38.928 -> +CGDCONT: 2,"IP","lpwa.telia.iot","0.0.0.0",0,0,0,0
13:28:38.928 ->
13:28:38.928 -> OK
13:28:40.995 -> 0: Check network
13:28:41.030 -> AT+COPS?
13:28:41.030 -> +COPS: 0,0,"Sonera Telia",9
13:28:41.030 ->
13:28:41.030 -> OK
13:28:52.785 -> j: Define PDP context
13:28:52.785 -> AT+CGDCONT=1,"IP","lpwa.telia.iot"
13:28:52.819 -> OK
13:28:56.311 -> k: Activate PDP context 1
13:28:56.311 -> AT+CGACT=1,1
13:28:56.311 -> OK
13:28:59.397 -> i: Show address of the PDP contexts
13:28:59.397 -> AT+CGPADDR
13:28:59.397 -> +CGPADDR: 1,10.81.161.177
13:28:59.397 -> +CGPADDR: 2,0.0.0.0
13:28:59.397 ->
13:28:59.397 -> OK
13:29:01.643 -> n: Open UDP socket
13:29:01.677 -> AT+USOCR=17
13:29:01.677 -> +USOCR: 0
13:29:01.677 ->
13:29:01.677 -> OK
13:29:03.435 -> o: Send packet to Ublox's echo server
13:29:03.469 -> AT+USOST=0,"echo.u-blox.com",13,16,"16 bytes of data"
13:29:04.619 -> +USOST: 0,16
13:29:04.619 ->
13:29:04.619 -> OK
13:29:04.855 ->
13:29:04.855 -> +UUSORF: 0,26
13:29:09.081 -> p: Read data from UDP socket
13:29:09.081 -> AT+USORF=0,26
13:29:09.081 ->
13:29:09.081 -> +USORF: 0,"195.34.89.241",13,26,"26 FEB 2019 12:29:04 CET
13:29:09.115 -> "
13:29:09.115 ->
13:29:09.115 -> OK
You can add your own AT commands easily...
--
Br/Tomi