Changes

567 bytes added ,  15:55, 24 March 2023
no edit summary
Line 1: Line 1: −
'''AT commands''' ("AT" meaning 'attention') are instructions used to control a modem.
+
 
 
__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 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.
    
==gsmctl commands==
 
==gsmctl commands==
Line 23: Line 23:  
===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
+
   ---network                Get network information
   -y, --revision                  Get device revision number
+
   ---serving                Get serving cell information
   -x, --imsi Get IMSI
+
   ---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
+
'''modem commands:'''
   -E, --ecio                      Get WCDMA ec/io level
+
  -A, --at <cmd>                Execute AT command.
   -W, --rsrp          Get LTE rsrp level
+
  -i, --imei                    Get device IMEI
   -Z, --sinr  Get LTE sinr level
+
   -a, --serial                  Get modem serial number
   -M, --rsrq Get LTE rsrq level
+
   -J, --iccid                  Get SIM ICCID
   -C, --cellid         Get cell id parameter
+
   -m, --model                  Get device model
   -o, --operator                  Get name of operator used
+
   -w, --manuf                  Get device manufacturer
   -f, --opernum  Get operator number
+
   -y, --firmware                Get device revision number
   -t, --conntype                  Get data carrier type
+
   -x, --imsi                    Get IMSI
   -c, --temp Get module temperature in 0.1 degrees Celcius
+
   -z, --simstate                Get SIM card state
   -B, --pincount                 Get pin/puk count
+
   -u, --pinstate                Get PIN state
   ---network         Get network information
+
   -H, --modemtime <1/2>        Get operator station time(1 - GMT, 2 - LOCAL)
   -K --serving         Get serving cell information
+
   -c, --temp                   Get module temperature in 0.1 degrees Celcius
   -I --neighbour Get neighbour cell information
+
   -B, --pincount               Get pin/puk count
   -D, --shutdown                 Shutdown the modem
+
   -E, --info                    Get modem info in json format
   -h, --help Prints this information
+
   -U --ussd <command>          The command allows control of the Unstructured Supplementary Service Data. (response saved in /tmp/ussd file)
  -v, --version  Print version
+
   -Y --switch                  Switch sim card for modem
 
+
   -Q, --reboot                 Reboot the modem
sms managing options:
+
'''sms managing options:'''
   -S -r, --sms --read       <INDEX>           Read SMS by index
+
   -S -r, --sms --read          <INDEX> Read SMS by index
   -S -l, --sms --list       <TYPE>             List SMS by type [all, read, new]
+
   -S -R, --sms --pdu_read       <INDEX> Read PDU by index
   -S -t, --sms --total                         Print SMS memory usage
+
   -S -l, --sms --list           <TYPE> List SMS by type [all, read, new]
   -S -d, --sms --delete    <INDEX>           Delete SMS by index
+
   -S -t, --sms --total         Print SMS memory usage
   -S -s, --sms --send     "<NUMBER> <TEXT>"   Send SMS. IMPORTANT! Number and text must be within quotes
+
   -S -d, --sms --delete         <INDEX> Delete SMS by index
   -S -b, --sms --send-b64  <NUMBER>          Send SMS encoded in base64 from /tmp/.smstext
+
  -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
auxiliary options:
+
'''auxilary options:'''
   -A, --at <COMMAND> Send AT command to device
+
   -O, --modem <USB_ID>          Set MODEM by USB_ID(3-1, 1-1.4 etc.)
  -H, --shell Enter shell mode
+
   -N, --num  <MODEM_NUM>       Set MODEM by modem number(0 - 12)
   -k, --debug Enable debug information
+
   -D, --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''.
+
You can view this list via terminal by typing '''gsmctl -h''' or '''gsmctl --help'''.
   −
For example, try using ''gsmctl -q'' to get the current RSSI value in dBm. You can also combine options. For example, ''gsmctl -oqt'':
+
For example, try using ''gsmctl -q'' to get the current signal levels value in dBm. You can also combine options. For example, ''gsmctl -oqt'':
   −
[[File:Gsmctl usage.png]]
+
[[File:Gsmctl q.png|border|center|class=tlt-border|457x228px]]
   −
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.
+
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==
 
==AT command usage==
Line 84: Line 83:  
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, 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'':
   −
[[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 109: Line 108:  
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 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:At cops.png]]
+
[[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.
 
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.