Working with MKR NB1500 how I'm supposed to communicate with SARA when it is in PSM?
With sketch below I can see that SARA is in PSM and therefore it stops responding to commands. I was thinking that after one hour I can just type some AT-command to serial to see if SARA is awake, but obviously it doesn't work like that.
So if I have defined for example "Requested_Periodic_TAU" = 1 hour and "Requested_Active_Time" = 10 seconds, do I have to track in processor firmware when 1 hour has gone and then I have 10 seconds time to send data to server? Or how does it work?
#include <MKRNB.h>
const char PINNUMBER[] = "";
NBClient client;
GPRS gprs;
NB nbAccess(true);
void setup() {
pinMode(SARA_RESETN, OUTPUT);
digitalWrite(SARA_RESETN, LOW);
pinMode(SARA_PWR_ON, OUTPUT);
digitalWrite(SARA_PWR_ON, HIGH); // Send Poweron pulse
delay(200);
digitalWrite(SARA_PWR_ON, LOW);
SerialSARA.begin(115200);
Serial.begin(115200);
while (!Serial);
boolean connected = false;
while (!connected) { // After starting the modem with NB.begin()
if ((nbAccess.begin(PINNUMBER) == NB_READY) && // attach to the GPRS network with the APN, login and password
(gprs.attachGPRS() == GPRS_READY)) {
connected = true;
} else {
Serial.println("Not connected");
delay(1000);
}
}
Serial.println("→ Enabling PSM for 60min...");
Serial.println();
SerialSARA.println("AT+CPSMS=1,,,\"00100001\",\"00000111\"");
delay(2000);
SerialSARA.println("AT+CPSMS?");
}
void loop() {
if (Serial.available()) {
SerialSARA.write(Serial.read());
}
if (SerialSARA.available()) {
Serial.write(SerialSARA.read());
}
}
Serial response:
AT
OK
AT+CMEE=0
OK
AT+CFUN=0
OK
AT+CPIN?
+CPIN: READY
OK
AT+CMGF=1
OK
AT+UDCONF=1,1
OK
AT+CTZU=1
OK
AT+CGDCONT=1,"IP",""
OK
AT+UAUTHREQ=1,0
OK
AT+CFUN=1
OK
AT+CEREG?
+CEREG: 0,0
OK
AT+CEREG?
+CEREG: 0,0
OK
AT+CEREG?
+CEREG: 0,0
OK
AT+CEREG?
+CEREG: 0,0
OK
AT+CEREG?
+CEREG: 0,0
OK
AT+CEREG?
+CEREG: 0,0
OK
AT+CEREG?
+CEREG: 0,0
OK
AT+CEREG?
+CEREG: 0,2
OK
AT+CEREG?
+CEREG: 0,2
OK
AT+CEREG?
+CEREG: 0,5
OK
AT+CGATT=1
OK
AT+CGACT?
+CGACT: 1,1
OK
→ Enabling PSM for 60min...
AT+CPSMS=1,,,"00100001","00000111"
OK
AT+CPSMS?
+CPSMS:1,,,"00000110","00000111"
OK
Thanks,
tipo