メニュー

Expand
ページを評価:

Cellular Module Knowledgebase

Twilio’s Cellular Connectivity for IoT service is compatible with a wide range of devices from a variety of manufacturers. To help developers who are running into difficulties, we’ve collected a number of common configuration requirements, errata, and solutions to common challenges for many of the modules we’ve worked with in our lab. The list of devices will grow as our we and our developers work with more modems.

The presence (or absence) of a module in the Knowledgebase does not necessarily indicate a device’s suitability (or unsuitability) for use on our networks, and is provided solely as an aid to help developers with their implementations.

Cellular modules we’ve tested

  • Nordic
    • nRF9160 (Cat-M1, NB-IoT)
  • Quectel
    • BG95-M3 (Cat-M1, NB-IoT, GSM)
    • BG96 (Cat-M1, NB-IoT, GSM)
    • EG21-G (Cat-1, GSM)
    • EG25-A, EG25-G (Cat-4)
    • EG91-NA (Cat-1)
  • Simcom
    • SIM7000G (Cat-M1, NB-IoT, GSM)
    • SIM7080G (Cat-M1, NB-IoT, GSM)
    • SIM7600A (Cat-4)
  • Telit
    • ME910C1 (Cat-M1, NB-IoT) NEW
  • U-Blox
    • LARA-R203 (NA)/LARA-R211 (EU) (Cat-1/2/3)
    • SARA-R410M (Cat-M1, NB-IoT)

General guidance

While some configuration is specific to each modem manufacturer and sometimes each model, certain concepts behind getting connected with Super SIM are common to all modems. This page covers these general factors, and so should be your first port of call for troubleshooting and application preparation purposes.

Although the commands listed below should have similar parameters, outputs, and behavior across modules and manufacturers, always the AT command documentation for your specific device(s) for specific parameter details and usage. You can find links to the listed modules’ AT command manuals on their own pages.

Access Point Name (APN)

The Super SIM APN is super.

The APN is set on most modules this way:

AT+CGDCONT=1,"IP","super"

The initial parameter is most commonly 1 but you may find some modules require it to be 0. With the APN set, you should be able to obtain an IP address from the network and to connect via PPP.

For more detailed guidance on setting the APN, particularly for devices with integrated modules, and for setting the APN using the Super SIM API’s SMS Commands functionality, please see our APN configuration page.

This APN is separate from the APN you may set on vendor-specific commands to utilize a modem’s built-in TCP, UDP, or application-specific protocols. This will vary by vendor and is described in subsequent documents for modules we have tested.

Radio Access Technology selection

When working with a cellular module that supports both Cat-M1 and NB-IoT, it is important to restrict the modem to scan only for Cat-M1 networks. Super SIM does not support NB-IoT and scanning for NB-IoT along with Cat-M1 can result in a failure to attach in some locations.

Working with Cat-M1 Devices

To get the best experience when using Super SIM with Cat-M1 modems, we suggest that you apply the following configuration settings on your device. They will make sure the Cat-M1 modem in your IoT device connects quickly and successfully. We’ve included examples showing you how to make these changes on popular Cat-M1 modems.

If your IoT device uses a regular LTE modem, the following changes do not apply.

Disable NB-IoT

Super SIM does not currently support Narrowband IoT (NB-IoT). If NB-IoT is enabled, a Cat-M1 device will scan all NB-IoT bands, which can take a considerable amount of time, before switching to Cat-M. To minimize the time to connect and avoid wasting power scanning NB-IoT bands, you should therefore disable NB-IoT.

Disable 2G (GSM)

Some modems support both Cat-M1 and 2G. If your modem supports 2G, we recommend that you disable it unless your IoT device can perform optimally on 2G, or Cat-M1 is not available where you will deploy your IoT device. There is a risk that if the initial connection is made over a cellular network (VPLMN) that does not support Cat-M1, your device will instead connect using 2G. It may then stay attached to the 2G network and may therefore be unable to receive over-the-air (OTA) updates from our platform. If 2G is disabled, then the device will only connect over a Cat-M1 network.

For Cat-M1 devices that don’t support 2G, this is not an issue.

We are actively exploring improvements to our mobile core to deliver OTA updates over 2G.

Known issue

Even with 2G disabled, there are some instances where a Cat-M1 device with Super SIM can take up to five minutes to connect. This can occur when the first IMSI presented by the SIM to the modem doesn’t permit it to connect to a Cat-M1 capable network in a specific region. After five minutes of no service, the SIM will switch to another IMSI and the device should then be able to connect over Cat-M1.

There is an OTA campaign in process to update the preferred IMSIs for countries like the US and Australia. Once your SIM gets the OTA update, this issue will be fixed and the SIM will not take the extra time to connect on reboots.

To learn more about Super SIM IMSI switching, please see Super SIM: the Multi-IMSI Applet.

Unsolicited Response Codes

Many modems use Unsolicited Response Codes (URCs) to communicate events and status changes to your application. These strings may not arrive on a serial line (UART, or Universal Asynchronous Receiver-Transmitter) your application is monitoring so check your modem’s documentation to learn how it will send URCs to your device and to find out how to change this if you need to. For those modems for which we have provided additional information, we will call out how to configure this feature.

Many commands which subscribe to URCs are scoped to the current session and will need to be sent again when the modem is next powered up or rebooted.

Network registration status

To obtain the current network registration status, and to receive real-time connection state updates, there are three commands available to you. These are part of the 3GPP standard and so are available on all modems:

  • AT+CREG indicates the status of the circuit-switched (CS) network connection, generally 2G or 3G .
  • AT+CGREG indicates the status of the packet-switched network connection, generally 2G. This will usually occur after CS registration.
  • AT+CEREG indicates the status of the Evolved Packet System (EPS) network connection, generally 3G or LTE (4G and 5G).

These commands have several uses:

  • You can explicitly query the modem’s current status with respect to each connection type: AT+CREG?, AT+CGREG?, AT+CEREG?.
  • You can request URC notices for each: AT+CREG=x, AT+CGREG=x, AT+CREG=x.

Network registration URCs

The recommended way for your application to remain aware of the connectivity status is to register for notifications for all of the registration modes your hardware is capable of achieving. If your module is an LTE-only device, you do not need to check for CS or PS registrations, only EPS registrations. But if your module supports 2G, 3G and 4G, you need to check for CS, PS, and EPS registration notification.

You may only see one of the modes — CS, PS or EPS — report a successful registration, but only a single type is required to commence normal operations.

To subscribe to updates on registration status changes, issue one of the following. Use AT command chaining to include all three modes with one command:

  • AT+CREG=1;+CGREG=1;+CEREG=1 to provide only registration status.
  • AT+CREG=2;+CGREG=2;+CEREG=2 to provide registration status, location information, and RAT.

Issue AT+CREG=0;+CGREG=0;+CEREG=0 to turn off receipt of network registration URCs.

A common issue that is being seen more frequently as 2G and 3G networks are turned off is that a modem will see EPS registration, but not CS or PS. As older modems only ever supported CS, so many device-side modem drivers often only check CS registration status and so stop working when CS registration checks fail — even though the modem can communicate using LTE.

For this reason, it is critically important to check all three registrations, and initiate communications when any registration is reported.

Once you have subscribed network registration URCs, the modem will issue notifications of the form:

+CREG=2,<registration_state>[,<additional_information>]

and/or

+CGREG=2,<registration_state>[,<additional_information>]

and/or

+CEREG=2,<registration_state>[,<additional_information>]

The initial 2 indicates the configured URC state.

The device needs to initiate data communication when <registration_state> is either 1 (registered on the home network) or 5 (registered on a roaming network). If none of the +CREG/+CGREG/+CEREG URCs indicate 1 or 5, then the modem is not connected to a network.

Typically you will see state 2 (searching), and then 5 upon connect. Sometimes you may see state 3 (rejected) briefly, followed by a return to state 2.

<additional_information> can include the cell ID and RAT in use. Consult your modem’s manual for more information.

Here’s an example:

+CREG: 2,5,"0123","456789A",2

This indicates:

  • The inclusion of location and RAT in the response (2).
  • The device is registered as roaming (5).
  • The LAC (Location Area Code) ("0123") and CI (Cell Identity) ("456789A") of the tower the device is connected to.
    • The location information provides a coarse device location and should be treated sensitively.
  • The RAT in use is UTRAN/GSM (2).

Registration URCs will come in for a variety of reasons:

  • When the modem is rejected from the network (no connection).
  • When the modem is registered to the network (no connection yet, but one may be possible).
  • When the modem moves between cells without an interruption in registration (connection may be active but is not interrupted).

As a result of the last item, when the modem moves between cells, you may see numerous +CREG/+CGREG/+CEREG indications over the course of a connection without your data session being affected.

Data-centric devices

Many cellular modules can be set to attach as data-centric devices rather than voice-centric units. However, many modules will default to voice-centric unless they are explicitly configured to attach as data-centric devices.

Which of these attachment modes a modem selects is an especially important consideration in the context of the end of 2G and 3G services. Some cellular carriers deliver circuit-switched (CS) voice via 3G so will lose support for CS voice when their 3G networks are shut down. Devices that appear to the network as voice-centric may not then be able to connect via those carriers, even if they support LTE connectivity.

The solution is to configure the module to attach as a data-centric device.

Please consult your module’s manufacturer for details of supported attachment modes and how they can be selected. Your modem may require a firmware update to enable this functionality. You should also check whether such settings are persisted or must be re-applied every time the device is power-cycled.

Operator information

To check current operator status, use AT+COPS?.

This will return the current operator selection mode as well as your current operator, if any. For example:

+COPS: 0,2,"310260",2

Looking at the returned values from left to right, this result indicates automatic selection (0) of the current operator (2), which is T-Mobile ("310260"), connected over 3G (2).

List available operators

To list all of the operators visible to the module, issue AT+COPS=?.

Avoid running AT+COPS=? while the modem is attempting to connect to the network. The command will interrupt the modem’s normal scanning process and can delay connection to the network — it may take seconds or even minutes to complete. The modem will cycle through all supported radio access technologies to get all available networks.

Developers often use this command in conjunction with scanning for and manually selecting a network — this is not recommended for Twilio Super SIM.

In the output of AT+COPS=?, you will receive a list of operators the modem sees. For example:

+COPS: (3,"AT&T","AT&T","310410",2),(2,"T-Mobile","T-Mobile","310260",2),,(0-5),(0-2)

The values returned by this command, and by AT+COPS?, will vary by your modem and the Radio Access Technologies (RATs) it supports. For the example above, we can see that:

  • The modem was forbidden access (3) to AT&T.
  • The modem is currently connected (2) to T-Mobile on 3G (the last 2 in the section).

Operator selection

If you have used single-IMSI or fixed-provider SIMs in the past, you may be accustomed to selecting the operator by numeric or alphanumeric identifier. This is not generally recommended for Super SIM.

Super SIMs contain multiple IMSI from different network partners to give you access to the widest catalog of cellular networks. Each IMSI may have access to different networks in a country. We recommend that you enable as many networks as possible on your Fleet’s Network Access Profiles and leave your device set to automatic operator selection so that it will try multiple networks if it cannot connect on the first.

You can learn more about Super SIM’s multi-IMSI approach in this doc.

Manually selecting an operator obtaining a list of visible/available operators with AT+COPS, or by manually de-registering from the network with AT+COPS=2, can adversely affect connection times and even the ability to connect until the parameter is reverted. We therefore recommend always utilizing automatic operator selection using AT+COPS=0.

Override operator selection

You use Network Access Profiles to include or exclude specific networks you would like your device to favor or avoid. This is the recommended method you should use to steer devices to a particular network. If you must force the modem to connect to a specific network, typically for testing purposes only, you can manually select an operator using AT+COPS=. For example:

AT+COPS=4,2,"310410"

Here we provide a desired network (AT&T, 310410) for the next connection attempt only, falling back to automatic network selection if it fails. If you prefer the device to remain disconnected if the connection attempt fails, replace the initial 4 with 1.

Modem resets

If you need to reset the modem or disconnect for power reasons, we recommend using AT+CFUN instead of AT+COPS. AT+COPS=2, which is a way to de-register from the network, tells the software running on Super SIM that the connected network was not suitable for the user. Super SIM will then have to exhaust all other possible networks, potentially with all available IMSI partners, until it loops back around to the functioning network again.

To terminate the connection to the network temporarily, use AT+CFUN=0.

To take the modem offline then bring it back, use AT+CFUN=1. This applies the last known good network, for a quicker reconnection.

Application-driven modem/connectivity resets

Developers who have moved to Twilio from another wireless connectivity provider often reset the modem and apply a short timer (e.g., five minutes or less) to get back online. This can be effective for single-IMSI SIMs, which scan for a very specific network when the modem is back up, but can be detrimental to Super SIM’s ability to connect. Each Super SIM contains software which is also trying to pivot and reset the SIM’s connectivity while it is trying to reconnect. If your application is resetting the modem more frequently than the built-in timer is pivoting to other connectivity options, the Super SIM may never have time to switch networks. This can also negatively impact the Super SIM’s ability to receive important connectivity updates from Twilio.

We recommend that any application-based timer have a cycle of no less than 30 minutes to ensure that the Super SIM has time to connect if it is needed. In certain outage scenarios it may take a significant amount of time to iterate through all alternate connectivity options provided by Super SIM.

All modems, in any operational mode, will attempt to connect at all times and so either at power up or upon registration loss, the application should wait for registration and resist the temptation to “speed things up” by sending additional commands to the modem. These commands will almost always slow things down.

Modem and SIM information

A number of standard informational commands exist that may be useful to your application or when troubleshooting connectivity. Some of the most common commands are listed below. More information on these and other manufacturer-specific commands can be found either in our manufacturer and modem specific documentation or the AT command guides for your specific modem.

  • Retrieve the modem’s International Mobile Equipment Identity (IMEI): AT+CGSN.
  • Retrieve the SIM card’s Integrated Circuit Card ID (ICCID): AT+CCID.
  • Retrieve the SIM card’s ‘current’ International Mobile Subscriber Identity (IMSI): AT+CIMI.
    • Note ‘Current’ relates to Super SIM, since the Super SIM has multiple IMSIs assigned. Programmable Wireless SIMs have a single static IMSI.
  • Retrieve the modem’s manufacturer: AT+CGMI.
  • Retrieve the modem’s model: AT+CGMM.
  • Retrieve the modem’s revision: AT+CGMR.

While these commands are generally standard on cellular modems, the output and contents may vary between manufacturers.

Differentiating between Twilio SIMs

This is discussed separately, on this page.

Module-specific details

For information on features and process specific to each of the modules we have tested, please see the following pages, separated by module manufacturer and Twilio SIM type.

ページを評価:

ヘルプが必要ですか?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Community Forums or browsing the Twilio tag on Stack Overflow.

フィードバックくださりありがとうございます!

We are always striving to improve our documentation quality, and your feedback is valuable to us. Please select the reason(s) for your feedback or provide additional information about how we can improve:

Sending your feedback...
🎉 Thank you for your feedback!
Something went wrong. Please try again.

Thanks for your feedback!

Refer us and get $10 in 3 simple steps!

ステップ1

Get link

Get a free personal referral link here

ステップ2:

Give $10

Your user signs up and upgrade using link

ステップ3

Get $10

1,250 free SMSes
OR 1,000 free voice mins
OR 12,000 chats
OR more