Detecting SMS service status

Does anyone know if there is a way to verify that the SMS service is available - ideally before trying to send an SMS and getting an error code? Presumably theres an AT command to query the status of the modem, but where do I start looking ?

Basically I want my app to be able to recognise and reject a duff SIM card at start up. I check the initialisation state of the SIM but that always returns OK even with a bad SIM. Presumably that just means that the SIM data has been read out OK.

There is no specific way to check for SMS service.

You can check GSM registration with AT+CREG and/or monitor +CREG: and/or +WIND: unsolicited responses - clearly, you can’t do anything network-realted when you’re not registered to the network! … =15#p17708

You could also check that AT+CSCA does not give “error”.

When you do get an error code, be sure to check it to see if it indicates a network problem!

Why, the AT Commands Manual, of course! 8)

How, exactly, do you check that?

What, precisely, do you mean by a “bad” SIM here?

Note that +WIND: 16 is documented as,

This refers only to internal initialisations within the modem - you also have to wait for network registration.

Thanks again awneil, very helpful as always. The bad SIM I referred to was such that the modem was unable to register on the network and my software didn’t detect that. I got the SIM initialisation status OK, but I think that just means that OpenAT has managed to read the SIM data.

In the end I used the response to the CREG command to determine network status. More useful to my app and not necessarily just to do with the SIM really, could be a variety of reasons.



SIM initialisation is necessary, but not sufficient.

CREG state = 1 or 5 is necessary and sufficient.