AT Commands: Difference between revisions

From Teltonika Networks Wiki
mNo edit summary
 
(16 intermediate revisions by 5 users not shown)
Line 1: Line 1:
'''AT commands''' ("AT" meaning 'attention') are instructions used to control a modem.
<p style="color:red">The information on this page is updated in accordance with the [https://wiki.teltonika-networks.com/view/FW_%26_SDK_Downloads'''00.07.08'''] firmware version .</p>
__TOC__
__TOC__
==Summary==
==Summary==


The command set consists of a series of short text strings which can be combined to produce commands for operations such as dialing, managing SMS functions, and changing the parameters of the connection. Many of the commands that are used to control wired dial-up modems, such as ATD (Dial), ATA (Answer), ATH (Hook control) and ATO (Return to online data state), are also supported by GSM/GPRS modems and mobile phones. This section is an overview of some AT commands that can be used with RUT routers.
'''AT commands''' ("AT" meaning 'attention') are instructions used to control a modem. The command set consists of a series of short text strings that can be combined to produce commands for operations such as dialing, managing SMS functions, and changing the parameters of the connection. Many of the commands that are used to control wired dial-up modems, such as ATD (Dial), ATA (Answer), ATH (Hook control), and ATO (Return to online data state), are also supported by GSM/GPRS modems and mobile phones. This section is an overview of some AT commands that can be used with RUT routers.


==gsmctl commands==
==gsmctl commands==


'''gsmctl''' is a set of shell commands that can request information from or perform operations on a modem. In other words, gsmctl is a way to use AT commands in shell form. You can use them via SSH or '''[[CLI]]''', the command line interface that can be used via the router's WebUI.  
'''gsmctl''' is a set of shell commands that can request information from or perform operations on a modem. In other words, gsmctl is a way to use AT commands in shell form. You can use them via SSH or '''[https://wiki.teltonika-networks.com/view/Command_Line_Interfaces CLI]''', the command line interface that can be used via the router's WebUI.  


===SSH===
===SSH===
----
To log in to a RUT router via SSH, download the free '''PuTTY''' app if you're using Windows; if you're using a Linux-based OS, just use the Terminal app. In both cases you will need to know three things: the router's LAN IP address, user name and password. The default LAN IP address for all RUT routers is '''192.168.1.1'''; the default login information is username: '''root'''; password: '''admin01''' (NOTE: the user name used for SSH connections (i.e., root) is not the same as the user name used to log in to the router's WebUI (i.e., admin)).


To log in to a RUT router via SSH, download the free '''PuTTY''' app if you're using Windows; if you're using a Linux based OS, just use the Terminal app. In both cases you will need to know three things: the router's LAN IP address, user name and password. The default LAN IP address for all RUT routers is '''192.168.1.1'''; the default log in information is username: '''root'''; password: '''admin01''' (NOTE: the user name used for SSH connections (i.e., root) is not the same as the user name used to log in to the router's WebUI (i.e., admin)).
If you're using PuTTY, enter the router's LAN IP address into the '''Host Name (or IP address)''' field, select SSH Connection type and click '''Open'''. After this, you will be prompted to enter the username and password.  
 
If you're using PuTTY, enter the router's LAN IP address into the '''Host Name (or IP address)''' field, select SSH Connection type and click '''Open'''. After this you will be prompted to enter the user name and password.  


If you're using Linux, open a Terminal and type this command:
If you're using Linux, open a Terminal and type this command:
Line 22: Line 22:


===Usage===
===Usage===
 
----
The syntax for a gsmctl command is ''gsmctl OPTIONS''. A list possible ''gsmctl'' options is provided below:
The syntax for a gsmctl command is '''gsmctl OPTIONS'''. A list possible '''gsmctl''' options is provided below:
   
   
  -p, --ip <INTERFACE> Get IP of logical interface
   -e, --bsent <INTERFACE>       Get number of bytes sent
   -e, --bsent <INTERFACE> Get number of bytes sent
   -r, --brecv <INTERFACE>       Get number of bytes recieved
   -r, --brecv <INTERFACE> Get number of bytes recieved
   -j, --connstate               Get mobile connection state
   -j, --connstate Get 3G connection state
   -P, --psstate                Get package domain service state
   -g, --netstate Get network link state
   -g, --netstate                Get network link state
   -i, --imei Get device IMEI
   -C, --cellid                 Get cell id parameter
  -J, --iccid Get SIM ICCID
   -o, --operator               Get name of operator used
  -m, --model Get device model
   -f, --opernum                 Get operator number
  -w, --manuf Get device manufacturer
   -t, --conntype               Get data carrier type
  -a, --serial Get device serial number
   -F  --network                 Get network information
  -y, --revision Get device revision number
   -K  --serving                 Get serving cell information
  -x, --imsi Get IMSI
   -I  --neighbour               Get neighbour cell information
  -z, --simstate Get SIM card state
   -v, --volte_state            VoLTE state status
  -u, --pinstate Get PIN state
   -b, --band                    Print current band
  -q, --signal Get GSM signal level
  -q, --signal                  Get signal levels
  -X, --rscp    Get WCDMA rscp level
   -G, --cainfo                  Get carrier aggregation bands are using right now
  -E, --ecio    Get WCDMA ec/io level
  -W, --rsrp          Get LTE rsrp level
  -Z, --sinr  Get LTE sinr level
  -M, --rsrq Get LTE rsrq level
   -C, --cellid         Get cell id parameter
   -o, --operator Get name of operator used
   -f, --opernum Get operator number
   -t, --conntype Get data carrier type
  -c, --temp Get module temperature in 0.1 degrees Celcius
  -B, --pincount Get pin/puk count
   -F  --network         Get network information
   -K  --serving         Get serving cell information
   -I  --neighbour Get neighbour cell information
   -D, --shutdown Shutdown the modem
   -h, --help Prints this information
   -v, --version  Print version


  sms managing options:
'''modem commands:'''
   -S -r, --sms --read <INDEX> Read SMS by index
  -A, --at <cmd>                Execute AT command.
   -S -l, --sms --list <TYPE> List SMS by type [all, read, new]
  -i, --imei                    Get device IMEI
   -S -t, --sms --total Print SMS memory usage
  -a, --serial                  Get modem serial number
   -S -d, --sms --delete <INDEX> Delete SMS by index
  -J, --iccid                  Get SIM ICCID
   -S -s, --sms --send "<NUMBER> <TEXT>" Send SMS. IMPORTANT! Number and text must be within quotes
  -m, --model                  Get device model
   -S -b, --sms --send-b64 <NUMBER> Send SMS encoded in base64 from /tmp/.smstext
  -w, --manuf                  Get device manufacturer
  -y, --firmware                Get device revision number
  -x, --imsi                    Get IMSI
  -z, --simstate                Get SIM card state
  -u, --pinstate                Get PIN state
  -H, --modemtime <1/2>        Get operator station time(1 - GMT, 2 - LOCAL)
  -c, --temp                    Get module temperature in 0.1 degrees Celcius
  -B, --pincount                Get pin/puk count
  -E, --info                    Get modem info in json format
  -U --ussd <command>          The command allows control of the Unstructured Supplementary Service Data. (response saved in /tmp/ussd file)
  -Y  --switch                  Switch sim card for modem
  -T  --simslot                Get current sim card slot for modem
  -Q, --reboot                  Reboot the modem
'''sms managing options:'''
   -S -r, --sms --read           <INDEX> Read SMS by index
  -S -R, --sms --pdu_read      <INDEX> Read PDU by index
   -S -l, --sms --list           <TYPE> List SMS by type [all, read, new]
   -S -t, --sms --total         Print SMS memory usage
   -S -d, --sms --delete         <INDEX> Delete SMS by index
  -S -Z, --sms --pdu_delete    <INDEX> Delete PDU by index
   -S -s, --sms --send           "<NUMBER> <TEXT>"Send SMS. IMPORTANT! Number and text must be within quotes
'''auxilary options:'''
   -O, --modem <USB_ID>          Set MODEM by USB_ID(3-1, 1-1.4 etc.)
  -N, --num  <MODEM_NUM>       Set MODEM by modem number(0 - 12)
  -D, --debug                  Enable debug information


compatibility options:
You can view this list via terminal by typing '''gsmctl -h''' or '''gsmctl --help'''.
  -N, --he910 Support for Telit HE910-EUD
  -R, --em820w Support for Huawei EM820W
  -U, --me909u Support for Huawei LTE ME909u
  -V, --le910 Support for Telit LE910


auxiliary options:
For example, try using ''gsmctl -q'' to get the current signal levels value in dBm. You can also combine options. For example, ''gsmctl -oqt'':
  -A, --at <COMMAND> Send AT command to device
  -H, --shell Enter shell mode
  -k, --debug Enable debug information
  -n, --nolog Do not log the command


You can view this list via terminal by typing ''gsmctl -h'' or ''gsmctl --help''.
[[File:Gsmctl q.png|border|center|class=tlt-border|457x228px]]


For example, try using ''gsmctl -q'' to get the current RSSI value in dBm. You can also combine options. For example, ''gsmctl -oqt'':
Unlike '''gsmctl -q''', '''gsmctl -oqt''' returns three options: operator's name, signal levels, carrier, and operator type, as you can see in the example above.
 
[[File:Gsmctl usage.png]]
 
Unlike ''gsmctl -q'', ''gsmctl -oqt'' returns three options: operator's name, signal quality level and carrier type, as you can see in the example above.


==AT command usage==
==AT command usage==


To use a specific AT command via SSH, you can use the ''gsmctl -H''. After this your console will enter shell mode where you can then just type AT commands in their regular format. Or you can use ''gsmctl -A <AT_COMMAND>'' to execute AT commands one at a time. Continuing from the example above, lets say you want to find out the RSSI value. While there are quite a few commands that can be used to achieve this goal, lets use the '''AT+CSQ''' that is used when executing ''gsmctl -q'':
To use a specific AT command via SSH, you can use the ''gsmctl -H''. After this, your console will enter shell mode where you can then just type AT commands in their regular format. Or you can use ''gsmctl -A <AT_COMMAND>'' to execute AT commands one at a time. Continuing from the example above, let's say you want to find out the RSSI value. While there are quite a few commands that can be used to achieve this goal, lets use the '''AT+CSQ''' that is used when executing ''gsmctl -q'':


[[File:At csq.png]]
[[File:Gsmctl A.png|border|center|class=tlt-border|441x84px]]


As you can see this time the command returns two values instead of one, and they don't directly represent the RSSI value as with ''gsmctl -q''. The reason for this is that AT+CSQ indicates the received signal strength '''<rssi>''' and the channel bit error rate '''<ber>''' and the numbers returned are not the direct values but rather the representation of the direct values.
As you can see this time the command returns two values instead of one, and they don't directly represent the RSSI value as with ''gsmctl -q''. The reason for this is that AT+CSQ indicates the received signal strength '''<rssi>''' and the channel bit error rate '''<ber>''' and the numbers returned are not the direct values but rather the representation of the direct values.
Line 99: Line 95:
  2...30        -109dBm... -53dBm
  2...30        -109dBm... -53dBm
  31            -51dBm or greater
  31            -51dBm or greater
  99             Not known or not detectable
  99             Not known or not detectable
  100            -116dBm or less
  100            -116dBm or less
  101            -115dBm
  101            -115dBm
  102...190      -114dBm...-26dBm
  102...190      -114dBm...-26dBm
  191            -25dBm or greater
  191            -25dBm or greater
  199           Not known or not detectable
  199             Not known or not detectable
  100~199       Extended to be used in TD-SCDMA indicating received signal code power (RSCP)
  100~199         Extended to be used in TD-SCDMA indicating received signal code power (RSCP)
 
<ber>          Channel bit error rate (in percent)
0...7          As RXQUAL values in the table in 3GPP TS 45.008 subclause 8.2.4
99              Not known or not detectable
 
So the response above indicates that the RSSI value is '''-75 dBm''' (because that's what 19 represents since it falls in the 2..30 range) and the channel bit error rate is '''Not known or not detectable''' (because that's what 99 represents).
----
As another example, lets try to get network operator information. For this task you can use either '''gsmctl -o''' or '''AT+COPS?'''. For this example we'll use them both and analyze the differences:
 
[[File:Gsmctl COPS.png|border|center|class=tlt-border|439x120px]]
 
As you can see, ''gsmctl'' returns a more user-friendly value while ''AT+COPS?'' returns raw data. The response format of the ''AT+COPS?'' is '''+COPS: <mode>[,<format>[,<oper>][,<Act>]]'''. Explanations for individual values are provided below.
 
<oper>        Operator in format as per <mode>
 
<mode>
0              Automatic mode. <oper> field is ignored
1              Manual operator selection. <oper> field shall be present and <Act> optionally
2              Manually deregister from network
3              Set only <format> (for AT+COPS? Read Command), and do not attempt registration/deregistration (<oper> and <Act> fields are ignored).
                This value is invalid in the response of Read Command
4              Manual/automatic selection. <oper> field shall be presented. If manual selection fails, automatic mode (<mode>=0) is entered


  <ber>         Channel bit error rate (in percent)
  <format>
  0...7          As RXQUAL values in the table in 3GPP TS 45.008 subclause 8.2.4
  0             Long format alphanumeric <oper> which can be up to 16 characters long
99            Not known or not detectable
1              Short format alphanumeric <oper>
2             Numeric <oper>. GSM location area identification number


<Act>          Access technology selected.
                Values 3, 4, 5 and 6 occur only in the response of Read Command while MS is in data service state and is not intended for the AT+COPS Write Command.
0              GSM
2              UTRAN
3              GSM W/EGPRS
4              UTRAN W/HSDPA
5              UTRAN W/HSUPA
6              UTRAN W/HSDPA and HSUPA
7              E-UTRAN
100            CDMA


<rssi> 0
Instead of the operator's name, ''AT+COPS?'' returns operator's code, in this case, '''24602''', while gsmctl converts the code into the name of the operator (LT BITE GSM).
1
2...30
31
99
100
101
102...190
191
199
100~199
-113dBm or less
-111dBm
-109dBm... -53dBm
-51dBm or greater
Not known or not detectable
-116dBm or less
-115dBm
-114dBm...-26dBm
-25dBm or greater
Not known or not detectable
Extended to be used in TD-SCDMA indicating received signal code
power (RSCP)
<ber> Channel bit error rate (in percent)
0...7
As RXQUAL values in the table in 3GPP TS 45.008 subclause 8.2.4
99
Not known or not detectable


==External links==
==External links==


PuTTY download - '''https://www.putty.org/'''
PuTTY download - '''https://www.putty.org/'''
[[Category:Modem control]]

Latest revision as of 10:34, 1 August 2024

Main Page > General Information > Configuration Examples > Modem control > AT Commands

The information on this page is updated in accordance with the 00.07.08 firmware version .

Summary

AT commands ("AT" meaning 'attention') are instructions used to control a modem. The command set consists of a series of short text strings that can be combined to produce commands for operations such as dialing, managing SMS functions, and changing the parameters of the connection. Many of the commands that are used to control wired dial-up modems, such as ATD (Dial), ATA (Answer), ATH (Hook control), and ATO (Return to online data state), are also supported by GSM/GPRS modems and mobile phones. This section is an overview of some AT commands that can be used with RUT routers.

gsmctl commands

gsmctl is a set of shell commands that can request information from or perform operations on a modem. In other words, gsmctl is a way to use AT commands in shell form. You can use them via SSH or CLI, the command line interface that can be used via the router's WebUI.

SSH


To log in to a RUT router via SSH, download the free PuTTY app if you're using Windows; if you're using a Linux-based OS, just use the Terminal app. In both cases you will need to know three things: the router's LAN IP address, user name and password. The default LAN IP address for all RUT routers is 192.168.1.1; the default login information is username: root; password: admin01 (NOTE: the user name used for SSH connections (i.e., root) is not the same as the user name used to log in to the router's WebUI (i.e., admin)).

If you're using PuTTY, enter the router's LAN IP address into the Host Name (or IP address) field, select SSH Connection type and click Open. After this, you will be prompted to enter the username and password.

If you're using Linux, open a Terminal and type this command:

# ssh [email protected]

If you made changes to LAN IP address or log in name, replace the relevant data in the command above so that it is correct for your specific case. After executing this command you will prompted to enter the router's admin password.

Usage


The syntax for a gsmctl command is gsmctl OPTIONS. A list possible gsmctl options is provided below:

 -e, --bsent <INTERFACE>       Get number of bytes sent
 -r, --brecv <INTERFACE>       Get number of bytes recieved
 -j, --connstate               Get mobile connection state
 -P, --psstate                 Get package domain service state
 -g, --netstate                Get network link state
 -C, --cellid                  Get cell id parameter
 -o, --operator                Get name of operator used
 -f, --opernum                 Get operator number
 -t, --conntype                Get data carrier type
 -F  --network                 Get network information
 -K  --serving                 Get serving cell information
 -I  --neighbour               Get neighbour cell information
 -v, --volte_state             VoLTE state status
 -b, --band                    Print current band
 -q, --signal                  Get signal levels
 -G, --cainfo                  Get carrier aggregation bands are using right now

modem commands:

 -A, --at <cmd>                Execute AT command.
 -i, --imei                    Get device IMEI
 -a, --serial                  Get modem serial number
 -J, --iccid                   Get SIM ICCID
 -m, --model                   Get device model
 -w, --manuf                   Get device manufacturer
 -y, --firmware                Get device revision number
 -x, --imsi                    Get IMSI
 -z, --simstate                Get SIM card state
 -u, --pinstate                Get PIN state
 -H, --modemtime <1/2>         Get operator station time(1 - GMT, 2 - LOCAL)
 -c, --temp                    Get module temperature in 0.1 degrees Celcius
 -B, --pincount                Get pin/puk count
 -E, --info                    Get modem info in json format
 -U  --ussd <command>          The command allows control of the Unstructured Supplementary Service Data. (response saved in /tmp/ussd file)
 -Y  --switch                  Switch sim card for modem
 -T  --simslot                 Get current sim card slot for modem
 -Q, --reboot                  Reboot the modem

sms managing options:

 -S -r, --sms --read           <INDEX> Read SMS by index
 -S -R, --sms --pdu_read       <INDEX> Read PDU by index
 -S -l, --sms --list           <TYPE>  List SMS by type [all, read, new]
 -S -t, --sms --total          Print SMS memory usage
 -S -d, --sms --delete         <INDEX> Delete SMS by index
 -S -Z, --sms --pdu_delete     <INDEX> Delete PDU by index
 -S -s, --sms --send           "<NUMBER> <TEXT>"Send SMS. IMPORTANT! Number and text must be within quotes

auxilary options:

 -O, --modem <USB_ID>          Set MODEM by USB_ID(3-1, 1-1.4 etc.)
 -N, --num   <MODEM_NUM>       Set MODEM by modem number(0 - 12)
 -D, --debug                   Enable debug information

You can view this list via terminal by typing gsmctl -h or gsmctl --help.

For example, try using gsmctl -q to get the current signal levels value in dBm. You can also combine options. For example, gsmctl -oqt:

Unlike gsmctl -q, gsmctl -oqt returns three options: operator's name, signal levels, carrier, and operator type, as you can see in the example above.

AT command usage

To use a specific AT command via SSH, you can use the gsmctl -H. After this, your console will enter shell mode where you can then just type AT commands in their regular format. Or you can use gsmctl -A <AT_COMMAND> to execute AT commands one at a time. Continuing from the example above, let's say you want to find out the RSSI value. While there are quite a few commands that can be used to achieve this goal, lets use the AT+CSQ that is used when executing gsmctl -q:

As you can see this time the command returns two values instead of one, and they don't directly represent the RSSI value as with gsmctl -q. The reason for this is that AT+CSQ indicates the received signal strength <rssi> and the channel bit error rate <ber> and the numbers returned are not the direct values but rather the representation of the direct values.

<rssi>
0              -113dBm or less
1              -111dBm
2...30         -109dBm... -53dBm
31             -51dBm or greater
99              Not known or not detectable
100            -116dBm or less
101            -115dBm
102...190      -114dBm...-26dBm
191            -25dBm or greater
199             Not known or not detectable
100~199         Extended to be used in TD-SCDMA indicating received signal code power (RSCP)
<ber>           Channel bit error rate (in percent)
0...7           As RXQUAL values in the table in 3GPP TS 45.008 subclause 8.2.4
99              Not known or not detectable

So the response above indicates that the RSSI value is -75 dBm (because that's what 19 represents since it falls in the 2..30 range) and the channel bit error rate is Not known or not detectable (because that's what 99 represents).


As another example, lets try to get network operator information. For this task you can use either gsmctl -o or AT+COPS?. For this example we'll use them both and analyze the differences:

As you can see, gsmctl returns a more user-friendly value while AT+COPS? returns raw data. The response format of the AT+COPS? is +COPS: <mode>[,<format>[,<oper>][,<Act>]]. Explanations for individual values are provided below.

<oper>         Operator in format as per <mode>
<mode>
0              Automatic mode. <oper> field is ignored
1              Manual operator selection. <oper> field shall be present and <Act> optionally
2              Manually deregister from network
3              Set only <format> (for AT+COPS? Read Command), and do not attempt registration/deregistration (<oper> and <Act> fields are ignored).
               This value is invalid in the response of Read Command
4              Manual/automatic selection. <oper> field shall be presented. If manual selection fails, automatic mode (<mode>=0) is entered
<format>
0              Long format alphanumeric <oper> which can be up to 16 characters long
1              Short format alphanumeric <oper>
2              Numeric <oper>. GSM location area identification number
<Act>          Access technology selected.
               Values 3, 4, 5 and 6 occur only in the response of Read Command while MS is in data service state and is not intended for the AT+COPS Write Command.
0              GSM
2              UTRAN
3              GSM W/EGPRS
4              UTRAN W/HSDPA
5              UTRAN W/HSUPA
6              UTRAN W/HSDPA and HSUPA
7              E-UTRAN
100            CDMA

Instead of the operator's name, AT+COPS? returns operator's code, in this case, 24602, while gsmctl converts the code into the name of the operator (LT BITE GSM).

External links

PuTTY download - https://www.putty.org/