Thales Cinterion ENS22-E

Learn how to setup and integrate the Cinterion ENS22-E DevKit from Thales with IoT Creators NB-IoT network and Data Provisioning Service (SCS)

Introduction


To help developers to start with the NB-IoT module "Thales Cinterion ENS22-E" (NB-IoT module for Europe; Cat NB1; Band 8, 20 -other bands suitable for APAC region are supported as well-) you can use the LGA ENS22 DevKit (developer kit) from the Thales Group.

671

Thales Cinterion ENS22-E LGADevKit

Links

728

https://eshop.sectron.eu/en/nb-iot-development-kit/p-15210/

Links to the AT command samples:

Setup the Device


In the following I will describe you how to setup your devkit so that you are able to send AT commands directly from your computer to the Cinterion module from Thales. To do so you need to

  1. connect your your devkit with your computer via USB
  2. press the power button
  3. execute AT commands on your devkit the first time.

Connect your devkit with your computer

Your ENS22 DevKit will be connected with your compute by using micro USB and can be accessed with a terminal program such as "putty" on Windows or "screen" or "minicom" on Linux.

In case you are working with Linux you are lucky. The USB/Serial drivers should be already available on your system and you don't need to install anything else.
In case you are using a Windows compute the driver will be automatically installed. If you have any trouble please download a FTDI VCP driver.
After you connected your ENS22 DevKitvia USB with your computer you should find the device file
/dev/ttyACM0 (or /dev/ttyUSB0). It is automatically created when you connect your ENS22 DevKitwith your computer and if you disconnects it your ENS22 DevKitdisappears again.

Unfortunately I can not tell you how to enable the serial terminal connection via USB on Windows or Mac because I am only working with Linux. Sorry :disappointed_relieved:.

Execute AT commands on your ENS22 DevKitthe first time.

To execute AT commands on your ENS22 DevKityou need start on your computer a terminal program such as putty on Windows or minicom or screen on Linux and connect it with your ENS22 DevKitvia the serial USB line. After this you can send AT commands to the modem of your ENS22 DevKit.

In the following I will explain to you how to do this stuff on Linux by using the minicom and to send those AT commands to the modem to query device product and IMEI information.

Connect your ENS22 DevKitwith your Linux computer via terminal program minicom

In case minicom is not already installed on your computer you can install it with

$ sudo apt-get install minicom

After that you can configure minicom by executing

$ sudo minicom -s

478

Main configuration menu of minicom.

🚧

It is important that you run the configuration of minicom as root because the resulting configuration file will be stored in the directory /etc/minicom to which root has only write permissions.

In the minicom configuration menu change the following settings:

  • Enter Serial port setup
    • Set Serial Device to /dev/ttyACM0
  • Enter Screen and keyboard
    • Set Local echo to Yes
  • Enter Save setup as
    • Give ens22e as the name to save the configuration
  • Enter Exit from Minicom

After configuring minicom for your Thales ENS22 DevKit you can start minicom with the configuration _ens22e'_ which just created before.

$ minicom ens22e

📘

In case you have any problems to access the device file /dev/ttyACM0 because you don't have enough access privilages for this file execute the following command

$ sudo usermod -a -G dialout YOUR-USER-NAME

As very first AT command you should input the command AT. This command shall always return OK. If not, there is something wrong.

AATT

OK

Afterwards you can deactivate your device echo with **ATE0**.

AATTEE00

OK

👍

Congratulations

If you reached this point you equipt your Thales Cinterion ENS22-E with the capabiltiy to pass your AT commands from the serial USB terminal interface directly through to the modem.

Now the fun begins! :smiley: :smiley:

AT Commands to get IMEI, IMSI and other product information from your ENS22 DevKit

In the following various AT commands are shown to query the IMEI and other product information from your ENS22 DevKit.

# Request IMEI
AT+CGSN=1
                                                                                
+CGSN: 357518080495450

OK

# Request IMSI of the SIM card
AT+CIMI

901405700009293

OK

# Request SIM card identification number
AT+CCID

+CCID: 89882280000001294327
                                                                                
OK                                    
# Request manufacturer identification
AT+CGMI

Cinterion

OK

# Rquest model identification 
AT+CGMM

ENS22-E

OK

# Request firmware version identification  
AT+CGMR

REVISION 02.000

OK

# Request prodct type number
ATI

Cinterion
ENS22-E
REVISION 02.000

OK

Attach to the NB-IoT Network


This chapter explains how you can attach your Thales Cinterion ENS22 DevKit to the NB-IoT network. I recommend to read the chapter "Setup Thales Cinterion ENS22-E" first.

🚧

If you are only interested in the conclusion of the AT commands to configure the network setup go to chapter "'AT Commands Only"

❗️

Before you send any UDP or COAP message to IoT Creators make sure you registered the device IMEI before.

If you forget, you will have problems to register your device afterwards. In this case please get in contact with IoT Creators support team.

A few assumptions and notes before starting with this manual

  • You should be able to send AT commands to your ENS22 DevKit with a terminal program such as putty, screen, minicom, etc.
  • Your device is on the latest firmware
  • Be gentle to your device and have some patience. After each AT command he/she/it needs a few seconds to execute the command and respond

In the following we will walk through together the AT commands with which you can perform the following actions:

  • Setup network configuration of you ENS22 DevKit.
  • Attach to the network and verify your network configuration.
  • Ping an IP address.

Setup Network Configuration

After switching on your ENS22 DevKit deactivate the radio functionality with +CFUN. You should do this to make sure no miss-configured automatic dial-in action make your setup difficult.

AT+CFUN=0

❗️

Roaming via Vodafone in UK

In case of romaing via Vodafone in UK you probably need to use AT+NCONFIG="CR_0859_SI_AVOID","FALSE".

Set the APN of IoT Creators with +CGDCONT to the correct one.

🚧

Choosing the correct APN for your sim card

The command below represent an example, different sim cards can have different APNs, for the correct APN check this doc page here: https://docs.iotcreators.com/docs/general-settings

AT+CGDCONT=0,"IP","cdp.iot.t-mobile.nl"

📘

In case you have the IoTcreators NB-IoT Development Kit from Sectron, set the APN of IoT Creators with +CGDCONT to scs.telekom.tma.iot

AT+CGDCONT=0,"IP","scs.telekom.tma.iot"

Sometimes you get an ERROR response of the +CGDCONT command. Reason for this can be that the radio is not deactivated with +CFUN=0 and the modem already attached to the network. In this case just deactivat the radio and try it again.

Set the EPS network registration status with +CEREG command.

AT+CEREG=5

Select the network operator of your choice with +COPS command manually (1) by given the numeric identification (2) of the operator ("26201", "20416", "26002", etc.) Check in Roaming Network Info for your local roaming partner and use MCC/MNC combination to attach

AT+COPS=1,2,"26201"
AT+COPS=1,2,"20416"
AT+COPS=1,2,"26002"

👍

:+1: Great! Your setup of network configuration is complete now.

The next step is it to test if it is correct and if your ENS22 DevKit is able to attach the network with it.

Good Luck :smirk:

The setup of the network configuration is complete. Because we deactivated the radio in the
beginning with +CFUN=0 nothing should happen so far.
To see your configuration in action you can trigger a reboot of your ENS22 DevKit with the +NRB command.

AT+NRB

After you triggered the reboot with ```+NRB you should see the following on your terminal and your ENS22 DevKit should attach to the network automatically.


^SYSSTART


+CIEV: suspendAvailable,1

+CIEV: suspendReady,1

As next we will verify if your ENS22 DevKitis actually attached to the network and verify the network configuration with some more AT commands.

Attach to the Network and verify your Network Configuration

After you have rebooted your ENS22 DevKit the most interesting question is if your ENS22 DevKit got an IP address assigned by the network.
You can query the assigned IP address from your ENS22 DevKit with the +CGPADDR command.

AT+CGPADDR

+CGPADDR: 0,"10.128.1.157"
OK

As the result your ENS22 DevKit returns the current IP address. In this sample it is 10.128.1.157

📘

:angry: What to do if it doesn't work :imp:

If you are not able to get established a network attachment double check the following

  • Did you configure the correct APN?
  • Did you configure the correct mobile network operator in your country?
  • Did you make sure your SIM card has active roaming in case you are not in the home country of your network operator?
  • Did you connect the antenna?

AT Commands to query Network Information

In the following I show you some more AT commands with which you can query other information regarding mobile connection status.

# Query if the ENS22 DevKit is attached to the network
AT+CGATT?
+CGATT: 1
OK

# Query the configured MNO (Mobile Network Operator)
AT+COPS?
+COPS: 0,2,"26201"
OK

# Query the configured APN
AT+CGDCONT?
+CGDCONT: 0,"IP","cdp.iot.t-mobile.nl",,0,0,,,,,0
OK

# Query the configuration
AT+NCONFIG?
+NCONFIG:AUTOCONNECT,TRUE
+NCONFIG:CR_0354_0338_SCRAMBLING,TRUE
+NCONFIG:CR_0859_SI_AVOID,TRUE
+NCONFIG:COMBINE_ATTACH,FALSE
+NCONFIG:CELL_RESELECTION,TRUE
+NCONFIG:ENABLE_BIP,FALSE
+NCONFIG:MULTITONE,TRUE
+NCONFIG:NAS_SIM_POWER_SAVING_ENABLE,TRUE
+NCONFIG:BARRING_RELEASE_DELAY,64
+NCONFIG:RELEASE_VERSION,13
+NCONFIG:RPM,FALSE
+NCONFIG:SYNC_TIME_PERIOD,0
+NCONFIG:IPV6_GET_PREFIX_TIME,65535
+NCONFIG:NB_CATEGORY,2
+NCONFIG:RAI,FALSE
+NCONFIG:HEAD_COMPRESS,FALSE
+NCONFIG:RLF_UPDATE,TRUE
+NCONFIG:CONNECTION_REESTABLISHMENT,FALSE
+NCONFIG:TWO_HARQ,FALSE
+NCONFIG:PCO_IE_TYPE,EPCO
+NCONFIG:T3324_T3412_EXT_CHANGE_REPORT,FALSE
+NCONFIG:NON_IP_NO_SMS_ENABLE,FALSE
+NCONFIG:SUPPORT_SMS,TRUE

OK

# Query signal power and quality
# Power should be between 0-31 and NOT 99. 99 means "no network detactable"
# Quality should be between 0-9. 99 means not know or not detactable.
AT+CESQ
+CSQ: 9,99
OK

Ping the first IP address

With the AT+CGPADDR command you could query the current IP address of your ENS22 DevKit. But you still not know if your ENS22 DevKit is able communicate in the IP network correctly.
To test this you should ping the UDP server of IoT Creators platform with th +NPING command.

📘

PING Service

Check the correct ping address here: IoT Configuration Parameter

AT+NPING="172.27.131.100"

OK

+NPING: "172.27.131.100",253,7478

👍

:+1: Congratulations :+1:

If you reached this point and if you were able to ping successfully the IoT Creators' UDP server you reached a very important milestone.

Experience has shown that most of the problems arise during the ENS22 DevKitcommissioning and the first attachment with the network.

The rest journey the next steps of the tutorial will be easy :smirk:

AT Commands Only

#######################################################################
# Network attach
#######################################################################
# Switch off radio
AT+CFUN=0

# Switch autoconnect and scrambling on:
AT+NCONFIG="AUTOCONNECT","TRUE"
AT+NCONFIG="CR_0354_0338_SCRAMBLING","TRUE"
AT+NCONFIG="CR_0859_SI_AVOID","TRUE"

# Set the APN
AT+CGDCONT=0,"IP","cdp.iot.t-mobile.nl"

# EPS network registration status
AT+CEREG=5

# select an operator DE:"26201", NL:"20416"
AT+COPS=1,2,"26201"

# Reboot the device
AT+NRB

#######################################################################
# Network attach verification
#######################################################################
# Check IP address
AT+CGPADDR

# Check if attached to network
AT+CGATT?

# Check MNO
AT+COPS?

# Check APN
AT+CGDCONT?

# Check the configuration
AT+NCONFIG?

# Check signal strength and qualitay
AT+CESQ

# Extended error report
AT+CEER

#######################################################################
# Ping UDP server of IoT Creators
#######################################################################
AT+NPING="172.27.131.100"

Send and Receive via UDP


In the following chapters I will explain to you how you can send a "Hello World" message from the device to the IoT Creators SCS and how you can receive a "Hello Device" message on your devkit from IoT Creators SCS.

Send "Hello World"

❗️

Register your device first!

Make sure that you have registered your device with its IMEI at the IoT Creators portal BEFORE you send your first message to the UDP or CoAP server of IoT Creators.

If you forget, you will have problems to register your device afterwards. In this case please get in contact with IoT Creators support team.

Welcome to this step of tutorial. You probably ended up here because you could successfully connect your ENS22 DevKit to the network.
Before you continue make sure your device has an IP address assigned and you can ping the UDP server of IoT Creators. You test both with the +CGPADDR and the +NPING command.

📘

PING Service

Check the correct ping address here: IoT Configuration Parameter

AT+CGPADDR
+CGPADDR: 0,"10.128.4.109"
OK

AT+NPING="172.27.131.100"
OK
+NPING: "172.27.131.100",253,2396

In the next steps you will

  • Open local UDP socket to send UDP messages.
  • Create a "Hello World" message.
  • Send the hex coded "Hello World" message to the UDP server of IoT Creators.
  • Verify if the messages has been arrived at the IoT Creators platform.

Open local UDP Socket to send message

To send UDP messages to a UDP server you need to confiure a local UDP socket.

AT^SICS=0,"conType","GPRS0"
OK
AT^SICS=0,"apn","cdp.iot.t-mobile.nl"
OK
AT^SISS=0,"srvType","Socket"
OK
AT^SISS=0,"conId","0"
OK
AT^SISS=0,"address","sockudp://172.27.131.100:15683"
OK

You can save the settings and simply relaod them the next time with ^SIPS

AT^SIPS=all,save,0
OK

AT^SIPS=all,load,0
OK

Now you can open the Socket an ask for an IP.

AT^SISO=0
OK

AT^SISI?
^SICI: 0,2,1,"10.128.3.195"
OK

If you could open the socket successfully, you can send String messages to the server with ^SISW=0,11 (11 bit).

AT^SISW=0,11
Hello World

Afterwards you can close the Socket with ^SISC=0

AT^SISC=0

OK

👍

CONGRATULATIONS :clap: :cake:

If you see OK on the device console CONGRATULATIONS! you just send your first UDP message from your device to an UDP server of IoT Creators.

View the received Messages in IoT Creators Portal

For each device the IoT Creators Portal makes the laste received message available by showing it in the Payload column. In case of our Hello World message

888

Project view of IoT Creators portal with device and last sent data.

If you click on the payload the value of it is copied to the clipboard.

247

Click on payload to copy into clipboard.

We see in the IoT Creators Portal the string 48656c6c6f20576f726c64.

To decode the received message back from hex to a readable string we can use the online tool http://string-functions.com/hex-string.aspx.

757

Online tool to convert hex to string.

👍

:clap: CONGRATULATIONS :clap: :cake:

If you can decode your received message to Hello World **CONGRATULATIONS**! You just sent your first UDP message from your device via NB-IoT to IoT Creators platform.

AT Commands to send Hello World

# Configure UDP socket
AT^SICS=0,"conType","GPRS0"
AT^SICS=0,"apn","cdp.iot.t-mobile.nl"

AT^SISS=0,"srvType","Socket"
AT^SISS=0,"conId","0"
AT^SISS=0,"address","sockudp://172.27.131.100:15683"

# Open local UDP socket
AT^SISO=0

# Send 11 bit UDP message to UDP server
AT^SISW=0,11
Hello World

# Close socket
AT^SISO=0
OK

Receive "Hello Device"

Welcome back to the tutorial :+1:.
In this step I will explain you how you can receive the "Hello Device" downlink message 48656c6c6f20446576696365 via UDP which you have posted before to the IoT Creators platform.

The downlink message which you posted to IoT Creators API before is queued by the IoT Creators platform. The queued downlink message is sent to the device after IoT Creators platform received the uplink message from the device.

In this tutorial you will perform the following steps:

  • Open local UDP socket.
  • Send a "i am alive" heartbeat message via UDP to the UDP server of IoT Creators.
  • Receive the previous queued "Hello Device" message from the IoT Creators platform.

Open local UDP socket and send "i am alive" heartbeat

As already described in chapter 4 of this tutorial you can open the UDP socket and send a UDP message with ^SISO=0 and SISW=0

Before you open the UDP socket you can verify your IP address and if you are able to heartbeat the UDP server of IoT Creators.

AT+CGPADDR
+CGPADDR: 0,"10.128.5.88"
OK

AT+NPING="172.27.131.100"
OK
+NPING: "172.27.131.100",253,4141

Send "i am alive" heartbeat message and receive downlink message

After you verified the network attach of your device you can open the UDP socket on your device and send a "i am alive" heartbeat message to the UDP server of IoT Creators. As already explained in chapter 4 the message should be in hex format.

AT^SISO=0

AT^SISW=0,10
i am alive

OK

The "i am alive" message causes the UDP server of the IoT Creator portal to send out the previous queued "Hallo Device" message to the device.
The device notifiers you with an URC (Unsolicited Result Code) code as soon data has been been received by the modem of the device.

AT^SISR=0,12

^SISR=0, 12, 0
Hello Device
OK

🚧

Downlink only possible after uplink

If you try to send a downlink message to a device that has not send any uplink messages you will receive the error : Serial number not found.
After sending an uplink message the device registration is completed and downlinking will work.

AT Commands to receive Hello Device

#  Test if device has an IP address asigned
AT+CGPADDR 
+CGPADDR: 0,"10.0.5.112"
OK

# Ping UDP server of IoT Creators
AT+NPING="172.27.131.100" 
OK
+NPING: "172.27.131.100",253,4135

# Open local UDP socket 
AT^SISO=0
OK

# Send "i am alive" message to UDP server
AT^SISW=0,10 
i am alive
OK

# Receive the data
AT^SISR=0,12
^SISR=0, 12, 0
Hello Device
OK

Low power features

Check this guide for the BC66 low power features:

👍

ENS22 low power features

https://docs.iotcreators.com/docs/low-power-features#thales-cinterion-ens-22e

Other useful functions

Retrieve time from the network

You can retrieve the local time from the network (not all mobile networks support this command) by issuing:

AT+CCLK?

+CCLK: 2023/02/06,13:17:08GMT+1