M95 error on CGATT=1

Right after power on and initial configuration, I can see the modem has CGATT=0.
If I send AT+CGATT=1 I get +CME ERROR: unknown

That happens only within the first few seconds after power on, as if some internal state is not yet ready. Error message does not really help!

I tried:

  1. waiting for CPAS=0, since it is 2 initially
  2. waiting for CREG=1
  3. even waiting for CGREG=1

But none of those helped, in any combination. It seems just a time related issue.

So far my workaround is to delay a few seconds after power on, but I need to know if this delay is always the same or if it depends on other conditions. Or if it can be avoided at all by using a particular AT command sequence.

It seems the modem does automatically attach to PS, since CGREG goes from 2 to 1 anyway after a while, but the initial status of CGATT=0 does not reflect this. I also tried to avoid setting CGATT=1 if I find it already set, but I always get it as 0, until some time is elapsed, so that doesn’t help either.

Dear Sir,
Thanks for your inquiry in Quectel forums.
Actually, the module will attach the CS&PS automatically after power on normally. For M95 module, it may need less than ten seconds to register on network successfully. You do not need to send AT+CGATT=1 to let the module to attach the GPRS network, if you send it, it may interrupt the auto attach process.

For your issue, please check the module status firstly, you can use AT+COPS?, AT+CSQ, AT+CGREG? AT+CREG? to check it. If still have issue, please help to provide your test AT log include the above AT command. Thanks!

Thank you Kyson,

I did try to check the status first, but I still get the error the first time I use AT+CGATT=1, unless I put some delay in.

It’s not a big issue, as I can repeat the command until it succeeds, but it seems to me that the command should not fail: after all it is already trying to attach and I request it to attach, so why giving the error? It could just answer OK (instead of “unknown error”), then I wait for CGREG to be 1 or 5 and I’m ready to go. This exact sequence just works any time, except the very first few seconds after boot.

Dear PPescher,
Just as you have said that it only occurs after the module booting, and you know the module will attach the network automatically after booting. The reason why it will have error information, because this setting will interference the module attaching process. And you do not need to send it, please skip it. Thanks!