wiki:AtCommandConnSetup

Connection setup (including all bells and whistles)

Verify

Verify SIM presence

AT+CPIN responds with 'SIM not present' if the SIM is not present.

Verify PIN status

AT+CPIN? responds with READY or SIM PIN. In the SIM PIN case we need to provide the SIM PIN with AT+CPIN="$pin".

Verify APN

AT+CGDCONT=2,"IP","$apn
AT+CGACT=1,2

will return with an error if the PDP context with APN $APN could not be activated. Note that we use PDP context 2, as usually PDP context 1 is used by normal connection.

Verify signal strength

AT+CSQ

will give you the signal strength. You will need a value between 7 and 11 minimum to properly attach (depends on the 3G card).

Setup

Set functionality

AT+CFUN=1

will enable the device (see also AtCommandCfun).

Enable readable error messages

AT+CMEE=2

will produce human readable +CME ERROR: messages.

Select system preference

Option

AT_OPSYS=$mode,$domain

where $mode is one of 0 (GSM only), 1 (WCDMA only), 2 (GSM preferred), 3 (WCDMA preferred), 4 (no change), 5 (auto), and $domain is one of 0 (CS only), 1 (PS only), 2 (CS and/or PS), 3 (no preference), 4 (no change), 5 (PS attach on demand), 6 (PS detach on demand).

Other modems

... have similar commands.

Connect

Completely:

AT+CGDCONT=$PDP,"IP","$APN"
AT+CGACT=1,$PDP
AT+CGDATA="PPP",$PDP

or (the usual approach)

AT+CGDCONT=$PDP,"IP","$APN"
ATDT*99***$PDP#

For APN (and username/password) information, please see

or the combination of these sources (PLMN/APN/username/password) in attachment:simcfgs.lst .

Disconnect

Normally this happens through PPP tearing down the connection or the modem signalling loss of connection through dropping carrier.

First serial port (ppp)

PPP will tear down its link when exiting.

Second serial port (auxiliary)

TBD: It should be possible to tear down the connection through the secondary / auxiliary serial port, for example by sending AT+CGACT=0, ATH0, or AT+CGATT=0.

Last modified 6 years ago Last modified on Apr 29, 2013, 10:41:14 AM

Attachments (1)

  • simcfgs.lst (8.2 KB) - added by nick 6 years ago. SIM configuration information (rev.13162)

Download all attachments as: .zip