101 | | ==== AT Commands ==== |
102 | | |
103 | | AT Commands are supported on one of the /dev/ttyUSB lines. |
104 | | |
105 | | * [https://www.u-blox.com/sites/default/files/SARA-R4-SARA-N4_ATCommands_%28UBX-17003787%29.pdf u-blox SARA-R4/N4 series AT Commands Manual, Doc. No. UBX-17003787] |
106 | | |
107 | | Radio Access Technology (RAT): |
108 | | * R4 Series of Ublox Modems support NB-IoT and Cat-M1 and are enabled default. NB-IoT hasn't spread much in the USA so turning that off can speed up connections to CAT-M1 |
109 | | {{{ |
110 | | AT+URAT? # Query the radio access technology; 7 = Cat-M1, 8 = NB-Iot, 7&8 = both |
111 | | AT+URAT=7 # Cat-M1 only |
112 | | AT+URAT=8 # NB-IoT only |
113 | | AT+URAT=7&8 # both |
114 | | }}} |
115 | | |
116 | | Operator selection: |
117 | | {{{ |
118 | | AT+COPS? #is to check what network currently on |
119 | | AT+COPS=? #is to check what networks are available |
120 | | +COPS: (1,"311 480","311 480","311480",7),(2,"AT&T","AT&T","310410",7),(1,"313 100","313 100","313100",7),,(0,1,2,3,4),(0,1,2) |
121 | | AT+COPS=1,2,"310410" #sets to AT&T |
122 | | AT+COPS=1,2,"311480" #sets to verizon |
123 | | AT+COPS=0,0 #To go back to automatic carrier selection (which is typically recommended) |
124 | | }}} |
| 102 | ==== AT Commands |
| 103 | For a detailed list of all AT commands see: |
| 104 | * [https://www.u-blox.com/sites/default/files/SARA-R4-SARA-N4_ATCommands_%28UBX-17003787%29.pdf u-blox SARA-R4/N4 series AT Commands Manual, Doc. No. UBX-17003787] |
| 105 | |
| 106 | AT Commands are supported on the second /dev/ttyUSB lines. Because you can't guarantee the order Linux enumerates USB devices use the following to determine the AT tty: |
| 107 | {{{#!bash |
| 108 | DEVICE=/dev/$(for i in $(ls -d /sys/bus/usb/drivers/option/*/ttyUSB*); do basename $i; done | tail -n1) |
| 109 | }}} |
| 110 | |
| 111 | Note that you can not use AT commands while using PPP as this uses the same TTY. If using PPP you can kill pppd (ie 'ifdown wwan0'), perform AT commands closing the TTY when done, then re-start pppd (ie 'ifup wwan0'). It is highly recommended you use QMI as that uses a different interface leaving the AT TTY available for use if needed to do things that perhaps are not supported by QMI. |
| 112 | |
| 113 | |
| 114 | ===== Mobile Network Operator (MNO) Selection |
| 115 | Use the {{{AT+UMNOPROF}}} command to change profiles to a specific Mobile Network Operator (MNO): |
| 116 | * AT+UMNOPROF? - show current profile |
| 117 | * AT+UMNOPROF=? - list supported profiles |
| 118 | * AT+UMNOPROF=<n> - set profile to <n> |
| 119 | |
| 120 | Notes: |
| 121 | * **Do not modify individual parameters within the profile such as operator selection as that can break compatibility with your operator** |
| 122 | * you must de-register from the network before changing the MNO (AT+COPS=2) |
| 123 | * you must issue a reset after changing the MNO (AT+CFUN=15 issues a silent reset with a detach from the network and saving of NVM parameters) |
| 124 | * Setting the profile to the currently set profile does not reset the parameters. To reset the parameters, |
| 125 | set a different profile than the current one and then set the the profile back to the original (like 0). |
| 126 | |
| 127 | Examples: |
| 128 | * Set MNO to Verizon: |
| 129 | {{{#!bash |
| 130 | # obtain AT command TTY (the 2nd tty) |
| 131 | DEVICE=/dev/$(for i in $(ls -d /sys/bus/usb/drivers/option/*/ttyUSB*); do basename $i; done | tail -n1) |
| 132 | # configure TTY |
| 133 | stty -F $DEVICE ignbrk -brkint -icrnl -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke |
| 134 | # background process to read TTY responses |
| 135 | cat $DEVICE & |
| 136 | at "AT+COPS=2" # deregister from network |
| 137 | at "AT+UMNOPROF=0" # set MNO to auto |
| 138 | at "AT+UMNOPROF=3" # set MNO to Verizon |
| 139 | at "AT+CFUN=15" # de-register from network, save NVM, and reset modem |
| 140 | }}} |
| 141 | * Note that the {{{AT+CFUN=15}}} will cause the modem to disconnect and re-enumerate on the bus |