BG77 NB-IoT PSM issues

Hello,
I am using BG77 module on UMTS & LTE eval kit. I wanted to measure the power consumptions of the module when sending data using MQTT to cloud. I am using PSM mode to reduce the power consumption by setting the TAU timer to 1Hour and active time to 20seconds.

  1. I had a doubt as to what are the initial network connection or initial AT commands to be executed when the module wakes up when TAU timer expires.
  2. I had opened a mqtt broker before the PSM timer started and wanted to publish some data when the module wakes up from PSM sleep. But when I tried to publish as soon as module wakes up, it failed to publish or subscribe untill i used COPS command to connect to network operator. Once i connected to network using COPS command, it was able to publish to mqtt broker. So it would be helpful to know what must be done or what not, when the module wakes up from PSM sleep.

Thanks in advance.

May I know , your device is static or moving device 。

normally , when the module wake up from PSM sleep , it will keep the last status , we do not need register network again ,

But , if the last connecting is not available again , it will go OOS procedure , and try to register again

Hello,
Our device is a static one.
1)I have attached the following sequence which I follow to upload data to cloud for your reference which works well when PSM timer is not used, But when we use the timer and when module wakes up from PSM sleep, we wanted to know if we could publish as soon as module wakes up(But this method gave error when we tried to publish a message as soon as module wakes up and we had to connect to operator using AT+COPS command and then open a network to MQTT broker using AT+QMTOPEN to send the message).

AT+CFUN=0,0

OK

+QSIMSTAT: 1,0
AT+QCFG=“iotopmode”,1

OK
AT+QCFG=“nwscanseq”,020301

OK
AT+QCFG=“band”,0,0,80

OK
AT+QCFG=“servicedomain”,2,1

OK
AT+CFUN=1,0

OK

+QSIMSTAT: 1,1

+CPIN: READY

+QUSIM: 1

+QIND: SMS DONE
AT+COPS=?

+COPS: (1,“Telekom.de”,“TDG”,“26201”,9),(0,1,2,3,4),(0,1,2)

OK
AT+COPS?

+COPS: 1

OK
AT+COPS=1,2,“26201”,9

OK
AT+QMTOPEN=0,“broker address”,1883

OK

+QMTOPEN: 0,0
AT+QMTCONN=0,“abc”,“def”,“ghi$”

OK

+QMTCONN: 0,0,0
AT+QMTSUB=0,1,“topic name”,0

OK

+QMTSUB: 0,1,0,0

+QMTRECV: 0,0,“topic name”,“Message received”

2)When we used PSM timer of 1hour and active time of 20seconds and when we tried to publish as soon as module woke up, we followed the following sequence:
AT+CPSMS=1,“00100001”,“00000101”

OK

+QPSMTIMER: 3600,10

+QMTSTAT: 0,1

+QIURC: “pdpdeact”,1

PSM POWER DOWN
@àP$`"
RDY

+QSIMSTAT: 1,1

+CPIN: READY

+QUSIM: 1

+CFUN: 1

+QIND: SMS DONE

APP RDY

AT+QMTPUB=0,2,1,1,“topic name”

ERROR

AT+COPS=1,2,“26201”,9

OK

AT+QMTOPEN=0,“broker address”,1883

OK

AT+QMTCONN=0,“abc”,“def”,“ghi”

OK

+QMTCONN: 0,0,0

AT+QMTPUB=0,2,1,1,“topic name”

PART1_test

OK

+QPSMTIMER: 3600,10

+QMTPUB: 0,2,0
AT+QMTSUB=0,1,“topic name”,0

OK

+QMTSUB: 0,1,0,0

+QPSMTIMER: 3600,10

+QMTSTAT: 0,1

+QIURC: “pdpdeact”,1

PSM POWER DOWN

RDY

So are we doing something wrong ? Is there a sequence which must be followed`?

Thanks in advance.

As far as I see, you try to use “AT+QMTPUB” after wake-up. I think your MQTT connection disconnects, or the MQTT “socket” closes.
So after wake up try to call AT+QMTOPEN or/and AT+QMTCONN and wait for the +QMTCONN urc before trying to send. I don’t think this issue is related to the network connection. It could be a good practice thought to check the registration status with the AT+CEREG command, after wake up.
I have never worked with MQTT on these modules before, so my solution is just a guess, but maybe helps.

Thankyou for your insights

Should we open the MQTT broket and connect to it, every time when the module reboots? or does the module has the network open even if you reboot the device?

When you reboot the device, you have to reopen/reconnect everything.
If you are talking about exiting PSM, the device stays connected on the mobile network, but I think the MQTT broker may closes. I use TCP sockets, and they do close after a while, so I need to reopen them.
After you leave PSM, try to reopen/reconnect the MQTT broker. On the BC66 there is an AT+QMTCFG command, where you can configure the keepalive interval. Maybe if you set it long enough, you won’t need to reconnect to the broker.

when you wakeup from PSM , you need to set up socket again ,

pls begin from :slight_smile:

AT+QMTOPEN=0,“broker address”,1883