GPRS Network Registration

11 thoughts on “GPRS Network Registration

  1. Hello,

    I’m trying to speed up the time our systems takes to start and connect to socket. Before activating the PDP context I’m verifying, through +CGREG?, if the terminal is registered to the network. Once I receive +CGREG: 1 or 5 (registered, home network; registered, roaming) I try to activate the context.

    I realized that it takes around 1 minute for the CGREG status to go from 0 (not registered, terminal is not currently searching a new operator to register to), to 2 (not registered, but terminal is currently searching a new operator to register to). Once +CGREG status is 2, it registers into the network pretty fast.

    I would like to know if there’s any command which I can use to force the modem to start searching a new operator to register to. I tried using +COPS=1,2,72405 (where 72405 is the first 5 IMSI digits of the SIM card’s operator), but it didn’t make any difference – CGREG? was still returning status 0 afterwards.

    The device I’m using is GL865 QUAD, SELINT 2.

    Best Regards,

    Denis

    1. Hey there,

      I’m attaching on this reply two case scenario logs. In the first one it takes 10 seconds from for the terminal to switch between +CGREG=0,0 (“not registered, terminal is not currently searching a new operator to register to”) and +CGREG: 0,4 (“unknown”). After that, it takes 5 seconds to register to network. After that when I try to activate the PDP context I get +CME ERROR: activation failed (this error is getting shown for one sim card once in a while).

      In the second log it takes 45 seconds for the modem to register to the network – for 40 seconds the +CGREG status was mostly unknown. That time the modem successfuly activated the PDP context.

      Could you explain me what the +CGREG status “unknown” mean? I also can make some logs in which I get around 1 minute with +CGREG status varying between 0 and 4.

      1. Hi,

        CGREG status gives the GPRS attached/GPRS registration status.

        Please, which is the result of the command “at#regmode?”  ?

        Regarding the time necessary for GPRS attach and GSM registration, this depends on many factors (SIM, particular location, previous registration, etc.).

        A registration time of 45 seconds is possible in some conditions, also higher

        Regarding ther error, I see you send AT#SGACT with less than 200ms after you received  +CGREG: 0,1 (in particular::

        [07/10/15 16:39:20.177]: ..+CGREG: 0,1….OK..

        [07/10/15 16:39:20.291]: AT#SGACT=1,1,claro,claro.

        )

        In this log is not visibile the field strength of the serving cell . It’s necessary a suffìcient field strenght to get a GPRS attach

        Please, try to increase the time between the +CGREG: 0,1 and AT#SGACT and include a periodic at+csq command to check the field strength and also , with lower frequency, an at#moni command

        1. Hey there Luca,

          I’m now giving a 2s delay between the time I receive +CGREG: 0,1 , and send AT#SGACT. I’m attaching a log which the modem gets unresponsive after AT#SGACT is sent – this is actually happening quite often with operator TIM. In this case it took 12s for the modem to switch between CGREG=0,0 to CGREG=0,2.

          In the same file there’s a second log in which I’m sending +CSQ and #MONI. In the #MONI command I saw that the network was still attached to GPRS operator Tim, although the selected SIM card was Claro. While #MONI shows the modem is connected to a Tim cell, the modem keeps not searching for network.

           I also started using +CGATT=0 to make sure I would dettach from the Network. When I was doing that at inicialization I was getting an ERROR as response (probably the modem was still not connected to any GPRS network). I was also sending +CGATT=0 every time I was disconnecting the socket (#SH), and I was receiving OK as answer – but the time to attach to a new SIM card was still slow, 15s. (Log 3)

          I started using AT+CGATT=1 everytime when CGREG=0,0, but I was getting +CME ERROR: operation not allowed (Log 4) – anyway it took 11s between first sending AT+CGATT=1 and making the GPRS attach, but the PDP context activation made the modem unresponsive.

          I would like to know how to effectively use CGATT in order to speed up the GPRS attachment. Also I’d like to know what to do once the modem gets unresponsive – is there any timeout I can set for context activation? [In other cases when the modem doesn’t answer an AT command is there a default procedure different than reseting the modem?]

          Best Regards,

          1. hi,

            there isn’t any log attached and there is not an answer  from my previous question:

            ‘Please, which is the result of the command “at#regmode?”  ?’

          2. the first part of the log is not useful: few info.

            About the other parts of the log:

            ===========================================================+CSQ and #MONI being sent ================================================================================== :

            #CIMI: 724058805607036….OK..  –> Claro SIM used

            [13/10/15 12:16:54.600] #MONI: TIM BRASIL BSIC:44 RxQual:0 LAC:2D3D Id:0354 ARFCN:620 : PWR:-66dbm   
            –> the module was GSM registered on TIM BRASIL net, but NOT GPRS attached, as you can see from the next command

            [13/10/15 12:16:55.603].+CGREG: 0,0….OK..

            [13/10/15 12:17:01.045]+CGREG: 0,2….OK..  
            –> It’s visible that this CLARO SIM doesn’t permit a GPRS attach on the TIM BRasil net, or the GPRS service is not supported on that TIM cell

            [13/10/15 12:17:03.283]#MONI: Claro BSIC:52 RxQual:0 LAC:1181 Id:2798 ARFCN:859 PWR:-86dbm TA:0….OK..              
            [13/10/15 12:17:03.490]+CGREG: 0,1….OK..
            –> as soon as the module is registered on the CLARO net, the GPRS attach is possible

            ===========================================================+CGATT=0 being sent ==================================================================================:

            [08/10/15 20:13:18.885] AT+CGATT=0.

            [08/10/15 20:13:22.423] AT#SIMDET=0.

            [08/10/15 20:13:25.714] AT#SIMDET=1.

            [08/10/15 20:13:43.100] +CGREG: 0,0….OK.

            [08/10/15 20:13:44.199] +CGREG: 0,2….OK.

            –> It’s possible to assume that until now the module was registered on TIM BRASIL or other net, where the CLARO SIM dosn’t have GPRS service agreement or  the GPRS service is not supported on that cell. But it’s not possible to see if the module was or not registered on a cell whatever it can be

            [08/10/15 20:13:47.349] +CGREG: 0,1….OK..

            -> It’s possible to assume that the module  registered on CLARO and got also GPRS attach
             

            ===========================================================+CGATT=0 and +CGATT=1 being sent ================================================================================== :

             
            [08/10/15 21:22:10.359] AT+CGATT=0.

            [08/10/15 21:22:24.882] AT#SIMDET=0.

            [08/10/15 21:22:27.173] AT#SIMDET=1.

            [08/10/15 21:22:33.996] AT+CGATT=1.

            [08/10/15 21:22:33.061] +CME ERROR: operation not allowed

            –> It’s possible to assume that until now the module was registered on TIM BRASIL or on another net, where the CLARO SIM doesn’t have GPRS service agreement or  the GPRS service is not supported on that cell.
            If you force the GPRS attach, it is without success

            [08/10/15 21:22:33.242] +CGREG: 0,0….OK.

            [08/10/15 21:22:38.477] AT+CGATT=1.
            –> with success (after 11 seconds from AT#simdet=1)
            -> It’s possible to assume that the module  registered on CLARO and got also GPRS attach and so the procedure to force GPRS attach have had success:

            [08/10/15 21:22:44.084] +CGREG: 0,1….OK..

            ************************************************

            General considerations

            Please consider that if  the module is registered on a net in roaming and switched off in that condition in automatic mode, at next  switch on,  the module will start to search the same net for registering on.

            You could try to use manual mode to force the registration on CLARO with this command:
            at+cops=1,2,72405

            but if there will not be CLARO coverage, you could not have any services with other nets, with at+cops=1.

            You could use also  at+creg=1, at+creg=2, (evaluate also if saving this setting with at&p and at&w commands) other than at+cgreg commands, to know about  GSM registration status with unsolicited messages and obviously at+csq, at#moni, at#servinfo to know about which net are you registered on

            About when the module becomes unresponsive,it’s necessary to see if a net timeout has to expire or not.
            The rule is waiting for an OK or an ERROR message. You need to consider the timeouts indicated at the paragraph 3.2.4. Command Response Time-Out of the AT commands Reference user guide of the product.
            Only after that these timeouts have expired,you should consider at#reboot command

          3. Hello Luca,

            regarding the case where I was using +CGATT=0 and +CGATT=1, I don’t understand:

            1. Why do you assume “It’s possible to assume that until now the module was registered on TIM BRASIL or on another net, where the CLARO SIM doesn’t have GPRS service agreement or  the GPRS service is not supported on that cell.”? If I have sent AT+CGATT=0 and got OK, the module is not supposed to be attached to any GPRS network at that momment.

            2. I’m not switching on and off the module between context activations. And anyway I’m setting on initialization of the module +COPS=2 and +CGATT=0. I’m setting +COPS=2 because I only use GPRS on my application. Why do you advise me to make a GSM registration with at+cops=1,2,72405? I thought forcing the GPRS attache was supposed to be enough.

            3. Why does +CGREG keeps showing me that the module is not attached AND not searching for a new operator for so long even though I’m sending AT+CGATT=1?

            The product I’m working on is supposed to be used on vehicles that run on low GPRS network coverage. So we use 2 SIM cards by two different operators. The application should check for GPRS coverage and try to connect to a socket as soon as it attaches to GPRS network.

            In the log I’m attaching the following scenario happens: Module connected the socket with TIM, sent something to the server, timedout due to network traffic inactivity – module sent NO CARRIER [log starts there]. Once I got a NO CARRIER I discconect socket, dettach from network, select a new SIM card and try to activate context. It took  ~76s for AT+CGATT=0 to return OK (gprs dettach). Plus it took ~20s between SIMDET=1 and +CGREG=0,2 (starts looking for GPRS network). I still don’t understand why it takes so long to look to another GPRS network.

            It seems like +CGATT=0 is not really useful for my application because it adds so much overhead. I’m

          4. Hello Luca,

            regarding the case where I was using +CGATT=0 and +CGATT=1, I don’t understand:

            1. Why do you assume “It’s possible to assume that until now the module was registered on TIM BRASIL or on another net, where the CLARO SIM doesn’t have GPRS service agreement or  the GPRS service is not supported on that cell.”? If I have sent AT+CGATT=0 and got OK, the module is not supposed to be attached to any GPRS network at that momment.

            [Luca: I wrote this comment after this sequence:

            [08/10/15 21:22:10.359] AT+CGATT=0.

            [08/10/15 21:22:24.882] AT#SIMDET=0.

            [08/10/15 21:22:27.173] AT#SIMDET=1.

            [08/10/15 21:22:33.996] AT+CGATT=1.

            [08/10/15 21:22:33.061] +CME ERROR: operation not allowed

            if you got the ERROR, after you have issued AT+CGATT=1, it means that the GPRS attach attempt has failed and the supposed reason (supposed, because there are few info in your log) is the one I wrote above, and the SIM used, from your AT commands log seemed a CLARO SIM (see the at +cimi answer]

            2. I’m not switching on and off the module between context activations. And anyway I’m setting on initialization of the module +COPS=2 and +CGATT=0. I’m setting +COPS=2 because I only use GPRS on my application.  [Luca: this info is missing in your previous post: how do you think that I could know this if you don’t write it or it’s not in the log?   furthermore if you issue at+cops=2 you deregister from GSM network and also GPRS service is affected. so it should not be sufficient to issue at+cgatt=1 to get a GPRS attach.  To work in GPRS only you could use AT+CGCLASS = “CG” command. Please , as I’ll ask again later, try to investigate the behaviors that you observe by yourself  with a good setup of debug info (a complete log with at+csq, at#moni before to attempt a GPRS attach and after the attempt in case it fails,  also with inizialization commands).]

            Why do you advise me to make a GSM registration with at+cops=1,2,72405? I thought forcing the GPRS attache was supposed to be enough. [Luca: please, read above]

            3. Why does +CGREG keeps showing me that the module is not attached AND not searching for a new operator for so long even though I’m sending AT+CGATT=1?

            [Luca: one reason is what I wrote above, another one is this: if you use this application in area with ” low GPRS network coverage” – other new info unknown before –  obviously the module could find some difficulties to find a signal of sufficient strength to get a service and get a reliable GPRS attach. e.g. the GPRS attach could fail for temporary too low strength signal and then a reselection process  would start, so long time could be necessary. This is not a problem: a low GSM /GPRS coverage it’s a dfficult environment for every module in the world]

            The product I’m working on is supposed to be used on vehicles that run on low GPRS network coverage. So we use 2 SIM cards by two different operators. The application should check for GPRS coverage and try to connect to a socket as soon as it attaches to GPRS network.

            In the log I’m attaching the following scenario happens: Module connected the socket with TIM, sent something to the server, timedout due to network traffic inactivity – module sent NO CARRIER [log starts there]. Once I got a NO CARRIER I discconect socket, dettach from network, select a new SIM card and try to activate context. It took  ~76s for AT+CGATT=0 to return OK (gprs dettach). [Luca: As I wrote, a low GSM /GPRS coverage it’s a dfficult environment. Please use AT+CGCLASS = “CG” command and monitor the signal strength wit at+csq and at#moni. ]

            Plus it took ~20s between SIMDET=1 and +CGREG=0,2 (starts looking for GPRS network). I still don’t understand why it takes so long to look to another GPRS network.

            [Luca: changing a SIM and start with a new SIM it could be a time consuming task for cell selection and registration, especially in  low GPRS network coverage for every module in the world, at the state of the art of technology. 

            Please try to investigate the behaviors that you observe by yourself  with a good setup of debug info and with AT+CGCLASS = “CG” setup (a complete log with at+csq, at#moni before to attempt a GPRS attach and after the attempt in case it fails,  also with inizialization commands).]

            It seems like +CGATT=0 is not really useful for my application because it adds so much overhead. I’m

          5. Hello,

            I’m located at a city with great GPRS coverage. I meant that the final product will be installed on vehicles that will run on low GPRS covarage area, and that’s why I need to optimize the attach time.

            I didn’t post the whole log because it is huge – about COPS=2 it was fine so far using it and making a GPRS attach, and I was getting CREG=0,0. Anyway next time I will send complete logs & will use AT+CGCLASS = “CG” to see if there will be any effect.

            Best Regards,

            Denis

          6. Thanks for the support Luca.

            Just for the record, the best approach regarding speed of registration was using sending AT+CGCLASS=”CG” after everytime I switch sim cards (with automatic gprs registration – default). 

            🙂