From what I’ve seen the module automatically registeres to network on startup. Afterwards, it automatically attaches to GPRS. Meaning, I dont have to send “AT+CGATT=1” to attach to GPRS but only query the status and wait.
Untill yesterday I was waiting for AT+CGREG? To return either CGREG: 0,1 or CGREG: 0,5. When it did, I knew that bringing up the wireless connection (SAPBR=1,1) is possible. Querying CGATT when CGREG is either 1 or 5 always return as 1(attached).
As mentioned before, we saw that even when CGREG is 0, querying CGATT might return 1 (attached) and bringing up the wireless connection is successful.
The bottom line question is whats right here when entering the transmission function?
We are transmitting in approximately 1 hour intervals but the user might request an instant transmission from time to time.
Between transmissions we put the module to sleep using DTR (CSCLK=1) and we dont keep track of its’ registration status until the next time we want to transmit. The maximum transmission size is 2Kbyes by http post request.
I know that the first thing to do after taking the module out of sleep is to wait for network registration (CREG). But whats next?
Should I query only CGATT or CGREG also?
Is there a need to manually attach (CGATT=1) and if so, when is the right time do it? Immidiately after I get registration or after some timeout?
And for last, should I detach from the GPRS (CGATT=0) and PDP context (SAPBR=0,1) at the end of the transmission?