Good afternoon and good mood!
This is a small tutorial on setting up NIDD (Non-IP Data Delivery) in the MTS cloud service with the self-explanatory name "M2M Manager". The essence of NIDD is the energy-efficient exchange of small data packets over the NB-IoT network between devices and the server. If earlier GSM devices communicated with the server by exchanging TCP / UDP packets, then an additional communication method became available for NB-IoT devices - NIDD. In this case, the server interacts with the operator's network using unified POST/GET requests. I am writing for myself (so as not to forget) and for everyone who finds it useful.
You can read about NB-IoT:
Documentation for the NB-IoT module that was used in the testing process:
To feel NIDD, we need:
- SIM card NB-IoT MTS
- NIDD-enabled NB-IoT device
- password and login from M2M-manager MTS
As a device, I used a board N21 DEMO, and the password and login for access to the M2M manager were kindly provided to me by MTS employees. For this, as well as for the various help and numerous consultations, many thanks to them.
So, go to the M2M manager and check that:
- in the menu item "SIM Manager" there is "NB-IoT Control Center";
- our NB-IoT card appeared in the NB-IoT Control Center, as well as sections:
NIDDAPN
NIDD Accounts
NIDD Security - at the very bottom there is a menu item "API M2M" with the "NIDD Developer's Guide"
The whole economy should look something like this:
If something is missing in the M2M manager, feel free to send a request to your manager at MTS with a detailed description of your wishes.
If the necessary items of the NB-IoT Control Center are in place, you can start filling them out. Moreover, the βNIDD Accountsβ item is the last thing: it will need data from neighboring sections.
- NIDDAPN: we come up with and fill in the name of our APN and the βApplication IDβ.
- NIDD Safety: here we specify the IP address of our application server, which will communicate with NB-IoT devices through the MTS service (server).
- NIDD Accounts: Just fill in all the fields and click "Save".
As soon as all the points are filled in, you can begin to deal with the requests that our server should form. We go to "API M2M" and read the "NIDD Developer's Guide". In order for the device to be able to register in the NB-IoT network, you need to create an SCS AS configuration:
The manual has a description of the individual query parameters, I will only give a couple of small comments:
- link for sending requests: m2m-manager.mts.ru/scef/v1/3gpp-nidd/v1/{scsAsId}/configurations, where scsAsId is the βApplication IDβ from the βNIDD APNβ menu item;
- basic authorization method with a login and password - use the login and password that you created when filling out the "NIDD Accounts" menu item;
- notificationDestination is the address of your server. From it you will send non-ip messages to devices, and the MTS server will send notifications about sending and receiving non-ip messages to it.
When the SCS AS configuration is created and the device has successfully registered in NIDD mode in the operator's NB-IoT network, you can try to exchange the first non-ip messages between the server and the device.
To send a message from the server to the device, study the section "2.2 Sending a message" of the manual:
{configurationId} in the request link, a value of the "hex-abracadabra" type obtained at the configuration creation stage. Looks like: b00e2485ed27c0011f0a0200.
date β message content in Base64 encoding.
Configuring an NB-IoT device to work in NIDD
Of course, in order to exchange data with the server, our device must not only be able to work in the NB-IoT network, but also support the NIDD (non-ip) mode. In the case of the N21 DEMO development board or other device based on
We activate the configuration with the APN, which we came up with when filling out the "NIDD APN" item of the M2M manager (here - EFOnidd):
AT+CFGDFTPDN=5,"EFOnidd"
and ask the device to re-register on the network:
AT+CFUN=0
AT+CFUN=1
then issue the command
AT+CGACT=1,1
and send the message "test":
AT+NIPDATA=1, "test"
Upon receipt of a non-ip message on the UART of the N21 module, an unsolicited message of the form is issued:
+NIPDATA:1,10,3132333435 // received non-ip message '12345'
where
1 - CID, pdp context
10 - number of data bytes after the decimal point
The message arrives at the server in Base64 encoding (in a POST request).
PS To simulate the transfer of data from the server, it is convenient to use the program
I hope it's useful to someone.
Thank you.
Source: habr.com